Skip to content

Agent chat: a turn's tokens split into output and input, its time and tokens quieter - #24259

Merged
teamleaderleo merged 11 commits into
feat-cmux-nextfrom
tp/token-split
Oct 28, 2026
Merged

teamleaderleo merged 11 commits into
feat-cmux-nextfrom
tp/token-split

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Leo (2026-10-21): "shouldnt the token text and maybe time tho be less prominent? darker? also i think usually anthropic talks about output instead of read tokens... but its ok if we show both, we just ought to split it up"

Follows #23996 (merged), which added tests for the quieter token count, and builds on #25118 (merged), which made the turn count output only.

What changes

  • The running line reads "Thinking 3m 27s · ↓ 12.4K out ↑ 3.9M in". Output comes first, and "out" is Show output tokens separately from context in agent turns #25118's output-only count (turnTokens); output is never folded into one total with what the model read. "in" is everything the model read: fresh input plus cache reads plus cache writes. Hovering the count shows each part ("Output 12.4K · fresh input 18K · cache reads 2.1M · cache writes 42K").
  • The time and the tokens use the tertiary text token (--cv-text-dim) with tabular numerals. That covers the time beside "Thinking" or a running call, and the time inside "Working for 35s" and "Worked for 1m 16s". "Thinking" and the other words keep their color.
  • A finished turn's "Worked for" line (when it is the turn's only one: not a steered turn, nor one folded into several stretches), and its footer when the turn isn't folded, show that turn's tokens the same way. The numbers come from its turn_result (outputTokens, inputTokens, cacheReadTokens, cacheWriteTokens, acpmux hub/turn_usage.rs, Claude Code's main loop).
  • The split reuses the counts acpmux already sends on each marked Claude call since Show output tokens separately from context in agent turns #25118 (inputTokens, cachedReadTokens, cachedWriteTokens, outputTokens beside used, claude_stdio/inbound.rs); acpmux sends nothing new. The pane (direct.ts) adds the read side up per turn beside the output count.
  • Fallbacks:
    • If any call in the turn arrives without its input and output counts (an older acpmux), the split goes away and the line shows the output alone, "2.1M out" (turn.working.outputTokens), so it never shows a split that leaves calls out.
    • Codex and other harnesses report no per-call usage, so they still show the time alone.
  • "out" and "in" and the hover text are localized in all 21 pane languages (turn.tokens.out, turn.tokens.in, turn.tokens.detail). Non-English strings are marked needs_review.

Tests

  • test/agent-pane-turn-tokens.test.tsx:
  • test/agent-pane-turn-token-split.test.tsx:
    • Markup for both live lines and for Worked for.
    • The hover text.
    • The time sits in the quieter span.
    • The CSS rule uses the tertiary token.
  • cmux-tui/.../context_window.rs: the streamed call's used is 4200 (Show output tokens separately from context in agent turns #25118) and it carries input 1200, cache reads 3000, cache writes 0, output 300.
  • Gallery: agent-pane.transcript gets working-tokens (split), working-tokens-total (fallback, "2.1M out") and worked-tokens (finished turn).

Before / after

Gallery agent-pane.transcript, synthetic fixtures with Reduce Motion on. Before is feat-cmux-next's live gallery; after is this branch.

Before After
Running line, dark before after
Running line, light before after
Worked for, dark before after
Worked for, light after

Computed colors in the dark theme: words rgb(170,170,170); time and tokens rgb(136,136,136). Light theme: words rgb(97,97,97); time and tokens rgb(127,128,128). Hover text in the after state: "Output 12.4K · fresh input 18K · cache reads 2.1M · cache writes 42K". The before Worked for has no tokens and its time is in the words' color ("Worked for 1m").

Changelog

Changed: The agent chat's turn line shows output and input tokens separately, with the time and token counts in a quieter color.

Observed / Not run

  • Ran: the gallery screenshots above, with colors computed in headless Chromium; rustfmt, vp fmt, the browser-lane import check, the xcstrings duplicate-key check, and gen-strings.mjs.
  • On Linux fast checks at the current head: bun test for agent-pane-turn-tokens, agent-pane-turn-token-split, transcript-codex-live-line and agent-pane-turn-tokens-muted (47 pass), the vp check typecheck, vp fmt and vp lint on the touched files, the xcstrings key check, and cargo test -p acpmux --test hub_integration context_window, clippy with -D warnings and rustfmt.
  • The screenshots were taken before the base update; the fallback line now reads "2.1M out" rather than "2.1M tokens".

Agent session: agent session

🤖 Generated with Claude Code

… tokens quieter

Leo (2026-10-21): "shouldnt the token text and maybe time tho be less prominent? darker? also i
think usually anthropic talks about output instead of read tokens... but its ok if we show both,
we just ought to split it up".

acpmux now marks each Claude model call's usage with its split (_meta.acpmux.tokens: input,
cacheRead, cacheWrite, output), and the pane adds the split up per turn beside the total. The
running line reads "Thinking 3m 27s · ↓ 12.4K out ↑ 3.9M in": output first, then all the model
read (fresh input, cache reads and writes), with each part named on hover. A finished turn's
Worked for line and its footer say the turn's tokens from its turn_result the same way. The time
(beside Thinking, and inside "Working for" and "Worked for") and the tokens take the tertiary text
token in tabular numerals; the words keep their color. A call without the split (an older acpmux)
falls back to the one total; Codex reports no per-call usage and shows the time alone, as before.

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 temporarily deployed to cmux-tui-merge-tree October 22, 2026 06:47 — with GitHub Actions Inactive
@teamleaderleo teamleaderleo added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 22, 2026
@teamleaderleo

