← Back to Pull requests

fix: recover the Codex chat wake after a server restart #4155

Closed
unknown closed this pull request without merging on Nov 29, 2026 23:26 UTC
View on GitHub
unknown unknown commented on Nov 29, 2026 11:17 UTC
Author

A person's Codex chat could lose automatic delivery of the OpenRig team's questions after an app-server restart. On resume, the plugin replaces an ended watcher or one tied to a different or unidentified server, keeping task IDs already shown.

The launcher reserves ownership before spawn. Confirmation writes only that attempt's own marker; failure logs without rolling back shared ownership. A pending publication cannot retire a confirmed helper, including when the publisher used a stale fallback snapshot. A confirmed current replacement retires earlier helpers. Callbacks never overwrite the shared owner or legacy watcher record. Children write only their own heartbeats; watchers recheck ownership before each queued batch, and submitted batches remain marked shown. Immediately before claiming the missing-rig notice, a watcher also rechecks ownership and SessionEnd, so takeover or session end during process lookup leaves the notice for a live helper. An already-submitted notice may still finish.

Unknown outcomes and failed storage can leave overlapping helpers until a confirmed current replacement arrives or their own stop condition. Pre-fix helpers can overlap through an upgrade. The read/queue/markShown window can still submit a task twice; this is not exactly-once delivery. Keeping a predecessor helps only while its recorded Codex remains alive; spawn failures are recorded in the conversation log.

Validation: 101 tests in five complete hook suites, five Codex package tests, syntax and repository guards pass; packaged bridge matches the canonical file. On the previous head, the original interleaving controls fail three assertions and overlapping-error tests fail both orders. The final controls use one watcher invocation across pre-error and post-error polls, assert both errors were emitted, and verify every injected newer launch actually ran. A late-reservation control fails the first candidate and passes the final code. The final lookup-window controls fail on 550a0967 and pass with the recheck: the old helper neither queues nor claims after a confirmed replacement or SessionEnd, and the live helper can still claim the notice. Tests use fixture process facts and recording CLIs; no live managed Codex update, model invocation or human delivery is claimed.

Cost: one small confirmation file per successful attempt, under existing conversation retention; no new setting, process, registry or lock. The final correction changes three files including the packaged mirror.

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

Summary by CodeRabbit

Bug Fixes
Resuming a chat after a Codex server restart now restores its wake when the OpenRig plugin is enabled, while retaining tasks already shown.
Watchers are replaced when their associated Codex process has ended or changed. Superseded watchers stop without triggering queue activity, and ownership publication issues no longer stop a watcher before a new owner is published.
Watchers keep checking for a rig after startup, so they can respond if one becomes available later.
Documentation
Added guidance on chat resumption after a server restart and on how hook configuration is read.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Diff: 417 lines (+312 / -105) across 5 files Reviewer: mvschwarz Review duration: 729m
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 417 lines diff across 5 files
0.45
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.361
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4155"
general weight: 0.35
Reviewers
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: 45.0% (MEDIUM) · Higher = larger blast radius
45.0%
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: 17.8% · Safe to merge
17.8%