Skip to content

Agent chat tests: the turn's token count stays quieter than its words - #23996

Merged
teamleaderleo merged 1 commit into
feat-cmux-nextfrom
tp/muted-token-count
Oct 22, 2026
Merged

teamleaderleo merged 1 commit into
feat-cmux-nextfrom
tp/muted-token-count

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Leo-ask: ask-03712a76b0

Leo (2026-10-21), on nightly 03960f5's "Working for 35s · 679.9K tokens": "the token font shouldnt be this same color and shit".

What main already does

#23779 (merged after that nightly) already draws "· 679.9K tokens" in the theme's tertiary text token (--cv-text-dim, which is --agent-soft, the host's textTertiary) with tabular numerals. The rule is .cv-worked__count:has(> .cv-worked__tokens) in conversation.css. The line's words, "Working for 35s" or "Thinking", keep the secondary token (--cv-text-muted). The rule covers both lines that show the count: the bottom live line (Thinking.tsx, the default Codex layout) and the line over the turn when that layout is off (WorkingFor.tsx). The finished "Worked for" row shows no tokens, so it needs nothing. Leo's app gets this with the next web OTA or nightly.

What this PR adds

No test covered that rule, so a later style pass could undo it without anything failing. This PR adds tests:

  • test/agent-pane-turn-tokens-muted.test.tsx: for both lines, the count is its own .cv-worked__count > .cv-worked__tokens span, after the words and outside them. The CSS rule for it uses var(--cv-text-dim) with tabular-nums and has no literal color. .cv-worked keeps var(--cv-text-muted).
  • test/agent-pane-turn-tokens-muted-browser.test.tsx (browser lane): loads the real stylesheets in Chromium with a host theme and checks the resolved colors. The words are the theme's secondary color, the count and its "·" are the tertiary, and the count uses tabular numerals.

No product code changes.

Before / after

Gallery agent-pane.transcript / working-tokens (synthetic fixture, Reduce Motion so the line holds still). Before is nightly 03960f5's gallery; after is feat-cmux-next's (this branch draws the same). Resolved colors, dark: words rgb(170,170,170), tokens before rgb(170,170,170), after rgb(136,136,136). Light: words rgb(97,97,97), tokens before rgb(97,97,97), after rgb(127,128,128).

Before (03960f5) After (feat-cmux-next)
Dark tokens before dark tokens after dark
Light tokens before light tokens after light

The after shots show the Codex layout's bottom line ("Thinking 5m 56s · 2.1M tokens"). The time is also in the tertiary color there, which was already the case before this ask. With that layout off, the line over the turn keeps "Working for 35s" in the secondary color and draws the count in the tertiary color (checked by the browser test).

Changelog

none

Observed / Not run

  • Ran: bun scripts/check-browser-test-lanes.ts (passes), vp fmt on the new files, and the gallery screenshots above, with their computed colors read in headless Chromium.
  • Not run locally: bun test is blocked on this Mac (cosmic-gray, no local test runs). The PR's webviews CI runs both files, and the browser file runs in the browser lane.

Agent session: cosmic-gray

🤖 Generated with Claude Code

Leo (2026-10-21): "the token font shouldnt be this same color and shit", on nightly 03960f5's
"Working for 35s · 679.9K tokens", drawn in one color. #23779 (after that nightly) already draws
"· 679.9K tokens" in the theme's tertiary text (--cv-text-dim, --agent-soft) in tabular numerals,
on both the bottom live line (Thinking.tsx) and the line over the turn (WorkingFor.tsx). Nothing
pinned it. These tests do: the count is its own span, the CSS rule for it uses the tertiary token
and no literal color, and in Chromium its color resolves to the theme's tertiary while the words
keep the secondary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a16030-bf28-7072-b1f6-b83bbd0beacc&host=cosmic-gray
@teamleaderleo teamleaderleo added the risk:low Risk tier (docs/ci/risk-tiers.md) label Oct 22, 2026
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 87ef29b: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr23996 -f ref=tp/muted-token-count -f platform=macos -f backend_mode=local

Tour of 87ef29b5e5 (run): no media. The tour did not run: only webview code changed (3 path(s)), which the gallery advisory run checks in Linux Chromium on the pull request (its artifact holds any captures); add the media-tour-mac label, then re-add media-tour, to tour it on a Mac.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by transcript-parity on cosmic-gray · session

@blacksmith-sh

blacksmith-sh Bot commented Oct 22, 2026

Copy link
Copy Markdown

Found 2 test failures on Blacksmith runners:

Failures

Test View Logs
nightly cmux-tui resolve/nightly cmux-tui resolve View Logs
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)/
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (subagent, correctness first): SHIP at 87ef29b

Tests-only PR. I read it against the production code at this head and at feat-cmux-next, where the .cv-worked, .cv-worked__count:has(> .cv-worked__tokens) and .cv-thinking rules and both components are unchanged.

  • Static markup: outside any provider, Thinking since/now below and WorkingFor (kind working, no below/durationMs) render "Thinking" / "Working for 35s", then the count span exactly as asserted. The preload installs the English table, Intl compact gives 679.9K, the plural form is #other, the middle dot is U+00B7 everywhere, and useTranscriptDisclosure takes its server snapshot.
  • CSS lookup: \n.cv-worked { and \n.cv-worked__count:has(> .cv-worked__tokens) { both exist. Each block ends at its first }, holds the asserted declarations and has no literal colors. Both :root token aliases are present.
  • Browser: the inline --agent-* on <html> beats shared/styles.css's :root defaults. .cv-thinking and .cv-worked__label resolve to muted, and the sep and tokens inherit dim from the count span. The shimmer only sets the fill, never color, and data-status-indicators="static" turns it off anyway, so the motion preference can't change the result. Removing the count rule turns both files red.
  • Lanes: the file is one top-level await requireBrowserLane("…", async () => {…}), opens no gallery frame and reads no layout in a frame callback, so check-browser-test-lanes passes. test/support/turnTokenLines.tsx doesn't match bun's *.test.* pattern. tsconfig includes test, and the fixture row has every required AcpmuxRow field. The pane-english scanner only scans src/agent-session/acpmux, so the test literals are fine.
  • The PR body is accurate: the rule came from Agent chat: one live block at the bottom of a running turn; Writing a command while Claude writes it #23779, and the working-tokens gallery entry exists.

Non-blocking: the browser tabular-nums check can't fail, because .cv-worked already sets tabular-nums and the count inherits it. The static rule check covers it. And html.search(/Working for|Thinking/) returns -1 if the words go missing, so that ordering assertion would pass vacuously. The current reds (nightly-guards release-notary and its Guard status rollup) are in jobs this webviews-tests-only diff doesn't touch.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:low Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant