Repository navigation
shelley/loop: report a tool panic as that call's error - #363
Open
AndrewFribush wants to merge 1 commit into
Open
AndrewFribush wants to merge 1 commit into
AndrewFribush wants to merge 1 commit into
Conversation
executeToolCall runs each tool on its own goroutine with no recover, so a panic in any tool, including an MCP wrapper or a tool someone adds later, ends the server process and every conversation running in it, not just the turn that hit the bug. Recover on that goroutine, log where it panicked, and send the panic back as the call's error. The model sees "tool NAME panicked (TYPE)", the rest of the batch runs, and the bug stays loud in the logs. A panic unwinds past the tool's secret redaction, so the result and the log carry the panic's type and call sites (function, file and line) but never its value or debug.Stack's raw frame arguments. Panics on goroutines a tool starts itself are not covered; those are the tool's to handle. The new test runs a batch of a tool that indexes past a nil slice and a tool that succeeds, then a tool that panics with a string. Against the old code the first panic ends the test binary.
This branch has not been deployed
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.
executeToolCall runs each tool on its own goroutine with no recover, so a panic in any tool, including an MCP wrapper or a tool someone adds later, ends the server process and every conversation running in it, not just the turn that hit the bug.
Recover on that goroutine, log where it panicked, and send the panic back as the call's error. The model sees "tool NAME panicked (TYPE)", the rest of the batch runs, and the bug stays loud in the logs. A panic unwinds past the tool's secret redaction, so the result and the log carry the panic's type and call sites (function, file and line) but never its value or debug.Stack's raw frame arguments. Panics on goroutines a tool starts itself are not covered; those are the tool's to handle.
The new test runs a batch of a tool that indexes past a nil slice and a tool that succeeds, then a tool that panics with a string. Against the old code the first panic ends the test binary.
🤖 Generated with Claude Code