teamleaderleo commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · session

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-ft719 created for this PR by the cmux coordinator.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6.1-sol, xhigh): BLOCK at c20a1f1

One change introduces a webviews check failure:

  • [P2] webviews/src/agent-session/acpmux/conversation/TurnRows.tsx:48: WorkedFor retains const t = useT() after its last use moved into WorkedLabel. The variable is now unused. Oxlint's default-enabled eslint/no-unused-vars rule reports this, and webviews uses denyWarnings: true (config/vite-plus/check.ts:21), so bun run check fails. Remove the unused declaration; WorkedLabel already obtains its own translator.

No additional concrete correctness defects found in the token accumulation/reset/rebuild paths, memoization, translated time splitting, markup assertions, Rust usage metadata, catalog generation, or footer placement. Static review only: no builds, tests, web lint, rustfmt, or clippy were run on this host.

teamleaderleo and others added 2 commits October 22, 2026 00:14
# Conflicts:
#	webviews/src/agent-session/acpmux/conversation/Thinking.tsx
#	webviews/src/agent-session/acpmux/conversation/TurnRows.tsx
#	webviews/src/agent-session/acpmux/conversation/WorkingFor.tsx
The base merge reordered the catalog and dropped chatInspector.tasks.noTerminal.noCall and
.remote; this restores base's file and adds only turn.tokens.out, .in and .detail.

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 temporarily deployed to cmux-tui-merge-tree October 22, 2026 07:48 — with GitHub Actions Inactive
# Conflicts:
#	webviews/src/agent-session/acpmux/App.tsx
@teamleaderleo
teamleaderleo temporarily deployed to cmux-tui-merge-tree October 22, 2026 07:55 — with GitHub Actions Inactive
@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 5c87852: 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=pr24259 -f ref=tp/token-split -f platform=macos -f backend_mode=local

Unclear: web / react-apps-check failed: no known signature; failed step: Check webview test shards.

CI failed on 5c8785209d (run 40632112089 attempt 1): 3 code, 1 unknown.

Job Verdict Why
web / react-apps-base-check (4) code a web test failed
web / react-apps-base-check (2) code a web test failed
web / react-apps-base-check (3) code a web test failed
web / react-apps-check unknown no known signature; failed step: Check webview test shards

Failures:

  • seen on other PRs layout.test.ts only page.css imports the page's sheets: failed (job)
  • seen on other PRs agent-pane-attach-huge-files.test.ts 2 .mp4 500 MB drop remote: failed (job)
  • seen on other PRs agent-pane-queue-scroll-bottom.test.ts chromium > a prompt the fold hides, run elsewhere, leaves no room as the stack shrinks, opens and cl...: failed (job)
  • seen on other PRs agent-pane-queue-scroll-bottom.test.ts webkit > the queue opened, the view scrolled to its end shows the last row whole, and it stays: failed (job)
  • seen on other PRs agent-pane-queue-scroll-bottom.test.ts webkit > the queue closed at the latest row keeps the last row on the stack, with no room that glide...: failed (job)
  • seen on other PRs agent-pane-queue-scroll-bottom.test.ts webkit > a prompt the fold hides, run elsewhere, leaves no room as the stack shrinks, opens and clos...: failed (job)
  • seen on other PRs agent-pane-queue-scroll-bottom.test.ts webkit > a prompt past the opened queue's cap, run elsewhere, leaves no room when the queue closes: failed (job)
  • seen on other PRs agent-pane-queue-scroll-bottom.test.ts webkit > in a chat switched to, a queued prompt withdrawn leaves no room held for the last chat's qu...: failed (job)
  • seen on other PRs agent-pane-background-tasks.test.ts the summary card lists the chat's background tasks: running ones first, the finished folded: failed (job)
  • seen on other PRs agent-pane-chat-unavailable.test.ts loading never shows the unavailable text: a slow attach, then a machine still connecting: failed (job)
  • ... 14 more in the job logs
