Repository navigation
Description
This was generated by AI during triage.
Problem
An implement session can finish its change and push its commits, yet never open the pull request, when the session ends while its own background helpers are still running. The Ticket run then fails at Pull request readiness with only no PR found. The work survives on the Issue branch, but the Ticket fails, and in a Spec run that leaves the Spec incomplete.
Observed (2026-11-14, wire-report Spec #43, Ticket #73, Lima, thirdshift 0.32.0, claude · opus)
From the Spec's Command log:
16:20:35 #73: implement: session started
17:20:40 #73: implement: commit
17:20:43 #73: implement: skill thirdshift-code-review
17:21:17 #73: implement: Agent Standards review of issue-73
17:21:28 #73: implement: Agent Spec review of issue-73
17:22:19 #73: implement: SubagentHandback
17:32:25 #73: Background tasks still running 10m after the last turn (subagent "Spec review of issue-73"); stopping them. Set CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS=0 to wait indefinitely.
17:32:26 #73: implement: session ended after 71m 51s: 0 turns, $2.74 at API prices
17:32:26 #73: implement: no review reports were left; carrying on
17:32:29 #73: security-review: session started
17:33:13 #73: security-review: session ended after 45s
17:33:14 #73: pushing issue-73
17:33:21 #73: Stopped at: Pull request readiness
17:33:21 #73: no PR found
So the session:
- committed the change;
- started the
thirdshift-code-reviewskill's two background subagents; - received one handback and then ended its turn, with the other subagent still running.
Claude Code's -p mode waits at most 10 minutes for background tasks after the last turn, then stops them. The session therefore ended before its remaining steps, which included creating the PR with thirdshift-pr (the implement prompt asks the session to push and create it). thirdshift pushed issue-73, which holds the commit, and then failed to find a PR.
This is the same family as #2171: a Claude session that ends a turn while waiting on background work instead of finishing in the foreground.
Agent Brief
Category: bug
Summary: an implement session that pushed commits but opened no PR shouldn't fail the Ticket with a bare no PR found, and implement sessions on Claude Code shouldn't lose their final steps to the background-task wait ceiling.
Current behavior:
- If the implement session ends without creating the PR, readiness fails with
no PR found(from the pull request's actionability check). This happens even when the Issue branch carries the session's commits and the Security review passed. - Nothing tells the session not to end its turn while subagents are running. The 10-minute ceiling (
CLAUDE_CODE_PRINT_BG_WAIT_CEILING_MS) kills the helpers silently from thirdshift's point of view.
Desired behavior:
- Recover the missing PR. After the implement session, and after the Security review if one runs: when the Issue branch has commits ahead of its Base branch but no open PR exists for it, thirdshift opens the PR itself as the session would have, against the Run's Base branch (the Spec branch for a Spec's Ticket), with the usual body and
Built withline. It logs a line naming the recovery, then continues to readiness, CI and Self-merge as normal. If the branch has no commits ahead, the existing failure stands, with a clearer cause such as "the implement session made no commits and opened no pull request". - Say why when the ceiling fires. When the Claude harness reports "Background tasks still running … stopping them", the Command log and Run notification say the session's background work was stopped at the ceiling. If the Ticket then fails, the failure cause names it rather than only
no PR found. - Prevent the stall. The implement prompt, or the
thirdshift-code-reviewskill when it runs inside a thirdshift session, makes the session wait for its review subagents in the foreground before ending its turn. Alternatively, thirdshift sets the Claude harness's background wait ceiling so that a running review is not killed partway. Choose whichever fits the harness layer. The goal is that a session's own review cannot outlive the session.
Acceptance criteria:
- With fakes, an implement session that pushes commits and creates no PR leads to thirdshift opening the PR and the Ticket run continuing to merge. The log names the recovery.
- An implement session that makes no commits and opens no PR still fails, with a cause that says so, not a bare
no PR found. - A Claude session whose output includes the background-tasks-stopped line has that fact in the Command log and, on failure, in the cause.
- The prompt, skill or harness change is covered by the existing prompt or harness tests, and generated prompts are regenerated (
UPDATE_PROMPTS=1 cargo test prompts_page). - The guide's description of Pull request readiness mentions the recovery.
Out of scope:
- A Claude session can enter an autonomous /loop that waits for human review and holds its Command for hours #2171's autonomous
/loopbehaviour, except where the same prompt guidance covers both. - Changing how Continuations or Recovery commands work.
- Non-Claude harnesses, unless they show the same pattern.
Activity
Merge pull request #2237 from JacobStephens2/issue-2231