← Back to Pull requests

Prevent duplicate Lark worker returns after an upgrade #9330

Open
unknown opened this pull request with 443 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 23, 2026 15:45 UTC
Author

Goal and delivered outcome

Recover a worker result in its original conversation after upgrading from a sender which could exit between the provider accepting a message and saving its ID. The old queue and transcript look identical when the sender exits just before posting. Replaying the first history can send a second copy. The candidate preserves the original conclusion and reports the ambiguous delivery as unconfirmed.

Related to #9318. Base branch main.

Author declaration

  • Written by: model_agent, OpenAI Codex (GPT-6).

  • Implemented against docs/reference/local-delegation.md (interrupted result return) and docs/architecture/rfcs/app-conversation-and-async-inbox-v0.md (a started write without a provider locator stays unconfirmed after restart), at fd985b1ac9.
  • Implementation and scope

    The original transcript row records the provider on first insertion for a checkpoint-aware sender. Returning an existing row preserves its historical metadata. The TypeScript delivery owner checks the original dispatch information and persists the verification checkpoint under its existing revision and grant checks. With multiple transports configured, the stored binding selects the protocol. Sending still verifies the live audience. The Lark adapter consults that result immediately before posting. The provider marker by itself grants no authority and proves no delivery.

    An untouched result can still be sent once. A saved provider message ID is verified through its original route. A legacy transcript without dispatch evidence can represent a genuine preflight interruption. Its original result remains readable and its external delivery remains unconfirmed, including when the actual number of posts is zero.

    Validation

  • Tested revision: b280ef5c515c2039b37ac9ac881e19d4f32d4a34

  • Input classes: synthetic, public_fixture

  • Run state: finished
  • | Check | Result | Evidence and scope |
    | --- | --- | --- |
    | Static | Passed | Control-plane TypeScript type check. |
    | Unit/integration | Passed | All 65 TypeScript manager return transaction and steward topic tests. |
    | Real entrypoint / recovery | Passed | With the same older sender and identical restart harness, the base delivered two copies when the provider accepted before the ID was saved. The installed candidate retained one copy. With a saved ID both delivered exactly one. An untouched result reached the provider once. A legacy preflight interruption stayed unconfirmed with zero posts on the candidate. All four candidate cases passed. |
    | Python integration | Passed | 412 affected tests and 12 transport-composition tests. These include interrupted/revoked sends, storage restart, topic routing, and transient provider observation with multiple transports configured. The fresh result delivered once when observation recovered. |
    | Premerge | Passed | All 10 diff-selected canaries passed, including the full vocabulary scan. The earlier head hit the scan timeout. |
    | Regression sensitivity | Confirmed | The same cross-version oracle failed in both ambiguous cases on the target base and passed on the candidate. One candidate characterization initially encountered a reused test temporary directory before recovery could run. Repeating all four cases with a fresh directory passed with identical assertions. |

    Existing delivery status and transcript surfaces display the outcome. UI impact: none. No production Lark account or message was used. Rollout and installed-service adoption require a merged build. Every commit has DCO sign-off.

    Diff: 443 lines (+332 / -111) across 5 files Reviewer: BigDataDZ Review duration: 10831m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.50) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 443 lines diff across 5 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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.365
    Shallow Review Depth shallow_review_depth
    0.344
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #9330"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 50.3% (MEDIUM) · Higher = larger blast radius
    50.3%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 26.8% · Safe to merge
    26.8%