fix(codex-crew): bypass codex:codex-rescue for coordinator dispatch - #78
Merged
Conversation
…d task tracking Three coordinator doctrine changes to grand-admiral and dependents: - Prefer mcp__agent-watchdog__* tools over the built-in Monitor script when available; built-in mechanics (discovery sources, event grammar, STALL/GONE playbooks) extracted to skills/grand-admiral/references/stall-watchdog.md. - New Development-Work Delegation doctrine: brief actual coding work (Bilby, Codex Sol) by goal only, not a file list — the implementer investigates and returns its own plan for coordinator approval before writing code. Threaded through delegate, both workflow skills' Phase 2, developer-bilby, and codex-crew's new Plan-Approval Gate (two dispatches on the SAME Codex thread via --resume, not independent ones, to avoid rebuilding context). - track-minions: in-session task tracking now uses a plain durable file, not memcan:todo; memcan:todo reserved for cross-session/cross-project tracking. Also fixes two open codex-crew gaps surfaced while writing the Plan-Approval Gate: the broker binds to the invoking session's actual cwd, not any path injected into the dispatch prompt (EnterWorktree is now required before dispatching), and the "stagger" mitigation for same-cwd collisions is rewritten as a hard poll-for-terminal-status rule. Closes memcan:todo 445f8637 and 8d5cc5fb (project=claudius). Consistency-audited by project-reviewer-adams; 5 low-severity cross-reference issues found and fixed. plugin.json bumped to 5.15.0. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
codex:codex-rescue's forwarding contract never exposes --cwd/--prompt-file to the underlying codex-companion.mjs runtime, forcing worktree binding through EnterWorktree/ExitWorktree (serializing concurrent multi-worktree dispatch) and shell-inlined prompts (corrupting on embedded quotes/Rust Debug dumps). Both flags are already supported by the script directly. codex-crew now documents calling `codex-companion.mjs task` directly with --cwd and --prompt-file for all coordinator-orchestrated dispatch, fixing both structurally and removing the wrapper agent's unreliable idle_notification/stall-watchdog signal (no agent lifecycle, nothing to watch). codex:codex-rescue is scoped to the upstream interactive /codex:rescue command only. Bump plugin.json to 5.16.0 per versioning policy. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…-dispatch # Conflicts: # .claude-plugin/plugin.json # CHANGELOG.md # skills/codex-crew/SKILL.md
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Claudius’ coordination doctrine to make Codex dispatches more reliable by removing the codex:codex-rescue wrapper from coordinator-orchestrated flows, and aligns several workflow/delegation skills around “goal-first, plan-gated” implementation.
Changes:
- Document direct coordinator dispatch to
codex-companion.mjs taskusing explicit--cwd+--prompt-file, and adjust Codex monitoring/recovery guidance accordingly. - Introduce/propagate “Development-Work Delegation (WHAT, not HOW)” guidance across workflow skills,
delegate, and developer agent prompts (plan first, coordinator approval, then implement). - Refactor watchdog doctrine: prefer MCP watchdog when available, keep built-in Monitor as fallback, and extract detailed fallback mechanics into a reference file; bump plugin version and update changelog.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| skills/codex-crew/SKILL.md | Switches coordinator doctrine to direct Codex runtime dispatch; updates plan/monitoring rules. |
| skills/codex-crew/references/sandbox-and-recovery.md | Updates job-state mapping notes for direct dispatch vs interactive wrapper path. |
| skills/grand-admiral/SKILL.md | Adds “Development-Work Delegation” doctrine and MCP-watchdog preference; trims fallback details. |
| skills/grand-admiral/references/stall-watchdog.md | New extracted reference for built-in watchdog mechanics and playbooks. |
| skills/delegate/SKILL.md | Updates pre-delegation checklist for watchdog choice + plan gate. |
| skills/track-minions/SKILL.md | Reframes durable tracking: in-session file primary; memcan for cross-session/project. |
| skills/workflow-trivial/SKILL.md | Aligns trivial workflow implementation phase guidance with new delegation doctrine. |
| skills/workflow-simplified/SKILL.md | Requires implementer-authored plan + coordinator sign-off per task before coding. |
| skills/workflow-feature/SKILL.md | Same plan gate + acceptance-criteria briefing pattern for feature workflow. |
| agents/developer-bilby.md | Adds an explicit “Implementation Plan Gate” before coding. |
| agents/architect-nagatha.md | Adjusts architecture guidance to leave file-level placement to implementer plan. |
| CHANGELOG.md | Adds release notes for new doctrine/version. |
| .claude-plugin/plugin.json | Bumps plugin version to 5.16.0. |
Comments suppressed due to low confidence (1)
CHANGELOG.md:22
- The changelog introduces both 5.15.0 and 5.16.0 sections, but
.claude-plugin/plugin.jsonis bumped directly to 5.16.0 in this PR. That makes the release notes ambiguous, and the 5.15.0 “Fixed” bullet about requiringEnterWorktreeconflicts with the new 5.16.0 direct-dispatch doctrine (--cwdremoves that requirement). Consider collapsing these notes into a single 5.16.0 entry so the changelog matches the single version bump and the final guidance.
## [5.15.0] - 2026-07-22
### Added
- **`skills/grand-admiral/references/stall-watchdog.md`**: new reference file — the built-in Monitor's discovery sources, event grammar, Multi-Session Hygiene traps, and STALL/GONE playbooks, extracted from `grand-admiral` § Recovery so they load only when the fallback path is actually used.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Resolve the installed `codex` plugin's script root once per session — version-pinned cache dirs shift on plugin updates, so never hardcode a version: | ||
|
|
||
| ```bash | ||
| CODEX_ROOT=$(find ~/.claude/plugins/cache/openai-codex/codex -maxdepth 1 -mindepth 1 -type d | sort -V | tail -1) |
lklimek
marked this pull request as ready for review
July 22, 2026 15:52
lklimek
pushed a commit
that referenced
this pull request
Jul 23, 2026
origin/main squash-merged PR #78 as 8120a45, whose tree was already byte-identical to this branch's own 44e0c52 merge commit (same underlying change, different commit SHA) — git's merge-base landed on an older common ancestor and flagged plugin.json, CHANGELOG.md, and codex-crew/SKILL.md as conflicting even though our side is a strict superset (same content plus this branch's own fixes layered on top). Resolved by keeping our side throughout; verified no residual content was lost from origin/main.
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.
TL;DR: Codex dispatches from a coordinator now call the Codex runtime directly instead of routing through a Claude subagent that added no value and caused most of the recurring dispatch bugs.
User story
As a developer using Claudius to orchestrate Codex Sol coding work, I want a Codex dispatch to bind reliably to the worktree I intended and never silently collide with another dispatch, so that multi-worktree coding work completes predictably instead of stalling or getting duplicated.
Scenario
Base flow
A coordinator wants to hand a coding task to Codex Sol against a specific pre-created worktree, previously by spawning the
codex:codex-rescueClaude subagent, which forwards the request to thecodex-companion.mjsruntime as a single shell command.Actual behavior
codex:codex-rescue's forwarding contract never exposes the runtime's own--cwd/--prompt-fileflags. As a result: the broker/workspace binds to the coordinator's own working directory, not the target worktree, so every dispatch from one session shares one broker regardless of which worktree it's meant for; two dispatches close together collide (one strands atstatus=runningforever, or silently returns a generic canned reply instead of doing the work); long prompts with embedded quotes or RustDebugdumps can arrive corrupted; and the wrapper agent's own completion signal (idle_notification) is unreliable in both directions, so jobs finish 40–85 minutes before anyone finds out. Working around the cwd problem required a separateEnterWorktree/ExitWorktreedance that also blocked genuinely concurrent multi-worktree dispatch.Expected behavior
The coordinator calls the
codex-companion.mjsruntime directly, passing the target worktree and the prompt (as a file) as explicit arguments. Each dispatch is self-contained — distinct worktrees never share a broker, prompts never go through shell-quoting, and there is no wrapper-agent lifecycle to produce a false completion signal. Monitoring goes straight to the job's on-disk state, which now reliably reflects the intended worktree.Detailed discussion
What was done
skills/codex-crew/SKILL.md: new § Direct Dispatch documents callingcodex-companion.mjs taskdirectly with--cwd <worktree-abs-path>and--prompt-file <abs-path>for all coordinator-orchestrated dispatch;codex:codex-rescueis now scoped to the upstream, user-typed/codex:rescueinteractive command only.EnterWorktree/ExitWorktreerequirement, since--cwdbinds the worktree directly and allows real concurrent multi-worktree dispatch.--cwd(renamed from § Never Dispatch Back-to-Back from the Same cwd): collision risk is now scoped to literal same---cwddispatches, not every dispatch in a session.skills/codex-crew/references/sandbox-and-recovery.md: on-disk job state'sworkspaceRootnow reliably matches the intended worktree for direct dispatch; the old dispatching-session-cwd caveat is scoped to the interactive path only.memcan:todoitems (project=claudius) this change resolves at the root:d8f1a08b(--writeomission / self-reinvocation collision),4d1f3d2f(quote/Rust-Debug-dump corruption),b6f79473(same-cwd collision manifesting as an instant generic reply)..claude-plugin/plugin.jsonbumped5.15.0→5.16.0;CHANGELOG.mdupdated.No source code changed — this is a skill-doctrine change only, no new scripts.
Testing
claude plugin validate .passes (one pre-existing, unrelated warning aboutCLAUDE.mdat plugin root).Breaking changes
None. This changes agent guidance, not a public interface; any coordinator following the old
EnterWorktree-based doctrine still works, it's just no longer necessary.Checklist
plugin.jsonversion bumpedCHANGELOG.mdupdatedclaude plugin validate .cleanmemcan:todoitems closedPrior work
None — first attempt at removing the wrapper-agent layer; prior PRs (#71–#75) hardened the wrapper-based approach instead.
Attribution
🤖 Co-authored by Claudius the Magnificent AI Agent