Pipeline agents cannot submit handoffs inside a worktree session #1415

Closed
opened 2026-10-27 15:56:59 +00:00 by jared · 2 comments
Owner

Problem

In a worktree session, pipeline agents cannot submit their handoff with os-sdlc-subagent-stop --json '<payload>'. The Claude Code shell guard refuses the command. Leaving the worktree lets the submit through, but it breaks the run silently: SubagentStart then builds each brief from the main checkout, so the briefs miss every change in the worktree.

Observed

Ticket #1111, implementation 178, dispatch 1557 (change-auditor). The guard refused the --json submit three times, with a full, a short, and a minimal payload:

too complex to verify that it stays inside the worktree

The orchestrator left the worktree. The submit then passed. The test-reviewer brief (dispatch 1560) had test_changes: null, because the new test file existed only in the worktree. The test-reviewer returned verdict error, and the run ended implementation_failed with reason verdict:error.
Implementation 179 ran from inside the worktree. Agents wrote the JSON to a scratchpad file and ran os-sdlc-subagent-stop < file. All 8 submits passed. The guard also refused a heredoc form (dispatch 1566); printf to a file passed.

Reproduce

n/a: needs a live worktree session and the Claude Code shell guard; the evidence is implementations 178 and 179 of #1111.

Approach

Two parts. The decided part: agent definitions name the stdin-file submit as the one submit form. The open part: the brief root. A brief must come from the implementation's worktree, not from the session cwd, so a wrong cwd cannot produce an empty test_changes. Decide the second part at takedown.

Origin

  • Trigger: /os-sdlc:implement 1111, implementations 178 and 179 (dispatches 1557-1568)
  • Improvised this session: agents wrote the handoff JSON to the session scratchpad and submitted with os-sdlc-subagent-stop < file; the orchestrator re-entered the worktree and opened run 179
  • Chain: run 178 verdict:error ← test-reviewer brief had test_changes: null (dispatch 1560 handoff 1591) ← brief built from the main checkout (plugins/os-sdlc/lib/os_sdlc/dispatch/brief.rb:6, subagent_start.rb:30) ← orchestrator left the worktree (IMPROVISATION) ← shell guard refused --json submit (UPSTREAM-TOOL, Claude Code shell guard)
  • Root candidate: none found; searched worktree, guard, subagent-stop, submit, brief root, session cwd, test_changes
  • Where: plugins/os-sdlc/agents/*.md (submit instructions); plugins/os-sdlc/lib/os_sdlc/dispatch/brief.rb
  • Session: d14200e8-6fb4-4e54-b125-73537f7a28fc
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/d14200e8-6fb4-4e54-b125-73537f7a28fc.jsonl

VERDICT: CREATE

## Problem In a worktree session, pipeline agents cannot submit their handoff with `os-sdlc-subagent-stop --json '<payload>'`. The Claude Code shell guard refuses the command. Leaving the worktree lets the submit through, but it breaks the run silently: SubagentStart then builds each brief from the main checkout, so the briefs miss every change in the worktree. ## Observed Ticket #1111, implementation 178, dispatch 1557 (change-auditor). The guard refused the `--json` submit three times, with a full, a short, and a minimal payload: ``` too complex to verify that it stays inside the worktree ``` The orchestrator left the worktree. The submit then passed. The test-reviewer brief (dispatch 1560) had `test_changes: null`, because the new test file existed only in the worktree. The test-reviewer returned verdict `error`, and the run ended `implementation_failed` with reason `verdict:error`. Implementation 179 ran from inside the worktree. Agents wrote the JSON to a scratchpad file and ran `os-sdlc-subagent-stop < file`. All 8 submits passed. The guard also refused a heredoc form (dispatch 1566); `printf` to a file passed. ## Reproduce n/a: needs a live worktree session and the Claude Code shell guard; the evidence is implementations 178 and 179 of #1111. ## Approach Two parts. The decided part: agent definitions name the stdin-file submit as the one submit form. The open part: the brief root. A brief must come from the implementation's worktree, not from the session cwd, so a wrong cwd cannot produce an empty `test_changes`. Decide the second part at takedown. ## Origin - Trigger: /os-sdlc:implement 1111, implementations 178 and 179 (dispatches 1557-1568) - Improvised this session: agents wrote the handoff JSON to the session scratchpad and submitted with `os-sdlc-subagent-stop < file`; the orchestrator re-entered the worktree and opened run 179 - Chain: run 178 `verdict:error` ← test-reviewer brief had `test_changes: null` (dispatch 1560 handoff 1591) ← brief built from the main checkout (`plugins/os-sdlc/lib/os_sdlc/dispatch/brief.rb:6`, `subagent_start.rb:30`) ← orchestrator left the worktree (IMPROVISATION) ← shell guard refused `--json` submit (UPSTREAM-TOOL, Claude Code shell guard) - Root candidate: none found; searched worktree, guard, subagent-stop, submit, brief root, session cwd, test_changes - Where: plugins/os-sdlc/agents/*.md (submit instructions); plugins/os-sdlc/lib/os_sdlc/dispatch/brief.rb - Session: d14200e8-6fb4-4e54-b125-73537f7a28fc - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/d14200e8-6fb4-4e54-b125-73537f7a28fc.jsonl VERDICT: CREATE
Author
Owner

The worktree-root half of this ticket was not filed as a new ticket. The skeptic found it duplicates #1164. The evidence and both candidate designs are on #1164 as an occurrence comment.

The worktree-root half of this ticket was not filed as a new ticket. The skeptic found it duplicates #1164. The evidence and both candidate designs are on #1164 as an occurrence comment.
Author
Owner

Resolution

Done: Decided half: all 13 os-sdlc agent definitions name one submit form — write the handoff JSON to sdlc_handoff_<dispatch_id>.json in the scratchpad (fallback /tmp) and run os-sdlc-subagent-stop < file; --json, heredocs and $(...) are named as refused. Open half (briefs must come from the implementation's worktree) is the same fault as #1164; evidence and both takedown designs posted there.

Evidence: main dd9379e0 (c20002b5, b24c6374); full os-sdlc suite 2778 runs 0 failures; plugin cache refreshed by worktree finish.

Follow-ups: #1164 holds the brief-root half; its takedown stopped at relevance needing a ruling on ADR-0055 (ruling goes to Jared).

## Resolution **Done:** Decided half: all 13 os-sdlc agent definitions name one submit form — write the handoff JSON to sdlc_handoff_<dispatch_id>.json in the scratchpad (fallback /tmp) and run os-sdlc-subagent-stop < file; --json, heredocs and $(...) are named as refused. Open half (briefs must come from the implementation's worktree) is the same fault as #1164; evidence and both takedown designs posted there. **Evidence:** main dd9379e0 (c20002b5, b24c6374); full os-sdlc suite 2778 runs 0 failures; plugin cache refreshed by worktree finish. **Follow-ups:** #1164 holds the brief-root half; its takedown stopped at relevance needing a ruling on ADR-0055 (ruling goes to Jared).
jared closed this issue 2026-10-27 17:19:21 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#1415
No description provided.