Skip to content

fix(mobile): one rail for step rows, revealed file names, self-loading inline images - #660

Merged
huichen merged 3 commits into
mainfrom
claude/mobile-step-align-fix
Sep 16, 2026
Merged

huichen merged 3 commits into
mainfrom
claude/mobile-step-align-fix

Conversation

@huichen

@huichen huichen commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Device feedback on the folded step line (#656, #657, #659), fixing four things.

1. Every step row is on one rail (the alternating sides)

A row took an align prop with a left-aligning default that the folded run overrode. Any row that was not folded — a lone call, a lone burst, the slice still running — therefore stayed on the left while folded runs sat on the right, so the reply alternated sides down one screen, and a streaming row jumped sides the moment it got folded.

Rather than pass the prop everywhere, it is gone: each step block declares its rail itself, so no call site can disagree. The live run indicator moved too, instead of hanging off the left edge of the reply.

2. Opening a file tool showed no file name

The name was in the render tree all along, but the labelled row is a shrink-wrapped badge on the right rail and the target asks for flex: 1 (flexBasis: 0) — with no leftover width to claim it resolved to zero and rendered nothing. This was a regression from the right-alignment change.

Fixed by rendering the target only in a full-width row (see 3). Read / write / edit all share this ToolRow path (only shell renders its command underneath), so all three were affected and all three are covered by tests, including a burst's child file names.

3. Opened rows read left-to-right, like the prose

A step row is a badge on the right rail only while nothing of it is revealed. Once it — or the run around it — is open, it is content being read, and right-aligned prose and commands are hard to read.

collapsed:  🔧×5 · 🧠×3 ⌄                    ← badge on the rail
opened:     🧠 已思考 ⌄
            │ 先确认 agent 是否有 compact 子命令…   ← reading column
            📄 已读取 ⌄   agent/src/config.rs
            ✎ 已编辑 ⌄   semantic.rs

opened is a required prop, not a defaulted one — that is precisely how bug 1 happened.

4. Inline images load themselves, in replies and previews

An image written into the Markdown is part of the document the user opened, so a per-image tap was taxing the common case. Both call sites wanted it on, so the auto-load flag and its context are removed rather than left as dead configuration.

This surfaced a latent bug: the loader had a "bail out while a transfer is pending" guard, so several images starting at once would leave every image after the first unloaded. Transfers now queue — one at a time (that guard's real purpose: not stacking native cellular dialogs), but nothing is dropped. A per-mount guard keeps a streaming re-projection from re-requesting on every delta.

Not changed: the size/network guard. A large transfer on an unknown or cellular network still asks first, because that guard is about cost, not about permission to read.

Tests

  • TimelineCard.test.ts — 24 cases. New: an unfolded row sits on the same rail as a folded run; every step row extends its touch area beyond its drawn line; the live indicator's rail; opened rows fall back into the reading column; read/write/edit each reveal their file name; a burst lists every child file name.
  • MarkdownImage.test.ts — 16 cases. New/changed: reply images and preview images both self-load; a failed auto-load offers retry; a streaming re-projection does not re-request; session changes cancel and never show stale bytes.
  • Two of these caught real defects while being written: inlineThinking was missing alignSelf (the reasoning block stayed full-width with its rail stranded at the screen edge) and toolDetailText still carried the old left indent with no alignment, mis-placing a shell command by 20px.

Local (mobile-scoped): npm run typecheck ✅ · npm run lint ✅ · npm test — 97 suites / 1364 tests ✅

… summary

Five follow-ups from reviewing the folded step line on device:

- A step row no longer takes an `align` prop. It had a left-aligning default
  that the folded run overrode, so an unfolded row (a lone call, a lone burst,
  the slice still running) stayed on the left while folded runs sat on the
  right — the reply alternated sides down one screen, and a streaming row
  jumped sides the moment it got folded. Every step block now declares the rail
  itself, so no call site can disagree.
- `inlineThinking` was missing `alignSelf`, leaving the reasoning block
  full-width with its rail stranded at the screen edge; `toolDetailText` still
  carried the left indent and no right alignment, which mis-placed a shell
  command by 20px. Both surfaced by the new tests.
- Step rows and the live run indicator are real touch targets again: the drawn
  line stays 20px but `hitSlop` reaches ~40px, since the row is the only way
  into the call behind it.
- The live run indicator follows the apparatus onto the right rail instead of
  hanging off the left edge of the reply.
- The summary's gap drops to 4px: the counts are one cluster, and 8px either
  side of the `·` read as holes once the glyphs were pulled flush.

Tests: 20 cases in TimelineCard.test.ts, four of them new regressions (unfolded
row rail, touch target, run-indicator rail) plus the tightened gap.
…-load inline images

Three pieces of device feedback:

- Opening a file tool showed no file name. The name was in the tree, but the
  labelled row is a shrink-wrapped badge on the right rail and its target asks
  for `flex: 1`, which resolves to zero width when there is no leftover space to
  claim. The target now only renders in a full-width row (below), and a test
  pins it for read/write/edit and for a burst's children.
- Opened rows fall back into the reading column. A row is a badge on the right
  rail only while nothing of it is revealed; once it — or the run around it — is
  open it is content being read, and right-aligned prose and commands are hard
  to read. `opened` is a required prop, so a call site cannot silently pick the
  wrong rail (that is how unfolded rows ended up on the left while folded ones
  sat on the right).
- Inline images in a reply body load themselves. An image the agent put in its
  answer is part of what the user asked to read, and a per-image tap taxed the
  common case. Transfers now queue instead of the previous "bail out while one
  is pending" — that guard would have left every image after the first unloaded
  now that several start at once. The size/network guard is untouched, so a
  large transfer on cellular still asks first, and a document opened in the
  preview modal still loads its images on tap.
A file preview now behaves like a reply body: an image written into the Markdown
is part of the document the user opened, so it loads without a per-image tap.
The auto-load flag had exactly two call sites and both now want it on, so the
context and its plumbing are gone rather than left as dead configuration.

The size/network guard in the loader is untouched: a large transfer on an
unknown or cellular network still asks first, because that guard is about cost
rather than permission to read.
@huichen
huichen enabled auto-merge (squash) September 16, 2026 08:59
@huichen
huichen merged commit ddf50bf into main Sep 16, 2026
12 checks passed
@huichen
huichen deleted the claude/mobile-step-align-fix branch September 16, 2026 09:01
huichen added a commit that referenced this pull request Sep 16, 2026
… their own line (#671)

Two things had to be true at once, and the last change bought the second by
giving up the first: a revealed file name needs the row's leftover width, and a
row that shrinks to a right-rail badge has no leftover width to claim. Inline,
the target's `flex: 1` therefore resolved to zero inside the badge — the file
name was invisible — so #668 parked every row in the left reading column and
left the revealed target inline.

Put the target on its own line below the header and the conflict disappears. The
header goes back to a one-liner with nothing to wrap, so the row can shrink-wrap
again, and the target gets the full width at its own indent: names wrap instead
of being clipped, and the chevron stops landing mid-sentence between the label
and the path. Shell commands already worked this way; file targets now use the
same line, which also removes the separate `inlineToolTarget` style.

With the geometry free again, the rails from #659/#660 come back: a row is a
badge on the right rail while nothing of it is revealed, and falls into the
reading column once it — or the run around it — is open. The run summary keeps
its rail when it opens, so the line under the user's finger does not move while
the rows it revealed appear below it on the left. `opened` is a required prop
again, so no call site can pick a rail by accident.

Tests: the rail assertions from #660 are restored (folded summary and lone rows
on the rail; opened rows and their detail off it), together with #668's
no-truncation assertions, plus a check that the revealed target is a line of its
own rather than a cell beside the label.
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