Repository navigation
fix(review): report killed Pi tool helpers instead of tool exited null - #710
Merged
Merged
Conversation
A helper killed at the deadline surfaced as "tool exited null", which dropped the "keep this file skipped" instruction for images. A helper that died with an unread request crashed the host with an uncaught EPIPE. Report the kill reason and handle the stdin error. The image bounds tests shared one 500ms deadline with Node helper startup, so they failed under load. They now hold the extension's timers unless the case is about that deadline. Twapp-Session: 59d912f3-982f-402e-8bd8-3e31269a28b0
piekstra-dev
approved these changes
Nov 3, 2026
piekstra-dev
left a comment
Collaborator
There was a problem hiding this comment.
Automated PR Review
Reviewed commit: 7a5f8b778db0
Profile: reviewer - Posting as: piekstra-dev
Summary
| Reviewer | Findings |
|---|---|
| documentation:drift | 0 |
| go:implementation-tests | 0 |
| privacy:captured-data | 0 |
| go:implementation | 0 |
Reviewer Coverage
Complete coverage details are retained in the local coverage.json artifact.
documentation:drift— complete (constrained); scope: 1 file; examples:internal/llmadapters/pi_rpc.go; body-inspected: 1 file; examples:internal/llmadapters/pi_rpc.go; skipped: none; constraints: Searched markdown docs for the old and new error texts, SIGKILL, and image read timeouts; found no document describing these messages.go:implementation-tests— complete (broad); scope: 2 files; examples:internal/llmadapters/pi_rpc.go,internal/llmadapters/pi_rpc_extension_unix_test.go; body-inspected: 2 files; examples:internal/llmadapters/pi_rpc.go,internal/llmadapters/pi_rpc_extension_unix_test.go; skipped: none; constraints: Static review of the diff only; tests were not executed and Node behavior under load was not re-measured.privacy:captured-data— complete (constrained); scope: 2 files; examples:internal/llmadapters/pi_rpc.go,internal/llmadapters/pi_rpc_extension_unix_test.go; body-inspected: 2 files; examples:internal/llmadapters/pi_rpc.go,internal/llmadapters/pi_rpc_extension_unix_test.go; skipped: none; constraints: nonego:implementation— complete (broad); scope: 1 file; examples:internal/llmadapters/pi_rpc.go; body-inspected: 1 file; examples:internal/llmadapters/pi_rpc.go; skipped: none; constraints: Reviewed the diff of internal/llmadapters/pi_rpc.go only (embedded Node extension source); did not execute tests or the timing reproduction. Test files were not in the assigned scope and were not inspected.
0 PR discussion threads considered. 0 summarized; 0 resolved.
Completed in 1m 07s | $0.42 | claude-sonnet-5-5 | cr 0.10.365
| Field | Value |
|---|---|
| Model | claude-sonnet-5-5 |
| Reviewers | documentation:drift, go:implementation-tests, privacy:captured-data, go:implementation |
| Engine | claude_cli · claude-sonnet-5-5 |
| Reviewed by | cr · piekstra-dev |
| Duration | 1m 07s wall · 1m 46s compute |
| Cost | $0.42 |
| Tokens | 44 in / 6.1k out |
Per-workstream usage
orchestrator-selection— claude-sonnet-5-5- In: 6
- Out: 971
- Cache read: 21.1k
- Cache create: 12.9k
- Cost: $0.06
- Duration: 16s
documentation:drift— claude-sonnet-5-5- In: 8
- Out: 1.2k
- Cache read: 37.5k
- Cache create: 11.6k
- Cost: $0.06
- Duration: 13s
go:implementation-tests— claude-sonnet-5-5- In: 8
- Out: 1.5k
- Cache read: 40.8k
- Cache create: 15.4k
- Cost: $0.08
- Duration: 23s
privacy:captured-data— claude-sonnet-5-5- In: 8
- Out: 1.0k
- Cache read: 43.1k
- Cache create: 15.7k
- Cost: $0.08
- Duration: 20s
go:implementation— claude-sonnet-5-5- In: 8
- Out: 1.1k
- Cache read: 37.0k
- Cache create: 11.1k
- Cost: $0.06
- Duration: 17s
orchestrator-rollup— claude-sonnet-5-5- In: 6
- Out: 306
- Cache read: 49.4k
- Cache create: 2.4k
- Cost: $0.08
- Duration: 15s
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TestPiRPCReviewerImageProcessingBoundsfailed withtool exited nullwhenever the full suite ran on a loaded Mac. The cause is a test bound plus two real defects in how the reviewer extension handles a killed helper. No timeout was raised and nothing is skipped or retried.Cause
The extension kills a tool helper with SIGKILL at its deadline. The test set that deadline to 500 ms and shared it with starting a Node helper process, which is not what the
outputsubtest measures and only part of whatdeadlinemeasures.cr_readthat failedreadImagetool exited nullThe failure message also exposed two production defects:
tool exited null. InreadImagethe deadline had fired, but the early return on a tool error skipped the mapping toImage read timed out; keep this file skipped, so a reviewer lost that instruction. Ordinary tools had the same unexplained text.EPIPEonchild.stdin. That terminates the whole Node host, not one tool call. Reproduced with a 4 MB request against both a hung helper and one that exits at once.Fix
runToolreportsTool request timed outorTool request abortedwhen it killed the child, and names the signal for any other kill (tool exited SIGTERM).readImagemaps a killed helper to its timed-out message once its deadline has fired.child.stdinhas an error handler;closestill reports the outcome.outputand the readerdeadlinecase hold the extension's timers.deadlineexpires them only from inside the reader, so it always exercises the reader abort. Neither depends on wall-clock time.helper deadlinecase: a hung helper and the real timer. Being killed at any stage gives the same result, so there is no race.TestPiRPCReviewerToolReportsKilledHelper: deadline, abort, external signal and unread request.TestPiRPCReviewerExtensionRejectsInvalidImageTransporthad the same flaw with a 1 s bound, and also holds its timers now.Evidence
go test -count=1 ./..., no added load (1-minute load average at end of run: 12 to 52 before, 17 to 83 after)RejectsInvalidImageTransport, 240 spinnersToolReportsKilledHelper, 120 spinnersEach production change was reverted on its own and a test failed each time: the
readImagemapping (helper deadline), the stdin handler (unread request), the kill reason (deadline,abort,unread request), and the signal text (external signal). Removing the output budget check failsoutput, and removing the timed-out text failsdeadlineandhelper deadline.golangci-lintreports 0 issues on the package.TestPiRPCReviewerExtensionForwardsBinaryViewsAfterDiff(5 s) andTestPiRPCReviewerHelperStaysInParentProcessGrouppassed 8 of 8 at 240 spinners, so they are unchanged.To reproduce, run CPU spinners alongside the package: