Skip to content

Tell sessions to wait on a backgrounded command by its own task - #183

Merged
JacobStephens2 merged 2 commits into
mainfrom
issue-180
Sep 30, 2026
Merged

JacobStephens2 merged 2 commits into
mainfrom
issue-180

Conversation

@JacobStephens2

Copy link
Copy Markdown
Owner

Summary

The shared headless text every Session prompt ends with (HEADLESS in src/prompt.rs) now says how to wait on a command that the Bash tool moves to the background:

 You run headless: nobody is watching, and ending your turn ends the session.
 Run tests and other long commands in the foreground, raising the Bash timeout if needed.
+If a command is moved to the background, wait for that task by its own task id or output file,
+never by process names or patterns (`pgrep`, `ps | grep`, and the like):
+other sessions on this machine run the same commands.
 Never end your turn while a background task you depend on is still running: ending the turn kills it.

The text lives only in that one constant, so the fresh, continuing, Spec review, resume and every Repair prompt pick it up. The Prompts and skills page (site/prompts/index.html) was regenerated.

Evidence

  • Before: cargo test --test fresh_run failed on gives_the_agent_the_fresh_prompt once the expected prompt had the new sentence and HEADLESS didn't yet.
    After: fresh_run, continuation, mergeable and ci pass with the new wording, and so does the golden-file test prompts_page_shows_what_the_binary_sends. All 24 test binaries pass. cargo clippy --all-targets and cargo fmt --check are clean.

Merge Danger

Door: two-way

Only prompt text changes. A revert restores the old wording.

Blast Radius: prompts

Every Session gets one more sentence, and nothing else changes.

Unaddressed findings

Standards

  • writing-for-agents "Negation": drop the pgrep / ps | grep examples. Skipped. The issue asks for these examples, and the ban comes with the positive instruction. The examples name the exact pattern that cost the One Run notification per Spec run #148 run about 7 minutes.
  • Duplicated Code / Shotgun Surgery: the full HEADLESS text is copied into 4 test files. Skipped. This was already the case before this branch. Those tests pin the whole prompt on purpose, and changing that is out of scope here.
  • The reason appears in both the doc comment and the string. Skipped. The reviewer said no action was needed, since the comment also explains the effect (the wait outlasts the session's own task).

Spec

None.

Closes #180

🤖 Generated with Claude Code

JacobStephens2 and others added 2 commits September 30, 2026 12:47
The headless text every Session prompt ends with now says to wait on a
command the Bash tool moved to the background by its task id or output
file, never by process names or patterns, since other sessions on the
machine run the same commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobStephens2
JacobStephens2 merged commit 9349e2d into main Sep 30, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-180 branch September 30, 2026 13:13
@JacobStephens2 JacobStephens2 linked an issue Sep 30, 2026 that may be closed by this pull request
4 tasks
@JacobStephens2 JacobStephens2 mentioned this pull request Sep 30, 2026
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.

Sessions wait on a backgrounded command by its own task, not by process name

1 participant