Stopped panicking on a tool call that never reported a result. - #3
Open
moedash wants to merge 1 commit into
Open
Stopped panicking on a tool call that never reported a result.#3moedash wants to merge 1 commit into
moedash wants to merge 1 commit into
Conversation
Filling in a missing tool output was quiet for a function call but called error_or_panic for a custom tool call or a local shell call, which panics in a debug build. Code mode dispatches custom tool calls, so that is the ordinary case rather than an edge one: kill codex during a tool and the thread could not be resumed at all, because the panic took the runtime worker down while the process stayed alive holding the thread's writer lock. A gap there is expected, not a defect. The recovery code already sat directly after the panic, which is the tell.
3 tasks
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.
What changed?
ensure_call_outputs_presentfills in a missing tool output quietly for every kind of call. It previously callederror_or_panicfor a custom tool call and a local shell call, which panics in a debug build.Why?
Code mode dispatches custom tool calls, so this is the ordinary case rather than an edge one. Kill codex during a tool and the thread could not be resumed at all: the panic took the runtime worker down while the process stayed alive holding the thread's writer lock, and every later resume then failed with
already has an active writer. A release build only logged the error and carried on, so the two builds disagreed about whether this was recoverable.A tool call with no result is expected, not a defect. An interrupt or a crash between dispatching a tool and writing its result leaves the call alone in the transcript, and a resumed thread has to be able to send that history to the model. The recovery code already sat directly after the panic, which is the tell.
How did you test it?
The two tests that asserted the panic now assert the filled-in output instead.
cargo test -p codex-core --lib context_manager::is 68/0.End to end: crashed codex mid tool call and resumed the thread, which now completes instead of panicking.