-
Notifications
You must be signed in to change notification settings - Fork 0
Single-model co-evolution: --single-model flag, loud failure UX, codex-access skill #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alanshurafa
wants to merge
4
commits into
master
Choose a base branch
from
claude/single-model-test-strategies-i3uKx
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
36e00e6
feat(bouncer): add --single-model flag for same-agent runs
claude 196fb2d
feat(bouncer): flip --single-model default to bare two-role mode
claude 37a45c1
fix(bouncer): loud failure + actionable hint when partner agent unava…
claude 02c1220
feat(skills): add codex-access skill + lib/codex-access.sh helper
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,104 @@ | ||
| #!/usr/bin/env bash | ||
| # codex-access — single source of truth for invoking the Codex CLI across | ||
| # environments. Historically this logic was duplicated in 6+ places across | ||
| # the codebase; the lib/ helper centralizes the launch matrix so callers | ||
| # don't reimplement it. | ||
| # | ||
| # Launch matrix (checked in order): | ||
| # 1. WSL with Windows-side codex install: | ||
| # `cmd.exe /c codex exec ...` — bridges from WSL to the Windows binary | ||
| # because auth state is per-side (installing in both WSL AND Windows | ||
| # doubles the OPENAI billing). | ||
| # 2. Native Linux/macOS with codex on PATH: | ||
| # `codex exec ...` — direct invocation. | ||
| # 3. No codex reachable: | ||
| # `codex_available` returns 1; `codex_invoke` writes the install hint | ||
| # to stderr and produces empty output (matches the existing empty-output | ||
| # contract so callers don't need a new branch). | ||
| # | ||
| # See skills/codex-access/SKILL.md for the user-facing description. | ||
| # | ||
| # This module is intentionally side-effect free at source time — it only | ||
| # defines functions. Source it from any script that needs codex access. | ||
|
|
||
| # codex_available → exit 0 iff codex is reachable via any supported path. | ||
| # WSL+cmd.exe path is checked first because that's the upstream-recommended | ||
| # install on Windows (auth lives on the Windows side). | ||
| codex_available() { | ||
| if [[ -n "${WSL_DISTRO_NAME:-}" ]] \ | ||
| && command -v cmd.exe >/dev/null 2>&1 \ | ||
| && command -v wslpath >/dev/null 2>&1; then | ||
| cmd.exe /c codex --version >/dev/null 2>&1 && return 0 | ||
| fi | ||
| command -v codex >/dev/null 2>&1 | ||
| } | ||
|
|
||
| # codex_install_hint → prints a multi-line, actionable install/availability | ||
| # message to stdout. Callers redirect to stderr when used inside an error path. | ||
| codex_install_hint() { | ||
| cat <<'HINT' | ||
| codex CLI is not reachable from this environment. | ||
|
|
||
| To enable codex-backed runs: | ||
| 1. Install: npm install -g @openai/codex | ||
| 2. Authenticate: export OPENAI_API_KEY=sk-... | ||
| 3. Verify: codex --version | ||
|
|
||
| WSL users: install codex on the Windows side, NOT inside WSL. | ||
| codex-access bridges via cmd.exe automatically. Auth state is per-side, | ||
| so installing twice would double your OpenAI billing. | ||
|
|
||
| If codex is genuinely unavailable in this environment (e.g. a remote | ||
| container with no API key), use: | ||
| bash co-evolve-bouncer.sh --single-model claude ... | ||
|
|
||
| to run same-model co-evolution. This trades cross-vendor diversity for | ||
| the ability to actually run at all. | ||
| HINT | ||
| } | ||
|
|
||
| # codex_invoke "$prompt_file" "$output_file" "$stderr_file" | ||
| # Drop-in equivalent of lib/co-evolution.sh's invoke_codex, but routed through | ||
| # the launch matrix above so the WSL/native/missing cases all live in one | ||
| # place. Returns 0 always — errors flow through empty output_file + populated | ||
| # stderr_file, matching the existing invoke_* contract (callers detect failure | ||
| # by checking [[ ! -s "$output_file" ]]). | ||
| codex_invoke() { | ||
| local prompt_file="$1" | ||
| local output_file="$2" | ||
| local stderr_file="$3" | ||
| local workdir="${WORKDIR:-$PWD}" | ||
| local -a cmd | ||
| local windows_workdir="" | ||
| local windows_output="" | ||
|
|
||
| if [[ -n "${WSL_DISTRO_NAME:-}" ]] \ | ||
| && command -v cmd.exe >/dev/null 2>&1 \ | ||
| && command -v wslpath >/dev/null 2>&1; then | ||
| windows_workdir=$(wslpath -w "$workdir") | ||
| windows_output=$(wslpath -w "$output_file") | ||
| cmd=(cmd.exe /c codex exec --full-auto --skip-git-repo-check -C "$windows_workdir") | ||
| elif command -v codex >/dev/null 2>&1; then | ||
| cmd=(codex exec --full-auto --skip-git-repo-check -C "$workdir") | ||
| else | ||
| { | ||
| echo "ERROR: codex CLI not reachable in this environment." | ||
| echo "" | ||
| codex_install_hint | ||
| } > "$stderr_file" | ||
| : > "$output_file" | ||
| return 0 | ||
| fi | ||
|
|
||
| if [[ -n "${CODEX_MODEL:-}" ]]; then | ||
| cmd+=(-c "model=${CODEX_MODEL}") | ||
| fi | ||
|
|
||
| if [[ -n "$windows_output" ]]; then | ||
| cmd+=(-o "$windows_output") | ||
| else | ||
| cmd+=(-o "$output_file") | ||
| fi | ||
|
|
||
| "${cmd[@]}" < "$prompt_file" > /dev/null 2>"$stderr_file" || true | ||
| } |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When users follow the documented bare form, e.g.
--single-model "Stress test this argument", this branch treats the positional task as the optional agent name and then fails because it is notclaudeorcodex. Since the parser cannot distinguish a bare task from an optional positional agent, the advertised default-agent syntax is unusable unless the caller adds--, pipes input, or uses--single-model=claude; the bare flag should not consume the next non-flag argument.Useful? React with 👍 / 👎.