Skip to content

A headless driver has no terminal to ask for a palette - #256

Merged
trissim merged 1 commit into
mainfrom
fix/headless-driver-has-no-palette
Nov 6, 2026
Merged

trissim merged 1 commit into
mainfrom
fix/headless-driver-has-no-palette

Conversation

@trissim

@trissim trissim commented Nov 6, 2026

Copy link
Copy Markdown

Numbers first: Toad's smallest app tests go from 1.18–1.23 s to 0.93–1.04 s each (tests/textual/test_initial_session_title.py, serial, same machine). That's 0.25 s × 594 app tests, about 2.5 minutes of a serial suite run spent waiting for a reply that cannot come.

The defect: HeadlessDriver inherited Driver.query_colours (src/textual/driver.py:162). It writes the OSC 10/11/4 queries and waits up to timeout for replies. HeadlessDriver.write sends nowhere, so no reply can arrive. Every headless app that asks sits out the whole deadline and then gets TerminalGaveNoPalette anyway. Toad asks once at startup with a 0.25 s deadline (toad/textual_colours.py:354), so every Toad app test paid it.

The fix: HeadlessDriver.query_colours raises TerminalGaveNoPalette at once. Callers get the same answer they already got, minus the wait.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XbFMSqJMarXn2ZE8iAL7Sd

HeadlessDriver inherited Driver.query_colours, which writes the OSC 10/11/4 queries and
waits for their replies. The headless driver's write sends nowhere, so no reply can come,
and every headless app that asked waited out the whole timeout before the same
TerminalGaveNoPalette. Toad asks once at startup with a 0.25 s deadline, so each of its
594 app tests sat idle 0.25 s (about 2.5 minutes of a serial run). The headless driver now
answers at once: its smallest app tests go from 1.18-1.23 s to 0.93-1.04 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XbFMSqJMarXn2ZE8iAL7Sd
Copilot AI balanced review requested due to automatic review settings November 6, 2026 19:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@trissim
trissim merged commit 7153084 into main Nov 6, 2026
4 of 25 checks passed
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