Skip to content

feat: support codex as a worker runner - #1

Merged
vu1n merged 2 commits into
mainfrom
feat/codex-runner
Jun 9, 2026
Merged

vu1n merged 2 commits into
mainfrom
feat/codex-runner

Conversation

@vu1n

@vu1n vu1n commented Jun 9, 2026

Copy link
Copy Markdown
Owner

What

Adds first-class codex support as a bacchus worker runner, alongside the existing Claude default.

The worker engine was already runner-agnostic (worker.cmd is run via sh -c with env-var substitution), but codex couldn't actually follow the protocol: /bacchus-worker is a Claude slash command, and there was no way to feed the protocol to a CLI that takes a prompt string. This wires codex in via codex exec (the headless analog of claude -p).

Changes

  • worker.runner config (claude | codex) selects the default worker.cmd; an explicit cmd still overrides. Derivation is gated on runner being explicitly set, so an unconfigured worker still errors ("worker.cmd is not configured") rather than silently defaulting to claude.
  • bacchus worker-prompt <AGENT_ID> [TASK_ID] emits the worker protocol as plain text for codex exec (Claude resolves the slash command; codex takes a prompt string).
  • bacchus init --runner <claude|codex> writes the matching worker.cmd. The Runner clap enum rejects invalid values at parse time (error: invalid value 'x' … [possible values: claude, codex]).
  • Bundle tighten + ship-review under skills/ — the review loop depends on them; already installed as Claude and Codex skills globally.

Why it works

Liveness is bacchus-owned (the session heartbeat-loop background process tied to the worker PID), not the Claude PostToolUse hook — so codex workers stay alive identically. Transport is codex exec (one-shot per task), not codex app-server, matching bacchus's spawn-per-task / judge-by-PID model.

Review notes

This branch was run through /tighten and /ship-review:

  • Structure: added the Runner enum so --runner is a closed set (was a free string with a silent _ => claude fallback).
  • Correctness: the runner-derived-cmd fallback is gated on runner being set (above), preserving the original unconfigured-worker error. Covered by new resolve_worker_config tests.
  • Security: no new attack surface — command construction reaches sh -c with operator/system-controlled IDs (pre-existing pattern); --dangerously-bypass-approvals-and-sandbox mirrors the existing claude --dangerously-skip-permissions intended-autonomy posture.

Testing

  • 171 tests pass (cargo test -- --test-threads=1), incl. codex config round-trip + the three new gating tests.
  • cargo clippy -- -D warnings clean, cargo fmt applied.

Not covered (needs a human)

codex exec's flag/positional syntax (--dangerously-bypass-approvals-and-sandbox, prompt as positional) is an external contract this change can't test — verify against the installed Codex CLI on a real worker run before relying on codex workers in production.

vu1n added 2 commits June 9, 2026 11:16
…ghten + /ship-review

Phase 1 of the kypp/pillbox roadmap: opt-in, agent-driven, fail-open shared
memory for parallel workers.

- Add `memory` config section (enabled, project); resolve_memory_env scopes
  KYPP_PROJECT/KYPP_REPO_ROOT/BACCHUS_MEMORY onto the worker process
- Worker prompt: kypp briefing at start, recall before work, remember before
  release — all guarded on $BACCHUS_MEMORY and fail-open
- Replace /simplify with /tighten (per-iteration) + /ship-review (final gate)
  in the worker review loop, CLAUDE.md, and eval rubric/scenarios
- Fix two pre-existing clippy lints (collapsible_if, unnecessary_sort_by)
The worker engine was already runner-agnostic (worker.cmd run via sh -c),
but codex couldn't follow the protocol: /bacchus-worker is a Claude slash
command, and there was no way to feed the protocol to a CLI that takes a
prompt string. Add first-class codex support via `codex exec`.

- `worker.runner` config (claude|codex) selects the default worker.cmd;
  `cmd` still overrides. Derivation is gated on `runner` being explicitly
  set, so an unconfigured worker still errors rather than silently
  defaulting to claude.
- `bacchus worker-prompt <AGENT_ID> [TASK_ID]` emits the worker protocol
  as plain text for `codex exec` (Claude resolves the slash command).
- `bacchus init --runner <claude|codex>` writes the matching cmd; the
  Runner clap enum rejects invalid values at parse time.
- Bundle tighten + ship-review under skills/ (the review loop depends on
  them; already present as Claude and Codex skills globally).

Liveness stays bacchus-owned (heartbeat loop), not a Claude hook, so
codex workers stay alive identically.
@vu1n
vu1n merged commit 5181319 into main Jun 9, 2026
1 check passed
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.

1 participant