Skip to content

feat(run): basou run codex launcher with pre-spawn orientation channel#150

Merged
takashi-matsuyama merged 1 commit into
mainfrom
feat/codex-run-launcher
Jun 30, 2026
Merged

feat(run): basou run codex launcher with pre-spawn orientation channel#150
takashi-matsuyama merged 1 commit into
mainfrom
feat/codex-run-launcher

Conversation

@takashi-matsuyama

Copy link
Copy Markdown
Member

Stacked on #149 (feat/codex-context-channel). Review/merge #149 first; this PR's diff is PR2-only and its base auto-retargets to main once #149 lands.

What

basou run codex — wrap the Codex CLI as a Basou-tracked session, the twin of basou run claude-code. This is the CLI grip half of the Codex adapter: it gives Codex the cwd-correct orientation delivery and PATH integration that basou refresh's static channel (#149) can't guarantee on its own.

Two grips beyond plain session tracking:

  • PATH grip — injects -c shell_environment_policy.inherit=all so Codex's own tool calls can reach basou on PATH (the basou: command not found fix).
  • cwd-correct orientation — just before spawn, re-renders THIS workspace's orientation into the Codex context face (~/.codex/AGENTS.md) so the about-to-start interactive Codex auto-loads the current position even when the global channel last reflected a different workspace. Best-effort (a failure never blocks the launch); surfaces the last-refreshed orientation without re-importing.

How

  • Generalizes runClaudeCode's lifecycle into a shared runTrackedTool(args, options, ctx, adapter) parametrized by per-tool seams (command resolver, source metadata, arg transform, pre-spawn hook); runClaudeCode / runCodex are thin wrappers, and the run-group subcommand dispatch + options are shared (addRunOptions / dispatch). Claude-code run behavior is preserved byte-for-byte (its run tests are unchanged and pass).
  • Adds the codex-adapter session-source kind to SessionSourceKindSchema (regenerated published JSON Schema) — distinct from the after-the-fact codex-import.
  • Adds codexAdapterMetadata / resolveCodexCommand to the core codex adapter; the which-based isOnPath primitive is shared with the claude-code adapter via a new adapters/command-lookup module.
  • The pre-spawn channel render reuses renderOrientationToCodexChannel, shared with basou refresh. A RunContext.codexChannelPath seam keeps the suite off the real home-global file.

Verification

  • core (1261) + cli (924) test suites pass; biome check, lint:lang, and build are green.
  • Adversarial review (two independent review-only agents): no correctness defects; the reuse cleanups (shared channel-push helper, shared isOnPath, shared run-options, dropped internal export) are applied; nothing blocked as spec-deviation / design-reversal.

🤖 Generated with Claude Code

@takashi-matsuyama takashi-matsuyama force-pushed the feat/codex-context-channel branch from 6da0dd0 to 7a3c37a Compare June 30, 2026 15:29
@takashi-matsuyama takashi-matsuyama force-pushed the feat/codex-run-launcher branch from f8ab46b to dbe6872 Compare June 30, 2026 15:29
Wrap the Codex CLI as a Basou-tracked session, the twin of `basou run
claude-code`. Two grips beyond plain tracking: inject `-c
shell_environment_policy.inherit=all` so Codex tool calls can reach `basou` on
PATH, and re-render THIS workspace's orientation into ~/.codex/AGENTS.md just
before spawn so the interactive Codex auto-loads the current position (correcting
the global channel's last-refreshed-workspace semantics). The pre-spawn render is
best-effort and surfaces the last-refreshed orientation without re-importing.

Generalizes runClaudeCode's lifecycle into a shared runTrackedTool(args, options,
ctx, adapter) parametrized by per-tool seams (command resolver, source metadata,
arg transform, pre-spawn hook); runClaudeCode / runCodex are thin wrappers, and
the run-group subcommand dispatch is shared. Adds the codex-adapter session-source
kind (regenerated published JSON Schema) plus codexAdapterMetadata /
resolveCodexCommand in core. Claude-code run tests are unchanged and pass; a
RunContext.codexChannelPath seam keeps the suite off the real home-global file.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@takashi-matsuyama takashi-matsuyama force-pushed the feat/codex-run-launcher branch from dbe6872 to 4390644 Compare June 30, 2026 15:54
@takashi-matsuyama takashi-matsuyama changed the base branch from feat/codex-context-channel to main June 30, 2026 15:54
@takashi-matsuyama takashi-matsuyama merged commit fd4bff6 into main Jun 30, 2026
7 checks passed
@takashi-matsuyama takashi-matsuyama deleted the feat/codex-run-launcher branch June 30, 2026 15:58
takashi-matsuyama added a commit that referenced this pull request Jun 30, 2026
Bump packages/{basou,core,cli,sdk} to 0.30.0 and finalize the CHANGELOG
section. Bundles two already-merged themes:

- Codex adapter (#149/#150): the Codex context channel (basou refresh
  renders orientation into ~/.codex/AGENTS.md) and the basou run codex
  launcher (pre-spawn re-render + shell_environment_policy.inherit=all +
  codex-adapter source kind).
- Y-18 review enforcement (#146/#147/#148): basou review record, the
  review-gate verdict in evaluateStopHook, and the opt-in
  hook stop --require-review gate.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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