← Back to Pull requests

fix(network): send a stage note only while it's still true, so a late result costs three hub calls instead of five #4206

Closed
unknown closed this pull request without merging on Nov 30, 2026 13:13 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 06:05 UTC
Author

What a person sees

rig network is experimental and unsupported. When a connected seat held a backlog, work it had finished could read "in
progress" on the hub for many minutes.

Why: a result reported late cost up to five hub calls:

  • a "Queued for the connected local seat. Not picked up yet." note;

  • a "Picked up by the local seat at …" note;

  • then the read, close and read that settle the result.
  • Under a backlog, the two notes reached the hub minutes late, together with the result, and the first was no longer true.

    Now: a stage note goes out only while it's still true.

  • An item the seat picked up before its queued note went out gets the pickup note alone.

  • One that finished before its notes went out gets only its result: three hub calls instead of five.

  • A stage passed this way counts as reported, so its note never goes out later.
  • The pass's order stays as it was:

  • A hub's stall findings are answered as they're taken, within intake's half of the deadline.

  • Results are reported until three quarters of it.

  • Then the answers to the seat's own requests are read.
  • Each stage keeps its window in every pass. An earlier revision of this PR answered findings after results. That only
    moved the pass's time from one stage to another, so it's out.

    No wire change: the same hub tools with the same arguments, minus the stale notes. A member running an earlier
    version behaves as before.

    Evidence

  • Not yet shown on a real run: a sealed run with a 0.7.26 hub and a member on this change found no regression (every result settled, and a run with both on this change met fully), but its method couldn't measure whether lag or false stall findings drop. So this PR claims the mechanism (fewer stale notes, fewer hub calls per late result), not a measured reduction.

  • A recorded run, with an older hub and a newer member: drain passes that answered 150 to 187 findings settled 46 to

  • 63 results. The drain with no findings settled 197.
  • A model of one drain pass, at a tenth of that scale: every hub call waits 5 ms, a pass has 6 s, and it uses the

  • connector's own tests' hub. Two runs of each:

    | | Results settled, no findings | Results settled, 150 findings | Findings answered |
    |---|---|---|---|
    | before | 112, 121 | 54, 51 | 130, 118 |
    | this change | 184, 136 | 79, 79 | 125, 118 |

    - With findings, about 50% more results settle, and findings answered don't change.
    - The noise between identical runs on a shared test box is large: 136 to 184 for the same code.
    - It's a model, not a run between two machines.

    Tests

  • packages/daemon/test/network-connector.test.ts, two new cases, both failing on main:

  • - an item that finished before its stage notes went out gets its result alone, and nothing more later;
    - an item picked up before its queued note went out gets the pickup note, never "Not picked up yet".
  • One existing case updated: after a reconnect, an item that finished before it gets its result without a late

  • pickup note (pickupsSent 1, was 2). It fails on main.
  • The recorded-hub contract (packages/cli/test/fixtures/network-hub/inbound-loop.json): pass 2 is an item the seat

  • picked up and closed before the pass. It drops the one pickup-note exchange this no longer sends, and its description
    says why. On main, the connector sends that note and the contract fails, since no recorded exchange matches it.
  • Ran locally, with Node 22:
  • | Suite | Result |
    |---|---|
    | Daemon network- and queue-stuck-sweep files | 24 files, 752/752 |
    | CLI network-connector-hub, network-connector-contract, network-command, mcp-http-grant-service-network | 52/52 |
    | Daemon and CLI tsc --noEmit | exit 0 |
    | Docs guard | exit 0 |

    Not run here

  • A run between two machines. The model above isn't one.

  • How many findings an older hub files once results settle sooner. It should file fewer, since a settled item stops

  • counting as stalled, but that isn't measured here.

    🤖 Generated with Claude Code

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

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

    Summary by CodeRabbit

    Bug Fixes
    Stage updates reflect an item’s current state: completed items receive a result without stale queued or pickup notes, while picked-up items receive a pickup note without a stale queued note.
    Documentation
    Clarified that stage notes are sent only while the corresponding stage remains current.

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

    Diff: 577 lines (+432 / -145) across 7 files Reviewer: openrig-review Review duration: 427m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 577 lines diff across 7 files
    0.50
    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.380
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4206"
    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: 49.8% (MEDIUM) · Higher = larger blast radius
    49.8%
    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: 19.7% · Safe to merge
    19.7%