Skip to content

Codex native roles - #3

Closed
abdoharb wants to merge 12 commits into
MShokry:mainfrom
abdoharb:codex-native-roles
Closed

abdoharb wants to merge 12 commits into
MShokry:mainfrom
abdoharb:codex-native-roles

Conversation

@abdoharb

@abdoharb abdoharb commented Oct 8, 2026

Copy link
Copy Markdown

No description provided.

abdoharb and others added 12 commits October 4, 2026 22:17
Make the generated Codex lead recover the correct team session, preserve
planner continuity and approvals, and detect runtime permission failures
before delegating work. Align the shared Claude/Codex pipeline contract
with Codex's protected configuration directories.

Runtime state and migration:
- Move generated task records, artifacts, provenance, server credentials,
  session pins and logs from .agents/ to .pipeline/. Keep discoverable
  skills under .agents/skills/ and Codex configuration under .codex/.
- Synchronize scripts, role instructions, flow references and ignore rules.
  Read legacy provenance for update triage, but refuse normal bootstrap
  while legacy task state remains to prevent parallel runtime directories.
- Document the breaking path change in migration 02 and the changelog.
  Existing projects require a task-boundary migration that preserves
  history, customizations and skills; no automatic migration is performed.

Exact lead and planner recovery:
- Replace latest-session fallback with a dedicated launcher and per-team
  session pin captured by SessionStart/UserPromptSubmit hooks. Run without
  the shared daemon so hooks receive the selected team's launch context.
- Validate hook inputs and project boundaries, ignore unrelated Codex
  chats, prevent pin replacement and concurrent leads, and stop on failed
  resume or missing session capture. Require explicit --fresh for a reset.
- Record the planner thread in task state; reuse it for same-task fixes,
  recover from task records and decision history, and release it on task
  completion. Preserve recorded workflow approvals across recovery.

Configuration and preflight:
- Add optional lead/planner model and reasoning flags, defaulting to
  inherit, with validation and provenance round-tripping.
- Install delegate, status-board and karpathy-guidelines supporting skills
  without overwriting local files. Expand update guards for permissions,
  hooks, agent tools, MCP and skills while allowing deliberate local drift.
- Check required CLIs, feature capabilities, generated files, actual
  .pipeline write access and authenticated OpenCode connectivity using the
  same endpoint/password precedence as oc.sh. Replace the raw flow curl
  check so custom endpoints work consistently.
- Keep workflow consent separate from runtime permissions. Preserve hook
  review/trust requirements and avoid automatic permission broadening.

Documentation and validation:
- Add the Codex setup/recovery guide, manual live-verification checklist,
  migration instructions and synchronized generator lessons/references.
- Add no-model behavioral coverage for launch/resume isolation, fresh and
  failure paths, hook validation, locks, preflight failures, settings,
  legacy migration guards and customization preservation; run it in CI.
- Add an opt-in real Codex OS sandbox check demonstrating writable
  .pipeline state and protected .agents/skills, .codex and .git paths.

Validation passed: smoke (25 checks), invariants (113 rule/file pairs),
Codex behavior (8 groups), real Codex 0.160.0 sandbox probe, Bash syntax
checks and staged diff whitespace checks. ShellCheck was unavailable
locally; CI retains its optional check. No live model-driven pipeline or
native planner/skill discovery run was performed. The planner's source
write boundary remains instructional under classic workspace-write.
Brings in OpenCode lead (leader/planner/commands, team.sh --lead opencode),
the standalone dashboard and the optional Herdr plugin, without changing the
fork's contract: task records stay in .pipeline/, skills in .agents/skills/,
OpenCode roles in .opencode/agents/, Codex launcher/hooks/preflight intact.

- Port upstream's new templates, dashboard and Herdr plugin from .agents/ to
  .pipeline/; dashboard falls back to an unmigrated .agents/ runtime.
- team.sh: keep codex-lead.sh for Codex, add upstream's OpenCode branch.
- init.sh: refuse bootstrap on legacy worker files, not on directory presence
  (upstream scaffolds already have .opencode/agents/ for leader/planner).
- Replace upstream's root AGENTS.md (a Claude->Codex find/replace copy of
  CLAUDE.md) with a pointer to CLAUDE.md.
- Fix v1 abort endpoint in feature.md; make verify-models.sh generic and
  fix its temp-file trap; warn when Codex is older than the tested baseline.
- Renumber upstream's lessons 29-31 to 33-35.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
CI's ShellCheck step failed (also on codex-lead-parity before the merge) and
stopped before the templates loop ran. Fix every finding:

