fix(lanes): harden codex lanes — zsh-safe timeout, scratch dir, sandbox and IPC handling - #24
raymond-w-ko wants to merge 1 commit into
Conversation
…ox and IPC handling Consolidates onto v5 the still-valid fixes proposed against v4 in upstream PRs DannyMac180#5, DannyMac180#9, DannyMac180#12, DannyMac180#14, DannyMac180#15, DannyMac180#17 and issues DannyMac180#13, DannyMac180#23, which no longer apply cleanly after the v5 rewrite. - Replace the `${T:+$T 600}` timeout prefix with a positional-parameter wrapper that works under bash, zsh and sh, validated as GNU coreutils, capped at 540 s inside the Bash tool's default 600000 ms ceiling (DannyMac180#12, DannyMac180#13, DannyMac180#17, DannyMac180#4). - Capture the exit status and stderr; classify 124/137 as timeout, other non-zero as the new `execution-error` status, and the code-mode IPC mismatch signature as `unavailable` with diagnostics and no retry (DannyMac180#17, DannyMac180#23). - One private scratch dir per lane via `mktemp -d`; forbid globbing or sidecar files to recover it; forbid backgrounding codex and ending the turn (DannyMac180#14). - Sol only: a bounded detached path for runs longer than the tool ceiling, with pid capture, foreground polling and a deadline kill. - Sandbox preconditions (network, docker, worktree commit), the `.git`-writable escape warning, and the sandbox-denial handling with the explicit `sandbox-fallback: allowed` opt-in (DannyMac180#15, DannyMac180#5). - Escalation trigger says "twice" consistently; lane tools trimmed to `Bash, Read` (DannyMac180#9). Co-authored-by: ericlitman <ericlitman@users.noreply.github.com> Co-authored-by: wooter <wooter@users.noreply.github.com> Co-authored-by: pandaofwild <pandaofwild@users.noreply.github.com> Co-authored-by: xiaolai <xiaolai@users.noreply.github.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Author of #4 here. #24 is a clear improvement on v5 1. The timeout prefix caps the shim, not the run, on WindowsThis PR takes the That matters more after this PR, not less. On Git Bash, So the new What works is branching the capper by platform and tree-killing: 2. The sandbox fallback adopted from #5 does not recover WindowsMeasured today on Windows 11 / Git Bash against codex-cli 0.154.0 (npm latest), with 0.144.6 as a control. Trivial spec: create one file containing one word.
The effect on this PR as written: a Windows operator hits the read-only signature, gets The approach that holds up here is Both points are in #4 against v4 if that patch is useful as a reference, though it needs a rebase onto v5 regardless. |
|
Closing: I am carrying these changes on my fork instead of proposing them upstream. Sorry for the noise. |
…e the Astra lane This checkout is a personal fork of DannyMac180/fable-advisor and is no longer proposing changes upstream (upstream PR DannyMac180#24 was closed). The README still read as the upstream project: its install commands registered the upstream marketplace, so a reader of this fork would install a plugin without the fork's lanes, and nothing in the prose mentioned the new browser lane. README.md: - Tagline now includes Astra driving the browser. - Fork banner under the tagline naming upstream and origin, summarising what the fork carries (the v5.1 lane hardening and the `astra-operator` lane with the `computer-use` skill), and saying to install from origin. - Install block registers `raymond-w-ko/fable-advisor`, with a note to remove an existing upstream marketplace entry of the same name first so the install resolves to the fork. - New "What's in v5.1 (this fork)?" paragraph ahead of the upgrade notes, describing the Astra lane, the skill, and the `playwright_chrome` prerequisite in `~/.codex/config.toml`. .claude-plugin/plugin.json and .claude-plugin/marketplace.json: each description gains a sentence about the astra-operator lane and the computer-use skill so the plugin listing reflects what it ships. Owner and author fields are left as upstream's; the fork does not claim the project. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Correction to my point 1. I was wrong, and I should have measured before posting it. I re-tested the timeout wrapper on codex-cli 0.154.0 (Git Bash,
So GNU Point 2 (sandbox) stands as measured: |
Summary
Consolidates onto v5.0.0 the fixes that contributors proposed against v4 in #5, #9, #12, #14, #15, #17 and issues #13, #23. All of those still describe real defects on
main, but the v5 rewrite (fable-implementer→sol-implementer, per-task effort, duplicated lane files) means none of the original hunks apply. This PR re-implements the portable parts in both lane files plus the orchestration skill, so the individual PRs can be closed in favour of it. Credit to @ericlitman, @wooter, @pandaofwild, @xiaolai, @sherySJ, @nerdstalker and @tr3lane for the diagnoses; co-author trailers are on the commit.Changes
Timeout wrapper (#12, #13, #17, with the Windows
timeout.exenote from #4).${T:+$T 600}is a single argv word under zsh, so the lane died with exit 127 before codex started and the documented cap never applied. Replaced with aset -- "$T" -k 15 540/"$@"prefix that works under bash, zsh and sh, validated as GNU coreutils (--version | grep -qi coreutils), and kept strictly inside the Bash tool's default 600000 ms ceiling so the shell timeout, not the tool, kills codex.Exit classification and IPC mismatch (#17, #23).
RC=$?is captured and stderr goes to a per-lane file. 124/137 →timeout; other non-zero → newexecution-errorstatus with the exact error, never inferred as auth; thecode-mode host/IPC frame/code_mode_host_duration_nssignature with exit 0 →unavailablewith path/version diagnostics and an explicit no-retry rule. SKILL.md tells the architect that theseunavailablecases are host problems and that re-routing Luna ↔ Sol will fail identically.Scratch dir and no backgrounding (#14).
mktemp -d "${TMPDIR:-/tmp}/codex-lane.XXXXXX"replaces the twomktemp -tcalls whose literalXXXXXXsurvives on BSD and let parallel lanes pick up each other's spec. The doc now forbids recovering the path by glob or sidecar file, and forbids launching codex in the background and ending the turn.Sol long runs. Sol's 1800 s foreground cap was never enforceable under the tool ceiling. Sol now caps foreground at 540 s like Luna and gets one bounded detached path for
max/ultra: subshell writes$LANE/rc, pid captured, 1740 s cap, foreground polling in 550 s loops, deadline kill viapkill -f "$LANE". The lane still never ends its turn with codex running.Sandbox (#15, #5). Precondition table (no network, no docker socket, no commits from a linked worktree), the tested
.git-writable hook escape warning, and the write-denial handling:unavailableby default, one retry without--sandboxonly when the spec carriessandbox-fallback: allowed, always disclosed via aSANDBOX:report line.Consistency (#9). Lane table now says the routine lane escalates after failing twice, matching the deciding rule and
fable-advisor.md. Lanetools:trimmed toBash, Read.Verification
claude plugin validate .passes.bashandsh(zsh not installed here): cap fires withexit=124; with no GNU timeout the WARN line prints and the command runs uncapped. The zsh branch was verified by the reporter and a second commenter on codex-implementer: timeout guard is a no-op under zsh (exit 127 before codex runs) #13.diff agents/codex-implementer.md agents/sol-implementer.mdshows only the intended differences (slug, effort table, caps, the Sol detached subsection, Sol-specific report lines).Related upstream items
This PR supersedes #12, #14, #15, #17 and the codex half of #4, and fixes #13 and #23 (portable parts). #5 and #9 are folded in. Not included: the
<example>blocks from #10 (still open, applies to all three agents), the cursor lane from #7, and the Smithers pack from #6.🤖 Generated with Claude Code