Skip to content

fix(report): terminal and markdown output remove control characters from run values - #554

Merged
Uliseis merged 1 commit into
mainfrom
fix/terminal-control-chars
Nov 9, 2026
Merged

Uliseis merged 1 commit into
mainfrom
fix/terminal-control-chars

Conversation

@Uliseis

@Uliseis Uliseis commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Fixes GHSA-qrx5-3qq7-7w59, which is published with 1.5.1.

What changes for users

Terminal output, report --markdown and LEADERBOARD.md show control characters (C0, DEL and C1) and the bidi embedding, override and isolate controls as spaces in every value that comes from:

  • an agent (tool arguments, error bodies)
  • the simulated caller
  • a platform's call (serve's live log)
  • a results or models file
  • a transcript's file name
  • a domain that init drafted

Before, such text could write escape sequences to the terminal of whoever ran run, serve, compare, regrade, leaderboard, review, lint, validate, init, judge or calibrate. Values are cleaned before anything is cut to fit, so a cut can't split a sequence.

A command that sandtable suggests now quotes a word holding a control character as $'…', so bash and zsh still read it as the same file name. sandtable's own colours, results.json, the HTML reports and every documented contract are unchanged.

src/report/printable.ts holds the helpers:

  • printable, for a value on one line
  • printableLines, for a message that keeps its own lines
  • printableCopy, for a run that a renderer prints from

How it was verified

  • npm run check: 81 files, 1307 tests. test/control-characters.test.ts and the additions to test/judge.test.ts and test/serve-driven.test.ts fail without the fix.
  • An offline end-to-end test of the packed release, against published 1.5.0, with HTTP and OpenAI-compatible stubs on 127.0.0.1, serve webhooks, hostile results, models and domain files, and hostile transcript names. Every output went from 1–24 control characters per stream to 0.
  • Normal output is byte-identical to 1.5.0 on a TTY, colours included.
  • Suggested commands were checked in bash 3.2 and zsh against 26 file names.
  • Live Haiku 5.5 runs scored 3/3 on both versions, about $0.14 on Bedrock in all.

…rom run values

Values that an agent, a simulated caller, a platform's call or a results file
holds reach the terminal, report --markdown and LEADERBOARD.md as text. C0, DEL
and C1 controls and the bidi embedding, override and isolate controls become
spaces, before anything is cut to fit, so no escape sequence, bell or reversed
text gets through. sandtable's own colours are added after and stay.

src/report/printable.ts holds the helpers: printable for a value on one line,
printableLines for a message that keeps its own lines, and printableCopy for a
run or a calibration that a renderer prints from. results.json, the HTML
reports and every contract are unchanged.
@Uliseis
Uliseis requested a review from a team as a code owner November 9, 2026 20:51
@Uliseis
Uliseis merged commit 23a9618 into main Nov 9, 2026
14 checks passed
@Uliseis
Uliseis deleted the fix/terminal-control-chars branch November 9, 2026 20:56
@Uliseis Uliseis mentioned this pull request Nov 9, 2026
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.

1 participant