Repository navigation
fix(workbench): a script's result shows what it printed, and its failure the reason - #6885
Merged
Merged
Conversation
…ure the reason The exec presentation read only the typed observation. The result a card reads is what the model received: one line of JSON, then what the script printed. So a finished script showed that JSON line before its output, and a failed one showed the whole reply with a diagnostic of escaped JSON inside. Both forms are read now, and a diagnostic that is itself JSON gives its message.
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 was wrong
The
execpresentation from #6840 reads the typed observation ({ observation: … }). The result a tool card reads is what the model received: one line of JSON ({"state":"completed","cell_id":…,"result":…}), then what the script printed. That is text, so the presentation never matched, and on the desktop:diagnosticof escaped JSON ({\"ok\":false,\"error\":{\"message\":\"TypeError: …\"}}).Code mode is the default for several models, so most steps of those conversations looked like this.
Change
scriptReply.tsreads both forms: the typed observation and the text the model received. A reply the Host cut short still gives its reason.TypeError: tools.ModelList is not a function). Adiagnosticthat is itself JSON gives itserror.message.<>) still shows the original reply.Tests cover both forms, a returned value, a nested diagnostic, and a reply cut short.
AI use
Found by comparing screenshots of the same turn with and without my local changes, and written with Claude Code (Claude Fable 5.2). I checked it with a local screenshot probe of a turn with one finished and one failed script, before and after.