- SC1087 in codex-preflight.sh.tmpl: brace the loop variable in the regex.
- SC2207 in team-completion.bash.tmpl: intentional word-splitting; mapfile is
  unavailable in macOS bash 3.2, so disable for the function with a reason.
- SC2015 in smoke.sh and codex.sh: split A && B || C into separate checks.
- SC2016 in init.sh and tests: literal backticks in single quotes are
  intentional; annotate each site.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Merge upstream v0.10.0 into the Codex/.pipeline line
Give a Codex lead the mechanics the Claude harness supplies natively, and
write down the lead lessons that only lived in a Claude session.

- scripts/bg-dispatch.sh (start/wait): detached dispatch plus a bounded,
  repeatable wait, replacing the Claude-only Monitor watch.
- scripts/claude-review.sh: headless `claude -p --agent reviewer` with a
  read-only tool list, so a non-Claude lead can dispatch a claude/* reviewer.
- scripts/oc.sh: --status (v2 /api/session/active) and --interrupt
  (v2 /api/session/<id>/interrupt).
- promote-findings.sh skips directory tags instead of aborting the run.
- codex-preflight.sh checks the new wrappers and the Claude reviewer deps.
- feature flow: status check, merge record, mid-task model switch,
  concurrent-writer claims, exact Pass heading, tester-cannot-be-spawned.
- Codex feature skill: matching adaptations.
- init.sh renders/updates the new scripts and ignores dispatch traces.
- smoke: 3 new checks (36 total).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- --tester-model codex/<model> scaffolds .codex/agents/tester.toml, a
  report-only Codex tester; verify-models.sh skips codex/* like claude/*;
  codex-preflight.sh requires the tester agent when the manifest names one.
- OpenCode lead: claude/* reviewer via scripts/claude-review.sh, waits via
  bg-dispatch.sh, stops roles with oc.sh --interrupt.
- Generated AGENTS.md asks the project to record whether sending review
  material to Anthropic is authorized.
- smoke: codex/* tester scaffold check (37 total).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BREAKING CHANGE: the state file's single "OpenCode session id" is replaced
by per-role fields (builder, reviewer, tester) plus "Codex tester thread
id". Migration: migrations/04-per-role-sessions.md.

- Session policy: each role's first oc.sh call starts its own session and
  only that role's retry reuses it. A shared task session broke on opencode
  v2 (a session pins the opening agent's tool set, so the tester could not
  write results) and fed the reviewer the builder's reasoning. Review and
  test commands no longer pass the builder's session.
- SYSTEM.md, the invariant rule, dev-team-generator references (lesson 21
  rewritten), README, oc.sh header and the OpenCode lead follow.
- Canonical step 2 creates a T-<id>-<slug> branch (project prefix kept)
  before any implementer runs.
- init.sh --builder-auto ask|on stamps builder_auto; `on` is a standing
  user decision, `ask` (default) keeps the spec-time question. The flow
  names builder.md's deny list as the only thing --auto does not approve.
- smoke: builder_auto stamping and per-role state fields (38 total).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- claude-review.sh: SC2015, use an explicit if for the argument-count check.
- oc.sh --status: SC2086 disabled with a reason; the unquoted id list is
  the intentional one-argv-per-session split.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er-free retry

Closes the gaps that made a Codex lead feel worse than a Claude lead on the
same canonical flow:

- codex-dev (.codex/agents/codex-dev.toml): a Codex implementer the lead can
  spawn on request, delegating to senior-dev.md; .git stays read-only.
- reviewer.toml for --reviewer-model codex/<model>: a read-only-sandbox
  reviewer under reviewer.md's contract. Reviewer independence now compares
  the implementer's vendor family; the cannot-spawn rule covers reviewers.
- .codex/rules/pipeline.rules: lets only scripts/oc.sh, bg-dispatch.sh,
  claude-review.sh and verify-models.sh run outside the sandbox without a
  prompt per call (trusted projects only). Checked with codex execpolicy.
- bg-dispatch.sh --retry-on-limit: detached loop that reruns a dispatch only
  on usage-limit failures, for leads with no scheduler.
- codex-preflight exits 3 to hand the API probe to oc.sh --status; session
  hook is silent per prompt and lists unfinished tasks at session start.
- State template: codex-dev plus Codex implementer/reviewer thread ids
  (migrations/05-codex-native-roles.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@abdoharb abdoharb closed this Oct 8, 2026
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.

2 participants