Matched log lines
web / react-apps-base-check (4): (fail) only page.css imports the page's sheets [27.90ms]
web / react-apps-base-check (2): (fail) the summary card lists the chat's background tasks: running ones first, the finished folded [965.12ms]
web / react-apps-base-check (3): (fail) no orange or system accent and no opaque glass on the gallery stages [540405.86ms]

Not re-run automatically: web / react-apps-base-check (4), web / react-apps-base-check (2), web / react-apps-base-check (3), web / react-apps-check are not machine failures.

Written by scripts/ci/classify_failures.py (ci-failure-attribution.yml); signatures are its SIGNATURES table. A machine verdict is the runner's fault, not this PR's; yours means the failing file is one this PR changes, also red on main that main's latest full suite fails the same way, seen on other PRs that it failed on another pull request's run lately.

red: web / Web status; base red: the same failure on the base 7e033f2; does not block
red: web / react-apps-base-check (2); no finished base run on 7e033f2 to compare; do not merge until green; see lane-rules
red: web / react-apps-base-check (3); no finished base run on 7e033f2 to compare; do not merge until green; see lane-rules
red: web / react-apps-base-check (4); no finished base run on 7e033f2 to compare; do not merge until green; see lane-rules
red: web / react-apps-check; base red: the same failure on the base 7e033f2; does not block

Gallery before/after for 5c87852: 16 states rendered, 0 images differ, 2113 more touched states not rendered. Images are in the run's artifact, not on this public PR.

gh run download 40632510985 -R manaflow-ai/cmux -n gallery-advisory-24259-5c8785209d3a2e558632c04b3d663d18e8da2b6a (then read gallery-review.json)

States
State Theme Status Diff Picked by
agent-pane.chat-find-bar/empty Apple System Colors Light unchanged 0% own conversation.css
agent-pane.chat-find-bar/empty Apple System Colors unchanged 0% own conversation.css
agent-pane.chat-find-bar/matches Apple System Colors Light unchanged 0% own conversation.css
agent-pane.chat-find-bar/matches Apple System Colors unchanged 0% own conversation.css
agent-pane.chat-find-bar/next-match Apple System Colors Light unchanged 0% own conversation.css
agent-pane.chat-find-bar/next-match Apple System Colors unchanged 0% own conversation.css
agent-pane.chat-find-bar/no-results Apple System Colors Light unchanged 0% own conversation.css
agent-pane.chat-find-bar/no-results Apple System Colors unchanged 0% own conversation.css
agent-pane.chat-width/standard Apple System Colors Light unchanged 0% own App.tsx
agent-pane.chat-width/standard Apple System Colors unchanged 0% own App.tsx
agent-pane.chat-width/wide Apple System Colors Light unchanged 0% own App.tsx
agent-pane.chat-width/wide Apple System Colors unchanged 0% own App.tsx
agent-pane.chat-width/wide-blocks Apple System Colors Light unchanged 0% own App.tsx
agent-pane.chat-width/wide-blocks Apple System Colors unchanged 0% own App.tsx
agent-pane.coderouter-offer/claude-key Apple System Colors Light unchanged 0% own TurnRows.tsx
agent-pane.coderouter-offer/claude-key Apple System Colors unchanged 0% own TurnRows.tsx
agent-pane.coderouter-offer/deepseek-key Apple System Colors Light unchanged 0% own TurnRows.tsx
agent-pane.coderouter-offer/deepseek-key Apple System Colors unchanged 0% own TurnRows.tsx
agent-pane.coderouter-offer/sign-in Apple System Colors Light unchanged 0% own TurnRows.tsx
agent-pane.coderouter-offer/sign-in Apple System Colors unchanged 0% own TurnRows.tsx
agent-pane.coderouter-offer/rate-limited Apple System Colors Light unchanged 0% own TurnRows.tsx
agent-pane.coderouter-offer/rate-limited Apple System Colors unchanged 0% own TurnRows.tsx
agent-pane.coderouter-offer/on-coderouter Apple System Colors Light unchanged 0% own TurnRows.tsx
agent-pane.coderouter-offer/on-coderouter Apple System Colors unchanged 0% own TurnRows.tsx
agent-pane.coderouter-offer/moving Apple System Colors Light unchanged 0% own TurnRows.tsx
agent-pane.coderouter-offer/moving Apple System Colors unchanged 0% own TurnRows.tsx
agent-pane.composer-floats/scrolled-to-end Apple System Colors Light unchanged 0% own App.tsx
agent-pane.composer-floats/scrolled-to-end Apple System Colors unchanged 0% own App.tsx
agent-pane.composer-floats/composer-grown Apple System Colors Light unchanged 0% own App.tsx
agent-pane.composer-floats/composer-grown Apple System Colors unchanged 0% own App.tsx
agent-pane.diff-panel/unified-narrow Apple System Colors Light unchanged 0% own conversation.css
agent-pane.diff-panel/unified-narrow Apple System Colors unchanged 0% own conversation.css

