Skip to content

fix(workbench): a script's result shows what it printed, and its failure the reason - #6885

Merged
M4n5ter merged 1 commit into
rust-previewfrom
fix/script-result-readable
Nov 14, 2026
Merged

M4n5ter merged 1 commit into
rust-previewfrom
fix/script-result-readable

Conversation

@UncertaintyDeterminesYou4ndMe

Copy link
Copy Markdown
Contributor

What was wrong

The exec presentation 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:

  • a finished script showed "Original result" with the JSON line before its output;
  • a failed script showed the whole reply as its failure, with the reason inside a diagnostic of 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.ts reads both forms: the typed observation and the text the model received. A reply the Host cut short still gives its reason.
  • A finished script shows "Output" with what it printed, or the value it returned when it printed nothing.
  • A failed script's card shows the reason itself (TypeError: tools.ModelList is not a function). A diagnostic that is itself JSON gives its error.message.
  • The source view (<>) 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.

…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.
@M4n5ter
M4n5ter merged commit a7719fc into rust-preview Nov 14, 2026
27 of 32 checks passed
@M4n5ter
M4n5ter deleted the fix/script-result-readable branch November 14, 2026 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants