← Back to Pull requests

fix(codex): an in-place restart's relaunch puts the running --add-dirs after the conversation id #2037

Closed
unknown closed this pull request without merging on Oct 25, 2026 17:23 UTC
View on GitHub
unknown unknown commented on Oct 25, 2026 16:45 UTC
Author

What a person gets

rig seat restart <codex-seat> --keep-conversation reads complete when the same conversation resumed, and the seat can be messaged
afterwards. This holds when a directory Codex was given has a space in its path, such as a working directory named my repo.

Until now, in that case:

  • the restart reported incomplete ("no single Codex process resuming this conversation was observed");

  • reconcile read continuity unverified;

  • an ordinary rig send was refused ("reports sh as the foreground command, but OpenRig could not verify its expected codex agent").
  • The same conversation was running the whole time.

    The cause

    The relaunch reuses the running Codex's own --add-dirs, git dirs included. They were placed between resume and the conversation
    id:

    codex … resume --add-dir /…/state --add-dir '/home/me/my repo/.git' <id>
    

    OpenRig identifies a Codex by its process line, which joins argv with spaces (both /proc and ps). Read back, that line names
    repo/.git where the id belongs. So:

  • the restart's proof: found no Codex resuming the id;

  • reconcile: read continuity unverified;

  • the send check: with a shell in the pane's foreground, it saw a Codex naming another conversation and refused.
  • Every other resume already puts these dirs after the id, so the id reads correctly even from a cwd with a space.

    A shell or node wrapper isn't involved. The proof follows the chain from the native Codex through node and sh to the pane.

    The change

    packages/daemon/src/adapters/codex-runtime-adapter.ts: for an in-place restart, the running Codex's --add-dirs follow the
    conversation id, as on every other resume:

    codex … resume <id> --add-dir /…/state --add-dir '/home/me/my repo/.git'
    

    They're still the running Codex's own dirs, unchanged, and none are resolved again. Nothing else changes.

    One thing a person may need to know: a Codex already relaunched with the old order still reads as another conversation, so a
    send to it is refused and another in-place restart of it is too. A fresh launch or a restore of that seat brings it back in the
    right order.

    Proof

    All runs are in a Linux container: Node 22, tmux 3.3a, git, as root, with --maxWorkers=2 (batch rw3).

  • At the tests-only commit b0d336fd (on main 5e0db11b), the new test fails: 1 of 23 in codex-git-add-dirs. The restart's

  • relaunch put the dirs before the id, and its proof read repo/.git as the conversation.
  • *On codex-git-add-dirs, seat-restart-in-place, codex-runtime-adapter, native-process-lineage, restore-orchestrator,

  • session-transport, codex-resume and reconcile:
    - main 5e0db11b passes 1518 of 1518;
    - fa462d4e passes 1519 of 1519;
    - test:repo passes 325 of 325.
  • The native restart test (private tmux, compiled stub codex) restarts in place with the new order and keeps the pane, the

  • shell and the running choices.
    - Its stub printed its last argument as the conversation, which held only while the id came last. It now reads the id after
    resume, as Codex does (fa462d4e, test only).
    - Before that stub change, the restart itself already succeeded there, but the stub's screen line didn't match.
  • Not run here:* a real Codex restarted in place. Quality planned a native A/B on the cell where this was found. That cell's

  • current Codex was relaunched with the old order, so it needs a fresh launch or restore first.

    🤖 Generated with Claude Code

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Bug Fixes
    In-place Codex restarts now preserve the repository path and additional directories, including paths containing spaces.
    Restart and message handling more reliably recognize the resumed conversation, helping ensure the correct session continues.

    Tests
    Added coverage for restarts with paths containing spaces and for recognizing resumed conversations in restart and message flows.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 519 lines (+389 / -130) across 6 files Reviewer: openrig-review Review duration: 37m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 519 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.374
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2037"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.7% (MEDIUM) · Higher = larger blast radius
    47.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.9% · Safe to merge
    18.9%