Pick other states with a Gallery: entry.id, entry.id/variant line in the PR body.

@blacksmith-sh

blacksmith-sh Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Found 52 test failures on Blacksmith runners:

Failures

Test View Logs
build_only must be a conjunctive exclusion on the helper, signing, and publication jobs
, and must not gate the unsigned app build/
build_only must be a conjunctive exclusion on the helper, signing, and publication jobs
, and must not gate the unsigned app build
View Logs
nightly.yml must derive the embedded key and sign every appcast through the helper/
nightly.yml must derive the embedded key and sign every appcast through the helper
View Logs
src/pages/settings/layout.test.ts/layout.test View Logs
src/pages/settings/layout.test.ts/layout.test View Logs
test/agent-pane-attach-huge-files.test.ts/agent-pane-attach-huge-files.test View Logs
test/agent-pane-attach-huge-files.test.ts/agent-pane-attach-huge-files.test View Logs
test/agent-pane-queue-scroll-bottom.test.ts/agent-pane-queue-scroll-bottom.test View Logs
test/agent-pane-queue-scroll-bottom.test.ts/agent-pane-queue-scroll-bottom.test View Logs
test/agent-pane-stream-jitter.test.ts/agent-pane-stream-jitter.test View Logs
test/agent-pane-stream-jitter.test.ts/agent-pane-stream-jitter.test View Logs

...and 42 more test failures. View all on Blacksmith: run 40632112089, run 40632112134

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

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6.1-sol, xhigh): BLOCK at 664a571

The merge resolution is correct, including the showToolRow/splitKey dependency change, and the earlier unused t issue is resolved. One visible correctness defect remains:

  • direct.ts:203-210 turns any numeric outputTokens into a truthy split, including an all-zero result. TurnTokens.tsx:37-49 then renders no token text for that split, but TurnRows.tsx:59-64 and TurnRows.tsx:206-211 add the separator based only on row.tokens, leaving a dangling · on a worked line or footer for an empty/zero-token turn_result.

An empty turn_result (outputTokens 0) made a truthy split that TurnTokens
rendered as nothing, leaving a dangling "·" on the Worked for line and the
turn footer. resultTokenSplit now drops an all-zero split, and both separators
use the same hasTokens check as the component.

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
@cursor

cursor Bot commented Oct 22, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6.1-sol, xhigh): SHIP at 0252905

Posted by the lane on the reviewer's behalf: the Codex reviewer (acpmux session tp-review-24259b on big-red) reached this verdict but could not comment (a GitHub 403 rate limit, then an expired gh token on that host). Its findings, verbatim:

  • The claimed repair is present at the new head: resultTokenSplit rejects all-zero results, hasTokens is shared by both token renderers and both separators, and the new zero-case markup test covers the prior defect.
  • The rest of the re-review found no additional correctness issue: state resets/rebuilds and usageFromSeq handling remain consistent, the merge resolutions and memo dependencies are intact, localization placeholders/catalog structure are valid, and the Rust/test values match the fake Claude probe.

