← Back to Pull requests

fix(handover): keep the launch's warnings when a handover fails after its respawn #4224

Closed
unknown closed this pull request without merging on Nov 30, 2026 21:52 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 16:50 UTC
Author

The problem

When a seat handover can't read the seat's previous environment marker (#3915), it warns that dropped environment keys may remain. The respawn can also warn that a key couldn't be reconciled. A successful handover reports those warnings. A handover that failed after its respawn dropped them, in any of these cases:

  • the successor didn't start, or never became ready;

  • it started, and then the context delivery failed;

  • it started, and then the handover's finalization failed.
  • A failed handover is exactly where an operator looks. CodeRabbit found this in its review of #3915.

    What changes

  • The launcher: both failures after the respawn now carry the warnings already raised, as a successful handover does. Those failures are a pane that isn't a blank shell, and a successor that didn't start or become ready. The warnings are the launch preflight's, an unreadable environment marker's, and the respawn's own.

  • - It follows the path #3253's process-limit notice already takes.
  • The handover service passes them on:

  • - in its successor_create_failed result;
    - when the delivery fails after a successful launch, for either the fresh restore packet or the rebuild priming;
    - on every finalization failure after a successful launch, such as the successor's session being gone or a failed commit.
  • openrig-core's copy notes: a seat that loads openrig-core itself has OpenRig's earlier copies of its skills retired before its successor starts. The notes about that now go with each of these failures too, before the launch's own warnings, as a successful handover reports them.

  • Handover recovery shares that finalization path, so a recovery that fails there carries its own warnings too. It doesn't replay an earlier attempt's.

  • The CLI: rig seat handover prints them as Warning: lines beside the failure, and so does rig seat handover --recover when a recovery fails. With --json, they're in the result as warnings, with no Warning: lines.

  • Unchanged: nothing new refuses, and successful handovers report exactly as before.
  • How it was checked

  • Red first, at main: one case per layer, beside #3253's process-limit cases.

  • - The launcher's readiness failure after an unreadable marker.
    - The service's readiness and launch failures.
    - The CLI's plain output.
    - All four fail without the change.
  • The second commit (the later failures):

  • - Four service cases, each a successful launch with a respawn warning, followed by a failure:
    - the fresh packet's delivery;
    - the rebuild priming's delivery;
    - continuity (the successor's session gone);
    - the commit.
    - Red at the first commit: all four fail, each only on the missing warnings.
    - Two CLI cases for a delivery failure: the plain output prints the warning, and --json carries it in the result with no Warning: line. They pass before this change too, since the CLI already prints whatever warnings a failure carries. They pin that output.
  • The third commit (recovery):

  • - A CLI case: a failed --recover with one warning prints exactly one Warning: line, and with --json it parses to the unchanged result with no Warning: line. Red at the second commit: the plain output printed none.
    - A service case:
    - Setup: the failed handover's launch raises a warning. The recovery finds the successor's current conversation unread, and its commit fails.
    - Checks: the failure carries the recovery's own warning, and not the earlier attempt's.
    - When it fails: it passes at the second commit, which already carries the warnings. It fails with the second commit's service change set aside, only on the missing warning.
    - A type change: the recovery result's failure variant declares the optional warnings.
  • The fourth commit (copy notes), from CodeRabbit's review:

  • - Three cases, each a handover with a retired openrig-core copy that fails at one point: readiness, the fresh packet's delivery, or the rebuild priming's delivery.
    - Red at the third commit: all three carried only the launch's warning.
    - Green: each carries the copy note before it.
  • Green, at the head:

  • - daemon: 19 files (every test that names the handover service, the successor launcher or these failure codes), 616 passed, 3 skipped, 5 todo. The two skipped files are gated end-to-end tests.
    - CLI: 2 files, 164 passed;
    - both builds and npm run lint passed.
  • Not run: a real handover whose marker read failed. The native tmux test covers the environment itself.
  • 🤖 Generated with Claude Code

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

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

    Summary by CodeRabbit

    Bug Fixes
    Handover and recovery failures now retain relevant warnings from session launch and recovery steps.
    * In human-readable output, the CLI displays warnings alongside failure messages. JSON output includes warnings without separate warning lines.

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

    Diff: 643 lines (+482 / -161) across 8 files Reviewer: mvschwarz Review duration: 301m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 643 lines diff across 8 files
    0.52
    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.387
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4224"
    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: 51.9% (MEDIUM) · Higher = larger blast radius
    51.9%
    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: 20.5% · Safe to merge
    20.5%