fix(mship): add tool watchdog#4991
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR adds a two-layer tool watchdog to prevent hung async tool executions from permanently blocking the copilot checkpoint loop. Previously, a VFS read (or any tool) that neither resolved nor rejected would park the loop's
Confidence Score: 4/5Safe to merge — the watchdog correctly unblocks hung tool calls without interfering with tools that complete normally, and state transitions are verified to satisfy the downstream result builder. The two-layer design is sound: per-tool watchdog in executeToolWithWatchdog and a structural backstop in the checkpoint loop. The forceFailHungToolCall path correctly sets tool.result before the resume body builder checks it, preventing the missing result exception. The unawaited publishTerminalToolConfirmation in forceFailHungToolCall means a client could be left with a spinning tool indicator if that call fails silently, but this is a minor edge case in an already-error recovery path. executor.ts — the forceFailHungToolCall function's unawaited terminal confirmation publish is the only call site that lacks error handling; all other code paths in the file handle errors consistently. Important Files Changed
Sequence DiagramsequenceDiagram
participant CL as Checkpoint Loop
participant WD as executeToolWithWatchdog
participant TH as Tool Handler
participant FF as forceFailHungToolCall
participant Go as Go Resume Endpoint
CL->>WD: executeToolAndReport(toolCallId)
WD->>TH: executeTool(name, params)
alt Tool completes within watchdog cap
TH-->>WD: result
WD-->>CL: pendingPromise resolves
CL->>Go: POST /api/tools/resume with results
else Per-tool watchdog fires first
WD-->>CL: rejects with ToolExecutionTimeoutError
CL->>Go: POST /api/tools/resume with error result
else Tool hangs past waitBudget (watchdog + grace)
Note over CL: sleep(maxWatchdog + 30s) wins race
CL->>FF: forceFailHungToolCall(toolCallId)
FF->>FF: setTerminalToolCallState error
FF->>FF: completeAsyncToolCall failed
FF->>FF: publishTerminalToolConfirmation
FF-->>CL: done
CL->>Go: POST /api/tools/resume with error result
end
Reviews (1): Last reviewed commit: "Add tool watchdog" | Re-trigger Greptile |
Summary
Add tool timeout for vfs reads
Type of Change
Testing
Manual
Checklist