Reds at this head, all also red on base:

  • cmux-next checks: Checks job structure and No fleet host names in gallery fixtures, both red on feat-cmux-next at 429668b (run 39746764759).
  • gallery health (2): agent-pane.composer#steer-read-hover waitFor timeout, the same failure as base run 39749219242 at 980cd70. This PR does not touch the composer.

@teamleaderleo teamleaderleo added the ready-to-land Reviewed at this head; next-autoland merges it into feat-cmux-next when its only reds are base reds label Oct 22, 2026
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Orphaned: no activity for 13 h, and no lane holds a lease on it. The orphan sweep could not merge feat-cmux-next in: conflicts in webviews/src/agent-session/acpmux/direct.ts. Listed for a lane to resolve.

# Conflicts:
#	webviews/src/agent-session/acpmux/direct.ts
@teamleaderleo
teamleaderleo temporarily deployed to cmux-tui-merge-tree October 23, 2026 03:29 — with GitHub Actions Inactive
The fake daemon never reports the session idle, so waiting on isWorking timed
out; wait for the turnSummary row the result adds instead.

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 temporarily deployed to cmux-tui-merge-tree October 23, 2026 03:35 — with GitHub Actions Inactive
# Conflicts:
#	webviews/src/agent-session/acpmux/conversation/TurnRows.tsx
#	webviews/src/agent-session/acpmux/conversation/WorkingFor.tsx
#	webviews/src/agent-session/acpmux/conversation/conversation.css
#	webviews/src/agent-session/acpmux/direct.ts
@teamleaderleo
teamleaderleo temporarily deployed to cmux-tui-merge-tree October 23, 2026 04:41 — with GitHub Actions Inactive
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

cmux-next guards / nightly-guards / workflow-guard-tests / release-notary is red on 19 of 20 fresh feat-cmux-next PR heads in the last 2:00:00, so it is most likely a base red, not this PR's. The base-reds lane has it; a base merge picks up the fix once it lands.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6-astra xhigh, next-review): SHIP at c4e7354

No blocking findings.

Tests were not run because the supplied snapshot lacks the full project and dependencies.

teamleaderleo and others added 2 commits October 27, 2026 20:53
Resolve against #25118 (turn count is output only): the running count and
"N out" fallback stay base's output-only `turnTokens`; the split's "in" and
hover detail come from the four counts base's acpmux already sends on each
marked call (inputTokens, cachedReadTokens, cachedWriteTokens, outputTokens),
so the separate `_meta.acpmux.tokens` object is dropped. Worked for tokens
from `turn_result` sit on a turn's Worked for when it is the turn's only one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-f68ebdd9a3c1704ffb42
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-f68ebdd9a3c1704ffb42
…okens land

The split's gap moves to the 8px step (check:design-tokens). A finished
turn's tokens sit on its Worked for only when that is the turn's one line;
tests cover one fold, several stretches and a steered turn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-f68ebdd9a3c1704ffb42
@teamleaderleo
teamleaderleo merged commit a3cf5fd into feat-cmux-next Oct 28, 2026
174 of 193 checks passed
@teamleaderleo
teamleaderleo deleted the tp/token-split branch October 28, 2026 05:30
@github-actions

Copy link
Copy Markdown
Contributor

The feat-cmux-next push run https://github.com/manaflow-ai/cmux/actions/runs/40638365379 at a3cf5fd failed: cmux-next fast tier (cargo).
Those jobs last passed at 8479514. This pull request is one of 2 merged since: #26484, #24259.
If the failure is in your change, fix forward on feat-cmux-next. Pull requests run only the tiers their paths reach (docs/ci/cmux-next-tiers.md); label a batch PR full-ci to run them all before merging.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

This branch had an error being deployed

1 failed (outdated) and 3 inactive (2 outdated) deployments
ci-routing-agent — 5c878520 Deployed Oct 28, 2026 by teamleaderleo via wait for same-key tree publisher #69412
sentry-dsyms — 6760d154 Deployed Oct 28, 2026 by teamleaderleo via upload cmux-tui dSYMs to Sentry #69224
artifacts — 6760d154 Deployed Oct 28, 2026 by teamleaderleo via publish to R2 #69224
cmux-tui-merge-tree — c4e73547 Deployed Oct 23, 2026 by teamleaderleo via publish the merge tree #5047
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-land Reviewed at this head; next-autoland merges it into feat-cmux-next when its only reds are base reds risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant