Skip to content

Make a dispatched stage's output file the completion signal#12

Open
Pijukatel wants to merge 5 commits into
mainfrom
claude/shepherd-issue-8-mgxnft
Open

Make a dispatched stage's output file the completion signal#12
Pijukatel wants to merge 5 commits into
mainfrom
claude/shepherd-issue-8-mgxnft

Conversation

@Pijukatel

Copy link
Copy Markdown

What we're solving

Issue #8: on harnesses that dispatch subagents in the background, the orchestrator could report the verify/explore stages as still running while their output files were already written to .shepherd/ — the run stalled until a human nudged it. The spec never said how a stage dispatch completes, so this failure was fully spec-compliant.

How

  • Stage dispatch gains a completion-signal clause: dispatch prefers blocking; when backgrounded (or fanning reviewers out in parallel), the stage's output file on disk is the authoritative completion signal at every dispatch site. File presence is the floor; formats that define a terminal marker (ledger verdict line, VERDICT: line) also require it, so a parallel round completes only when every reviewer's file is present and carries its verdict. Overwrite-in-place re-dispatches (architect revision, criteria re-run) compare a content hash recorded in _progress.md at dispatch time — never mtime/size alone. Disk is checked before any status claim, on every turn, not only at resume; no idle-polling machinery.
  • Hard rules pins the invariant: never report a dispatched stage as still running, and never end a turn waiting on one, without first checking its output file on disk.
  • Contract test test_dispatched_stage_completion_is_disk_based anchors the durable phrases (shown red against the unmodified spec, green after).

Alternatives considered

  • Mandating blocking-only dispatch — rejected: can't be honored on background-only harnesses and fights the parallel reviewer fan-out.
  • A polling/monitor protocol — rejected as over-engineered; a single disk-is-the-signal invariant closes the failure.

Run evidence (shepherd pipeline)

  • Fulfillment: all 11 success criteria MET.
  • Reviews: staff-review PASS (after 5 fix rounds: marker scoping, overwrite-in-place stale-read, fingerprint hash-only, wording); final reviewers thermonuclear and ponytail-review both PASS with zero findings.
  • Oracle: python -m pytest tests/ -q → 1 failed, 86 passed — baseline-consistent (the 1 failure is pre-existing and environmental: the active shepherd run's own gitignored .shepherd/config.json trips test_repo_does_not_duplicate_shipped_config_files; baseline before the change was 1 failed / 85 passed, the +1 pass is the new contract test). SKILL.md at 444/450 lines.

Closes #8

🤖 Generated with Claude Code

https://claude.ai/code/session_01C7GxHEth3pHrT2EFeytsaq


Generated by Claude Code

jirispilka pushed a commit that referenced this pull request Jul 20, 2026
Stacked on #12. #12 handles "file is on disk but the orchestrator didn't
notice" — the missed-notification case. This adds the other direction:
when the output file never appears (the dispatched agent died rather than
just running slow), an absent file after several turns or a human
check-in is a stall to surface and offer to re-dispatch, not another
"still running" repeat. Extends #12's contract test with the new phrase.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014weQJCVrR4rakMvnSgMVm4
Issue #8: on harnesses that background subagent dispatch, the orchestrator
reported the verify/explore stages as still running while their output
files were already on disk, stalling the run until a human nudged it. The
spec never said how a stage dispatch completes.

A stage's output file on disk is now the authoritative completion signal,
independent of dispatch mode (blocking/background) and site (single or
parallel fan-out); a terminal-marker format also requires its VERDICT line,
and an overwrite-in-place re-dispatch compares a content hash, not
mtime/size. A hard rule pins that the orchestrator never reports a
dispatched stage as still running without checking disk first.

Rebased onto current main; completion clause trimmed to fit the 500-line
SKILL.md cap. Closes #8.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014weQJCVrR4rakMvnSgMVm4
@jirispilka
jirispilka force-pushed the claude/shepherd-issue-8-mgxnft branch from bae7c7b to cfa61d2 Compare July 20, 2026 19:33
Stacked on #12. #12 handles the file-is-on-disk-but-unnoticed case
(missed notification). This adds the other direction: when the output
file never appears because the dispatched agent died rather than running
slowly, an absent file after several turns or a human check-in is a stall
to surface and offer to re-dispatch, not another "still running" repeat.
Extends #12's contract test with the new phrase.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014weQJCVrR4rakMvnSgMVm4
@jirispilka
jirispilka marked this pull request as ready for review July 20, 2026 19:39
@jirispilka
jirispilka self-requested a review July 20, 2026 19:39

@jirispilka jirispilka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll test it together with this fix: #17

jirispilka and others added 3 commits July 21, 2026 14:02
The silent-stall rule leaned on "if dispatch status exists ... report
running only when explicitly active and stalled only when terminal" —
as vague as the "after several turns" trigger it replaced (per
@Pijukatel's review). Replace it with the honest, observable rule: an
absent output file means only "not done" — report status unknown, offer
to wait or re-dispatch, and never fabricate "still running"/"stalled"
from turn count or a human check-in. Nets the skill from 500 to 499
lines and drops two now-redundant contract asserts.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

Shepherd stuck waiting for Shepherd verify stage and Shepherd explore stage

4 participants