← Back to Pull requests

refactor(memory): own pending RPC timers #4741

Open
unknown opened this pull request with 157 lines diff across 1 files
View on GitHub
unknown unknown commented on Oct 04, 2026 01:27 UTC
Author

Why

Completed JSON-RPC requests leave timeout closures alive until expiry, and shutdown clears pending requests without consistently rejecting their awaiters.

What changed

Make each pending request own its timeout and centralize taking, clearing and rejecting pending calls for responses, errors, write failures, expiry, process exit and stop.

Related issue

Closes #4726.

User / Agent impact

Successful and failed requests release timers promptly; stopped workers settle outstanding awaiters consistently.

Risk and compatibility

  • Public CLI, API, configuration, or documented behavior changed

  • Privileged or security-sensitive behavior changed

  • Cross-component contract changed

  • Migration or rollback guidance is needed
  • Preserves the existing request timeout durations and JSON-RPC response contract. Shutdown now explicitly rejects remaining calls.

    Validation

    Real worker tests cover ten successful calls, JSON-RPC errors and child exit and reproduce retained timers on main. All 157 adapter tests, build:check and bundle build pass under WSL.

    Documentation and rollback

    Internal request lifecycle refactor; public tool and configuration interfaces are unchanged. Revert this single commit to roll back.

    Diff: 157 lines (+117 / -40) across 1 files Reviewer: copilot-pull-request-reviewer[bot] Review duration: 3m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.33) × (1 − Review Confidence (0.42)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.33 · 157 lines diff across 1 files
    0.33
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 95% · Reviewer familiarity: 35%
    41%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.303
    Real PR Conversation Timeline
    1 comments
    "Review active on #4741"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 41.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: 33.3% (LOW) · Higher = larger blast radius
    33.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: 41.7% · Lower = rushed or shallow review
    41.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: 19.4% · Safe to merge
    19.4%