fix(dispatch): drive one-shot CLI agents (claude/codex) with the prompt at launch#127
Merged
Conversation
…pt at launch `dispatch` drove every worker fork-idle then `session send` — the opencode SERVER model. claude/codex are one-shot `agent -p PROMPT`: the prompt must ride the launch argv, and a later `session send` can't drive a finished one-shot. So `dispatch --agent claude` (the documented default) booted VMs that never ran a turn → silent 0/0. This is why the Opus-via-pillbox `-k` path never actually worked. Fix: CLI-harness agents fork WITH the prompt (`run --detach -- "<prompt>"`) and are awaited+graded; server agents keep fork-idle + send + retry (byte-identical). - WorkerDriver: `fork(i, first_turn)` + `first_turn_driven_on_fork(i)` (classified by `agents::lookup(...).server.is_none()`, default-agent-aware via resolve_run_config). - drive_to_grade branches: CLI = wait+grade, no send, no in-session retry (best-of-k is the variance lever); server = the existing send→wait→grade→retry loop, unchanged. - `--segments` declined for CLI agents (a one-shot can't chain in-session) → exit 2. Live-verified: scripts/smoke/dispatch-claude.sh (`dispatch -k 2 --agent claude` → 2/2 Opus workers scored, winner pulled, result.txt recovered) — also exercises 2 concurrent claude forks through the (now-fixed) vault. fmt + clippy (both feature sets) + 581 unit tests green incl. the new one-shot test. Implemented via codex-rescue, independently verified + live-smoked here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dispatchdrove every worker fork-idle thensession send— the opencode server model. claude/codex are one-shotagent -p PROMPT: the prompt must ride the launch argv, and a latersendcan't drive a finished one-shot. Sodispatch --agent claude(the documented default) booted VMs that never ran a turn → silent 0/0 — why the Opus-via-pillbox-kpath never actually worked.Fix
CLI-harness agents fork with the prompt (
run --detach -- "<prompt>") and are awaited+graded; server agents keep fork-idle + send + retry (byte-identical).WorkerDriver:fork(i, first_turn)+first_turn_driven_on_fork(i)(classified viaagents::lookup(...).server.is_none(), default-agent-aware).drive_to_gradebranches: CLI = wait+grade (no send, no in-session retry — best-of-k is the variance lever); server = the existing send→wait→grade→retry loop.--segmentsdeclined for CLI agents (a one-shot can't chain in-session) → exit 2.Verification
scripts/smoke/dispatch-claude.sh—dispatch -k 2 --agent claude→ 2/2 Opus workers scored, winner pulled,result.txtrecovered. Also exercises 2 concurrent claude forks through the (now-fixed fix(vault): degraded lease so a poisonedpendingdoesn't brick valid tokens #125) vault.--no-default-featuresand--features libkrun,-D warnings) + 581 unit tests green incl. the new one-shot test.Implemented via codex-rescue, independently diff-reviewed + live-smoked. Follow-ups (separate): eval-harness
kill -9mid-pre_refresh;runrc=0 on fork-fail.