--- id: PX-PLAN-2W7CNSCD type: plan title: Hornets Codex Parity and Optional Bridges spec: PX-SPEC-WQR3XWPQ status: draft depends_on: - PX-PLAN-PIXXMV4M --- ## Outcome Add Codex as an equal general-task harness and verify optional communication/review integration without weakening standalone operation. Completes the remaining initial-harness behavior in [Hornets](../../specs/PX-SPEC-WQR3XWPQ-hornets-cross-harness-delegation/index.md). Depends on [Hornets Claude Delegation](../PX-PLAN-PIXXMV4M-hornets-claude-delegation/index.md); does not depend on implementing Ask events or the peer-review skill. ## Evidence boundary Local help for Codex CLI 0.167.0 confirms noninteractive task execution, JSONL events, invocation-local configuration overrides, native session resume, and login-status discovery. No authenticated task, MCP attachment, approval interaction, or native continuation was exercised during planning. [Codex CLI reference](https://developers.openai.com/codex/cli/reference/) and [MCP documentation](https://developers.openai.com/codex/mcp/) require execution-time confirmation against the selected installed version. Do not select Codex's review-specific command as the general delegation primitive or assume configured credentials prove authenticated operation. ## Plan and behavior dependencies Codex extends the working Hornets task contract; optional services do not gate its core behavior. ```mermaid flowchart TB H["Claude task and communication baseline"] --> C["Codex task with same parent contract"] C --> N["Exact-session continuation and teardown"] N --> V["Both harnesses usable independently"] A["Ask question service when present"] -.-> V P["Peer-review skill when present"] -.-> V F["Native Pi question fallback"] --> V ``` ## Ordered behaviors 1. **Complete the same non-review task through Codex.** Add `extensions/hornets/src/adapters/codex.ts`; extend `src/tool.ts` dispatch and `src/runtime.ts` only for demonstrated adapter differences. Reuse the established extension-local task/bridge lifecycle, not sibling extension runtime code. Verify native JSONL records, session identity, config overrides, cwd, status probes, and MCP attachment for the selected Codex version. Preserve Codex-native model/tools/permission semantics; expose differences and unsupported requests rather than pretending Pi/Claude parity. Auth status is an observation, not credential proof or provider preference; no default ignore-user-config, automatic login, or approval/sandbox bypass. Repeat non-review result/progress/context/question/artifact behavior through the existing bridge using a Codex-native client. 2. **Continue and stop either harness without cross-task effects.** Normalize common outcomes only where evidence agrees; retain adapter-specific identity, usage, diagnostics, and unsupported capability. Extend continuation ownership/serialization and cancellation regression fixtures across both adapters, including split records, stale task replies, missing sessions, native auth failure, and stubborn descendants. Fresh continuation replaces task-local MCP routing without reusing expired bridge tokens or relying on another task's last-session shortcut. Either CLI may be absent or unauthenticated while the other remains available for explicitly chosen work; never silently change harness/provider. Verify native permission-required/denied paths without disabling native policy. 3. **Use optional Ask questions without creating dependency.** In `src/questions.ts`, consume the documented optional [Ask protocol](../PX-PLAN-NY2PMQWM-ask-question-service/index.md) through local event messages only. Capability discovery/claim identifies whether delivery was accepted before choosing native Pi fallback. No provider, unclaimed service, unsupported request, and headless/no-UI receive distinct honest outcomes; provider loss after presentation must not cause silent duplicate fallback. First test with an independent protocol double, then with real Ask when delivered; do not import Ask runtime or types. Race competing requesters, active/queued cancellation, reload/provider loss, and late replies while both harness tasks run. This optional behavior can be verified without blocking Codex core delivery on the Ask plan. 4. **Use Hornets as an optional general review transport.** Exercise the [peer-review skill](../PX-PLAN-P4FMHCDS-peer-review-skill-delivery/index.md) against the same general Hornets task interface when that skill is available. Review policy stays in the skill; Hornets receives an ordinary assignment and returns ordinary task evidence. Confirm fresh-context author/reviewer diversity is explicitly selected and actual identity/unknowns reported; no hardcoded reviewer pool or auth-based preference. Retain PiPi-only review and Hornets operation without the skill; do not amend another feature's contract to make this integration pass. 5. **Ship and verify the two-harness extension.** Extend Hornets README/config/capability guidance and focused/native fixtures; add no extension-local changelog. Build and relocate once with Claude absent, once with Codex absent, once with both absent, and with Ask absent. Record independently authorized native tasks, MCP communication, question delivery, cancellation, and continuation for each adapter. Source/fixture assertions, native CLI use, actual UI inspection, and provider-reported metadata remain distinct evidence. Root `//:check`/`//:test`, Hornets affected tasks, relocation, and requested native acceptance are integration gates, not implicit root CI or browser E2E. ## Interfaces and independence `src/adapters/claude.ts` and `codex.ts` own harness-specific command/event/capability interpretation. `src/runtime.ts`, `bridge.ts`, `questions.ts`, and `render.ts` own Hornets-only task lifecycle and parent communication. The [Ask service plan](../PX-PLAN-NY2PMQWM-ask-question-service/index.md) and [review skill plan](../PX-PLAN-P4FMHCDS-peer-review-skill-delivery/index.md) are optional integration counterparts, not metadata dependencies. General primitives do not import one another's runtime, infer selected providers from environment keys, or mutate personal configuration. ## Exit criteria - [ ] Claude Code and Codex each perform native non-review work, parent communication, cancellation, and supported exact-session continuation. - [ ] Each adapter remains usable when the other CLI or optional extensions are absent; zero-CLI discovery still works. - [ ] Ask-present and Ask-absent questions preserve ownership, fallback boundaries, and honest terminal outcomes without duplicate presentation. - [ ] Peer review can optionally delegate through Hornets without adding review-specific runtime logic or requiring Hornets for PiPi-only review. - [ ] Both harnesses' unavailable/auth/permission/capability limitations and actual verification conditions are documented. - [ ] The relocated root distribution preserves sibling isolation, native harness configuration, and explicit preference.