Skip to content

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

Closed

Description

@JacobStephens2

This was generated by AI during triage.

Agent Brief

Category: enhancement
Summary: The headless prompt tells a session how to wait on a command that went to the background, so it never waits on process names other sessions share

Current behavior:
Every Session prompt ends with the headless paragraph: run tests and other long commands in the foreground, raising the Bash timeout if needed, and never end the turn while a background task you depend on is still running. It says nothing about a foreground command that outlives the Bash tool's longest timeout (600s). The tool then moves the command to the background, and the session is left to improvise its own wait.

Seen in the #148 Merge run on 2026-09-30, while #147 and #158 ran at the same time: the full cargo test went past 600s and was moved to the background (task bmk201pfz). The session waited on it with until ! pgrep -f "cargo test"; do sleep 5; done. That pattern also matched the other sessions' cargo test processes. Its own suite finished (exit 0) at about 12:08Z, but the loop kept going until the tool killed it at 12:14:49Z (exit 144). That is about 7 minutes lost, and it could have been the whole session if the other suites had kept running.

Desired behavior:
The headless paragraph also says: if a command is moved to the background, wait for that task by its own task id or output file, never on process names or patterns (pgrep, ps | grep, and the like), because other sessions on the same machine run the same commands. The existing guidance stays: foreground first, and don't end the turn while a background task you depend on is still running.

Key interfaces:

Acceptance criteria:

  • Every Session prompt (fresh, continuing, each Repair kind, and any others) ends with headless text that says to wait on a backgrounded command by its own task id or output file
  • The same text says not to wait on process names or patterns, and gives the reason: other sessions on the machine run the same commands
  • The existing foreground and "never end your turn while a background task you depend on is still running" guidance is still there
  • Tests that assert on prompt text pass with the new wording

Out of scope:

  • Making the test suite faster (Make the test suite faster #174)
  • Any change to how thirdshift detects or reports killed background work
  • Changing the Bash timeout the sessions run with
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions