refactor(memory): own pending RPC timers #4741
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 95% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
copilot-pull-request-reviewer[bot]
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
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.