Repository navigation
fix(seat): restart in place accepts a Codex that OpenRig launched through its staged script - #1212
Conversation
…ough its staged script OPR.0.7.0.5. OpenRig types every Codex launch (fresh, fork, resume, and this restart's own relaunch) as `/bin/sh <tmpdir>/openrig-tmux-send-<pid>-<uuid>.txt`, so a managed Codex runs one sh below the pane's shell, and `rig seat restart --keep-conversation` refused it as pane_shape_unknown (the same chain on 0.6.10). The shell-backed shape now also accepts exactly that one link: an sh whose only argument is an absolute path with the name the tmux adapter gives its staged scripts (isStagedSendScriptPath). Any other process between the shell and Codex is still refused. The native harness gains a case that launches through the adapter's staging and restarts twice in the same pane (red on main). It also folds in #1196's fixture LOW: the direct-native case compares the stub with the reported replacement process and ties it to the respawned pane separately, so it holds where the image's sh doesn't exec a lone command. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
lbny22727-create
left a comment
There was a problem hiding this comment.
Approved in CodeRabbit Change Stack
…ns as bash #1212 round 1. P1-1 (dev60-review, measured on macOS): /bin/sh there is a shim that runs bash (or dash or zsh), so ps names the staged script's process bash and the new link never matched. The link now accepts the shells /bin/sh can run as (sh, bash, dash, zsh) for the process name, and keeps every argv check: exactly two arguments, argv[0] /bin/sh or sh, and the staged absolute path. A macOS-shaped fixture (bash, /bin/sh /var/folders/.../T/openrig-tmux-send-...) is accepted (red before this change); `/bin/bash <script>` and an extra argument stay refused. LOW: the staged script's name now comes from one prefix and suffix used by both the generator and the matcher, and a unit test passes the real defaultTmuxFileOps().tmpName() through the matcher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
openrig-review
left a comment
There was a problem hiding this comment.
Approved at df7ee77. rig seat restart --keep-conversation now accepts the pane shape OpenRig itself produces when it launches Codex: the pane's shell running /bin/sh with exactly one argument, the absolute path of OpenRig's staged launch script, with Codex below it. On macOS, /bin/sh reports as bash, dash or zsh. Main refused that shape with pane_shape_unknown for every OpenRig-launched Codex seat, including seats launched by 0.6.10 and the restart's own relaunch. The match is a disclosed name check, not proof of origin. Every other shape is still refused, and the bound-pane, resume-identity, settings and typing gates are unchanged. Required CI passed at this head.
— dev60-planner@v-openrig-build
What's wrong (on main since #1196, and in 0.6.10)
rig seat restart --keep-conversationrefuses an ordinary OpenRig-launched Codex seat withpane_shape_unknown.The Codex adapter types every launch through
tmux.sendShellCommandwithoutsourceInPaneorexecInScript, so the pane shell runs/bin/sh <tmpdir>/openrig-tmux-send-<pid>-<uuid>.txt. That covers fresh launch, fork, resume, restore resume, and this restart's own relaunch (sendResumeCommand). The pane is therefore shell → sh → Codex launcher → Codex.seat-restart-in-place.tsaccepts only Codex as the pane root, or Codex directly under the pane's shell. So it refuses every managed Codex seat, including any seat it has already restarted once. The refusal is safe (nothing is stopped), but the command can't run on the seats it is for.The correction
shwhose only argument is an absolute path carrying the name the tmux adapter gives its staged scripts.isStagedSendScriptPath, which sits next to the name generator inadapters/tmux.ts.sh -c …, a relative path, a different script name, or more than one link.shell_backed. Stop, relaunch and reporting are unchanged: the shell-backed path already waits for the pane's shell to come back, and the staged script exits when Codex does.The change is self-contained (4 files, +90/−10) and applies cleanly on cb79b8c and on current main.
Proof (hermetic; ovh08 is under Fleet's real-home hold)
seat-restart-in-place.test.ts): the staged script is accepted for plan and execute, and Codex is signalled. Five near-misses are refused with no keys or signals sent:sh -c;shwrapper;seat-restart-in-place-native.test.ts): a new case uses a real private tmux server and the stub Codex.pane_shape_unknownand passes with the fix.rig seat restart --keep-conversation) #1196 fixture LOW folded in: the direct-native case now compares the stub with the reported replacement process, and separately ties that process to the respawned pane (its root or the root's direct child). It now holds where the image'sshdoesn't exec a lone command (review-r2's dash).~/.codexcorrection; CI runs it.Round 1 (df7ee77)
/bin/shis a shim that runs bash (or dash or zsh), sopsnames the staged script's processbash, and the link never matched there./bin/shcan run as (sh,bash,dash,zsh) as the process name./bin/shorsh, and the staged absolute path.bash,/bin/sh /var/folders/…/T/openrig-tmux-send-…txt) is accepted. It was red before this change./bin/bash <script>and an extra argument stay refused.defaultTmuxFileOps().tmpName()throughisStagedSendScriptPath.Refs OPR.0.7.0.5, #1196.
🤖 Generated with Claude Code
Summary by CodeRabbit