fix(shared): PASS and FAIL badges stay readable in dark command output #24042
main fromrefs/pull/24042/head·merged by juliusmarminge View on GitHubProblem#
#15094 promised: "Text on a coloured background switches to near-black or white when it would be unreadable (e.g. "PASS" badges)." spanStyle does this when the text colour is under 3:1 against the background. It picks near-black only above luminance 0.35, but white already drops below that same 3:1 at 0.30. Five of the dark palette's eight standard backgrounds (red, green, yellow, blue, magenta) fall in that gap, so the usual PASS/FAIL badges render white at about 2.85:1 in the dark theme.
Change#
Lower the cutoff to 0.30, where white stops reaching 3:1, so the fallback colour meets its own target on every background. One line in packages/shared/src/terminalOutput.ts.
| Dark background | Before | After |
|---|---|---|
red #f47067 | white 2.85:1 | #1f2328 5.54:1 |
green #57ab5a | white 2.85:1 | #1f2328 5.55:1 |
yellow #c69026 | white 2.83:1 | #1f2328 5.58:1 |
blue #539bf5 | white 2.85:1 | #1f2328 5.55:1 |
magenta #b083f0 | white 2.86:1 | #1f2328 5.53:1 |
Only backgrounds with luminance between 0.30 and 0.35 change: these five dark palette colours, 18 xterm-256 colours, and the matching true-colour band. In the dark theme those badges visibly switch from white to near-black text. Backgrounds where white already reached 3:1 keep white, and no light-palette colour changes. The fallback now reaches at least 3:1 on every background, checked across all 16.7M truecolor values. This restores the existing 3:1 contract; it does not aim for any broader contrast standard.
Scope and approval#
This is a very small fix for an obvious bug: the fallback misses the threshold it was written to enforce. It changes one comparison in the shared function that web, desktop and mobile already use. There are no new options, palette changes or parser changes. Per AGENTS.md, a colour fix is proven with before/after captures, so it adds no test.
Verification#
Web, isolated dev server (vp run dev --home-dir <tmp> --no-seed), real CommandOutputPanel.
- Fixture: a project added with
t3 project add. One completed thread holds acommand_executionitem whose persisted output contains the badge escapes below. It was written as V2 projection rows followingtest-t3-app/references/sqlite-fixtures.md, and each payload was validated against the contract schemas first. - Not a provider repro: this is a fixture fed through the real server and renderer, not a captured provider run.
- Before and after: same server and fixture; the only difference is the source line, picked up by HMR.
Badges: ESC[42m PASS, ESC[1;37;41m FAIL, Jest-style inverse green ESC[7mESC[1mESC[32m PASS. Controls that must not change: ESC[30;42m PASS (3.67:1, no fallback) and ESC[100m SKIP on #768390 (white 3.87:1).
Dark, before → after
Light, before → after (byte-identical)
Computed styles read from the real DOM:
- Dark, badges: the three badges go from
rgb(255,255,255)torgb(31,35,40). - Dark, controls:
rgb(59,64,72)and white, unchanged. - Light: all five stay white.
Checks on the final commit: vp run check:changed passes (format, lint, knip, typecheck, terminalOutput.test.ts 16/16), and git diff --check is clean.
Not checked:
- Mobile: agent device access was turned off in my environment, so I could not run the mobile client. Mobile calls the same
terminalOutputSpans(text, TERMINAL_PALETTES[theme]), so it gets the same colour choice, but I did not capture it. - Desktop: uses the same web
CommandOutputPanel; not captured separately. - Screenshot tool: T3's built-in browser panel paired and confirmed the white-on-green DOM before the fix, but its screenshot call timed out every time. I took the captures with headless Chromium (the repo's existing Playwright, fresh context) against the same isolated server.
Written by Claude Opus 5.5 via Claude Code in T3 Code, coordinated by Sol 6.1 via Codex.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XS
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
Approvability#
Verdict: Approved at
3b0c29cMacroscope's review found this PR approvable — This is a narrowly scoped readability fix that changes one contrast threshold in the existing shared terminal renderer, with no API, configuration, or workflow changes. Its visible impact is limited to correcting fallback text colors for a small luminance range in existing command output.
You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).No actionable comments were generated in the recent review.
Walkthrough
-
spanStylenow uses a0.3background-luminance threshold instead of0.35to select the dark fallback text color. A test checks foreground colors on dark-palette green and red backgrounds.Changes: Terminal text color
Layer / File(s) Summary Fallback color threshold
packages/shared/src/terminalOutput.ts,packages/shared/src/terminalOutput.test.tsspanStylenow uses a0.3luminance threshold to select the fallback text color. A test checks for#1f2328on dark-palette green and red backgrounds.Estimated code review effort: 1 (Trivial) | ~5 minutes
Change: Bug fix
Suggested reviewers:
scratchyone
Merge Risk:
Minimal · up tof5621-
This change makes PASS and FAIL badge text more readable on dark backgrounds in command output. It only affects backgrounds in a narrow luminance range, and no merge-blocking risk was identified.
Pre-merge checks:
4-
Check name Status Explanation Title check The title names the actual change: the fallback text colour for PASS and FAIL badges in dark command output is fixed so the badges stay readable. It matches the raw summary, which shows the luminance … Description check The description follows the repository template closely. It has a clear Problem section that cites the expected behaviour and the affected palette colours. The Change section explains the one-line fix… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check skipped because no linked issues were found for this pull request. Full details: Title check
-
Explanation
The title names the actual change: the fallback text colour for PASS and FAIL badges in dark command output is fixed so the badges stay readable. It matches the raw summary, which shows the luminance cutoff moved from 0.35 to 0.30 in terminalOutput.ts, and the test added for dark-palette green and red badges. The title is in conventional-commit form and fits the scope of the change.
Full details: Description check
-
Explanation
The description follows the repository template closely. It has a clear Problem section that cites the expected behaviour and the affected palette colours. The Change section explains the one-line fix and why it is needed. The Scope section states that this is a small fix of an obvious bug and says why no issue link is needed. The Verification section gives specific fixtures, before and after computed styles, screenshots, the tests run, and the items not checked. The description also gives the model and harness, as the template asks. The only gap is that the Scope section does not link an issue; it explains why one is not needed, which the template accepts.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: 1f55acf
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
61de961e-052f-43d1-a0a7-935d01ce6d8c
Commits-
Reviewing files that changed from the base of the PR and between 4915b157499ea3842a9d18ba56ed590c00d1c322 and f56215360205abbdba3ba4f2fc5d232b65640351.
Files selected for processing: 2-
packages/shared/src/terminalOutput.test.tspackages/shared/src/terminalOutput.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
-
-
Note
Written by
gpt-6.1-solon behalf of MariaVerified in a real dev environment#
Verified as-is at
4915b157499ea3842a9d18ba56ed590c00d1c322on this Linux Boat VM. No code changes or pushes were needed.- Reproduced on
github/mainatfa4e4677c0in/home/user/main, then stopped its dev server before starting the exact PR head. Ranvp iin both checkouts and used separate, empty development state. - Drove
/usr/bin/google-chromewith the repository's Playwright. Added/home/user/t3codeas a project through the app, selected Codexgpt-6.1-sol, and submitted the same read-only ANSIprintfprompt on each version. Both real provider turns completed through the local proxy. No mocked provider, database fixtures, demo data, or injected command-output rows. - Expanded the completed turn and command output in the web client. On main, green PASS, white-on-red FAIL, and inverse green PASS render white at about 2.85:1. On the PR they render
rgb(31,35,40)at about 5.5:1. - Neighbor checks: explicit black-on-green stays
rgb(59,64,72); gray SKIP stays white; plain output remains readable. All five light-theme badge foreground/background styles match main. Collapsing, reopening, and reloading command output preserve the real provider output. - Blacksmith:
vp test run packages/shared/src/terminalOutput.test.tspassed 16/16.vp run check:changedpassed format, lint, knip, affected typechecks, and 16/16 tests. The shallow worker needed PR base history fetched beforecheck:changedcould compare it.git diff --checkpassed locally.
Dark, main before:

Dark, PR after:

Light, main before:

Light, PR after:

Command output expansion, collapse, and reopening. Inspected the captures, checked uploaded image hashes, and played and sought the uploaded video in Chrome:
Not verified#
Native iOS/Android and the Electron desktop shell were not exercised on this Linux browser pass. Other provider adapters, remote/relay/tunnel connections, custom themes, and every xterm/truecolor background were not exercised. This verifies the shipped web command-output path with real Codex output, not an exhaustive color-space audit.
Evidence rendering limitation: reopening this comment in cafe shows external media as links rather than inline players/images. The uploaded images match the inspected originals byte-for-byte, and the uploaded video played to completion and supported seeking in Chrome. An attempted native cafe attachment upload returned HTTP 409 (
Operation changed); its unused reservation was canceled. Inline cafe media playback remains unverified.- Reproduced on
tanstack-source added labelsbug
juliusmarminge added labelstakeover:in-progress
Evidence#
Scenario: Command output badges meet the existing 3:1 contrast target#
Created fresh synthetic project/thread state, replayed the exact five ANSI badge outputs, opened the thread, expanded Worked for and the command row, and captured dark and light themes. Both sides used Chromium at 1280×800.
Proven: base selected white for the first three dark badges (about 2.85:1); head selected near-black (5.54–5.55:1). The explicit foreground and gray-background controls retained their colors. Light rendering appeared unchanged.
Before After Commit 1f55acf13b f562153602 Result Failed: measured 2.846:1 against the 3:1 target Passed: all five dark badges meet 3:1 Dark command badges 

Light command badges 

Assertion failure capture after light control 
Not shown:
- Desktop and mobile rendering were not exercised; this proof covers the reported web-client reproduction.
- Yellow, blue, and magenta backgrounds were not captured; the reproduction supplied green/red affected badges and two controls.
juliusmarminge added labelstakeover:ready
juliusmarminge removed labelstakeover:in-progress
juliusmarminge merged thisf315da3
juliusmarminge closed this
juliusmarminge removed labelstakeover:ready
Sign in to join this conversation.
Codex Review Summary#
This comment shows the latest Codex review activity on this pull request.
3b0c29cℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.