Skip to content

fix(core): skip PTY initial-prompt delivery for fleet claude sessions#584

Merged
Wirasm merged 2 commits into
mainfrom
kild/fix-initial-prompt
Feb 25, 2026
Merged

fix(core): skip PTY initial-prompt delivery for fleet claude sessions#584
Wirasm merged 2 commits into
mainfrom
kild/fix-initial-prompt

Conversation

@Wirasm

@Wirasm Wirasm commented Feb 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fleet claude sessions now skip PTY deliver_initial_prompt when the dropbox write_task succeeds — the task.md file exists before the agent process starts, eliminating the TUI-not-ready timing issue
  • Non-fleet sessions and non-claude agents retain PTY delivery (unchanged behavior)
  • open.rs initial-prompt path now writes to the dropbox (was previously PTY-only, with no task recorded in the dropbox)

Test plan

  • cargo fmt --check — no violations
  • cargo clippy --all -- -D warnings — no warnings
  • cargo test --all — all tests pass
  • Manual: kild create test --daemon --agent claude --initial-prompt "Hello" with fleet mode active — verify PTY delivery is skipped (check logs for initial_prompt_pty_skipped)
  • Manual: kild create test --daemon --agent claude --initial-prompt "Hello" without fleet mode — verify PTY delivery still fires
  • Manual: kild open test --initial-prompt "Next task" with fleet mode — verify dropbox write + PTY skip

Fixes #540

Fleet claude sessions get their initial prompt via the dropbox task.md
file, which exists before the agent process starts — no timing issues.
The PTY delivery (text + \r to stdin) is unreliable because the agent
TUI may not be ready to accept input when the Enter arrives (#540).

For fleet claude sessions: dropbox::write_task() writes task.md, then
PTY delivery is skipped entirely. For non-fleet sessions and non-claude
agents: PTY delivery remains the only path (unchanged behavior).

Also adds dropbox task write to open.rs initial-prompt path, which was
previously missing — open only did PTY delivery without recording the
task in the dropbox.

Fixes #540
Deduplicate initial-prompt delivery logic from create.rs and open.rs
into a shared helper in daemon_request.rs. Both callers now use the
same function for dropbox write, fleet skip logic, idle gate clearing,
and PTY delivery.
@Wirasm Wirasm merged commit 197ef82 into main Feb 25, 2026
6 checks passed
Wirasm added a commit that referenced this pull request Feb 26, 2026
…sions

PR #584 fixed PTY timing issues (#540) by skipping PTY delivery for fleet
claude sessions, intending to rely on "dropbox task.md + Claude inbox".
However, only the dropbox write was implemented — the Claude Code inbox
write was never added. Since Claude Code polls its inbox file (not the
dropbox), the initial prompt was silently dropped.

Changes:
- Move write_to_inbox from CLI inject.rs to kild-core fleet.rs
- Call write_to_inbox from deliver_initial_prompt_for_session when
  skip_pty is true (fleet claude sessions)
- Update inject.rs to use the kild-core version
- Add tests for write_to_inbox in fleet.rs
Wirasm added a commit that referenced this pull request Feb 26, 2026
…sions (#609)

PR #584 fixed PTY timing issues (#540) by skipping PTY delivery for fleet
claude sessions, intending to rely on "dropbox task.md + Claude inbox".
However, only the dropbox write was implemented — the Claude Code inbox
write was never added. Since Claude Code polls its inbox file (not the
dropbox), the initial prompt was silently dropped.

Changes:
- Move write_to_inbox from CLI inject.rs to kild-core fleet.rs
- Call write_to_inbox from deliver_initial_prompt_for_session when
  skip_pty is true (fleet claude sessions)
- Update inject.rs to use the kild-core version
- Add tests for write_to_inbox in fleet.rs
Wirasm added a commit that referenced this pull request Feb 26, 2026
When --initial-prompt is used with fleet claude sessions, the CLI now:
1. Prints a deprecation warning telling the agent to use kild inject
2. Delivers the prompt via the reliable inbox path as fallback

Also updates kild-brain.md to instruct the brain to always use
kild create + kild inject (two-step), never --initial-prompt.

The --initial-prompt delivery path has been unreliable for fleet
sessions across PRs #540, #584, #609. The inject path is battle-tested.

Changes:
- create.rs/open.rs: detect fleet claude sessions with --initial-prompt,
  print warning, deliver via fleet::write_to_inbox as fallback
- fleet.rs: make is_claude_fleet_agent and fleet_mode_active pub
- kild-brain.md: replace --initial-prompt usage with create + inject
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

initial-prompt PTY delivery writes text but doesn't submit to Claude Code

1 participant