fix(tasks): release blocked tasks/result on disconnect and shutdown #283
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 191 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · 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
Diff Size
diff_size
0.315
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #283"
general
weight: 0.35
rozzilla
The legacy blocking
tasks/result(handleTasksResult/awaitTaskTerminal) had three lifecycle problems, all reproduced in the newtest/tasks-result-lifecycle.test.ts:1. Disconnects went unnoticed. The listener was on
request.rawclose, which fires once the body is read, before the handler runs. It now listens onreply.rawcloseand aborts at once if the response or socket is already destroyed. Test: a reallisten,req.destroy()300ms in;taskStore.getmust not be called again.2. Waiters leaked.
controller.abort()now runs in afinallyafterawaitTaskTerminal, so a call answered by polling (task finished on another instance, expired or deleted) frees itsTaskWaitersentry. Test: two Redis instances, 5 calls served by B, 0 waiters left.3.
app.close()hung on a call waiting for a task owned by another instance. The plugin now aborts a shutdownAbortSignalinpreClose, combined with the request's signal viaAbortSignal.any. The interrupted call answers JSON-RPC-32603"Server shutting down", withConnection: close. Without that header the response races Fastify'scloseIdleConnections(), and the keep-alive socket heldclose()open for the 5s keep-alive timeout. Test: B'sclose()finishes in under 3s (about 300ms locally, compared with 8s or more before) and the client gets the error.README notes the new behaviour.
Fixes #260
🤖 Generated with Claude Code
https://claude.ai/code/session_01UF4S3w7iA83V9DVsasLJzM