Skip to content

fix(shot): restore the desktop capture harness and add session-usage scenarios - #727

Merged
huichen merged 1 commit into
mainfrom
fix/shot-usage-capture
Sep 19, 2026
Merged

huichen merged 1 commit into
mainfrom
fix/shot-usage-capture

Conversation

@huichen

@huichen huichen commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

Why

The desktop capture harness stopped working when the Agent readiness gate landed (#725): the mock has no get_agent_status, useAgentStatus received null and threw while rendering, and the app stayed on its splash forever. Every desktop capture failed with the opaque cdp: app not ready after 45000 ms: !!document.querySelector('[aria-label]') — the mock's own [mock] UNHANDLED COMMAND line was the only clue, buried in the console. While fixing that, the session token/amount surfaces added in #726 turned out to have no scenario at all, so the feature could not be photographed.

What changed

Harness fix

  • Answer get_agent_status from the demo build info, so the desktop app leaves its splash.
  • Add a troubleshooting row (both languages) naming this failure mode, since a null-returning unknown command produces a stuck UI rather than a visible error.

New scenarios

  • Desktop: thread-usage (header amount + the breakdown dialog), thread-usage-unpriced (a model with no prices on file) and custom-model-prices (the provider form's price fields, scrolled into view via eval + asserted).
  • Mobile: usage-sheet and usage-sheet-unpriced (top-bar amount → bottom sheet). Driven by an eval click with an assertion, because taps are unreliable under the mobile emulation and a sheet that never opened would otherwise still "pass".

Demo data

  • Give the demo sessions a session usage whose rows are exact at the four decimals the dialog shows and add up to the total, so a rounded row never looks like an off-by-rounding bug; give the demo custom provider rates. The chat-mode conversations stand in for the unpriced case.

Small app change

  • Give the header amount an accessible name. It was announced as a bare "¥1.0904", and without a label the harness can only reach it by its visible text (which changes every time the amount does).

Checks

  • Worktree end-to-end: capture-desktop thread-usage thread-usage-unpriced custom-model-prices → 3/3 captured, every step reached its target.
  • Desktop: tsc --noEmit, eslint src shot, vitest run src/features/agent src/integrations/agent (516 passed).
  • Mobile: eslint shot src/features/chat src/i18n, jest src/features/chat src/i18n (278 passed).

…scenarios

The desktop harness stopped working when the Agent readiness gate landed: the
mock had no `get_agent_status`, so `useAgentStatus` received null and threw
while rendering. The app sat on its splash forever and every desktop capture
failed with the opaque `cdp: app not ready after 45000 ms`. Answer the command
from the demo build info and note the failure mode in the troubleshooting
table — a null-returning unknown command turns into a stuck UI, not a visible
error, so the console's `[mock] UNHANDLED COMMAND` line is the thing to look
for.

Capture the session token/amount surfaces that had no scenario yet:

- desktop `thread-usage` (header amount + the breakdown dialog),
  `thread-usage-unpriced` (a model with no prices on file) and
  `custom-model-prices` (the provider form's price fields, scrolled into view);
- mobile `usage-sheet` and `usage-sheet-unpriced` (top-bar amount → the bottom
  sheet, driven by an `eval` click and asserted, since taps are unreliable
  under the mobile emulation and a missing sheet would otherwise still "pass").

Demo data: give the demo sessions a session usage whose rows are exact at the
four decimals the dialog shows and add up to the total (so a rounded row never
looks like a bug), and give the demo custom provider rates. The chat-mode
conversations stand in for the unpriced case.

The header amount is the entry point to the dialog, so give it an accessible
name — it was announced as a bare "¥1.0904" before, and without it the harness
can only drive the control by its visible text.
@huichen
huichen enabled auto-merge (squash) September 19, 2026 12:48
@huichen
huichen merged commit 3d68384 into main Sep 19, 2026
12 checks passed
@huichen
huichen deleted the fix/shot-usage-capture branch September 19, 2026 12:50
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