This repository was archived by the owner on Sep 4, 2026. It is now read-only.
fix(chat): space a run of tool rows as one block, prose as a new thought - #383
Merged
Conversation
ElbertePlinio
force-pushed
the
fix-367-run-density
branch
from
July 26, 2026 01:20
c536a65 to
9755fda
Compare
PR #366 landed two thirds of #367 — the dead 48px measured-row floor and the 2-3x-inflated compact estimates. It also took `--pf-chat-virtual-gap` from 12px to 4px globally, which fixed the run but left prose just as tight: every pair in the timeline was spaced identically, so nothing in the layout distinguished one burst of work from a change of subject. #367's own acceptance criterion — consecutive compact rows sit visibly closer than a row adjacent to prose — was still false, now from the other direction. `buildTimelineLayout` picks per pair: two adjacent compact rows get `--pf-chat-virtual-run-gap` (4px), any pair with a prose or card side keeps `--pf-chat-virtual-gap` (12px). 3:1 was chosen from rendered comparison against 8/4, where the boundary was only barely distinguishable from the run. Prose recovers exactly its pre-#366 breathing room; runs keep #366's log tightness. The rows themselves stay tight either way — that was the floor fix, not the gap. Compact means `command`, `toolUse`, `mcpToolCall`, `webSearch`, collapsed `thinking`, and the transient working row. Classification is kind-based on purpose: a row the reader expanded is still part of its burst, and keeping it kind-based keeps `buildTimelineLayout` pure. No grouping chrome. The `.pf-chat-line` rows already carry a shared left edge; at a 4px pitch those existing edges do the grouping, so a run-spanning rail would be new chrome for nothing — the standing rule is to reuse an edge that already exists. `applyRowHeights` is untouched: the gap choice lives entirely in the pure layout function, and the scroll-anchor path still compares the same starts before and after, so a row shrinking above the viewport compensates exactly as before. Adds a gated `agentChatToolRun` fixture (prose → thinking → six commands → tool/mcp/web → prose → usage), since the mock emitted no toolUse/mcpToolCall/ webSearch items at all and those rows had zero VRT coverage. Closes #367
ElbertePlinio
force-pushed
the
fix-367-run-density
branch
from
July 26, 2026 01:29
9755fda to
cf73805
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was left of #367
PR #366 landed two thirds of it: the dead 48px measured-row floor, and the compact estimates that were 2–3× their real heights. It also took
--pf-chat-virtual-gapfrom 12px to 4px globally.That fixed the run but left prose just as tight. Every pair in the timeline was spaced identically, so nothing in the layout distinguished a burst of work from a change of subject — #367's own acceptance criterion ("consecutive CMD/TOOL/MCP rows sit visibly closer than a row adjacent to prose") was still false, now from the other direction.
The decision
Two tiers, spacing only:
--pf-chat-virtual-run-gap--pf-space-xs(4px)--pf-chat-virtual-gap--pf-space-md(12px)3:1 was chosen from rendered comparison, not picked. At 8/4 the boundary was only barely distinguishable from the run at a glance; at 12/4 the burst reads unmistakably as one block and prose visibly opens a new thought.
Note this partially re-widens what #366 tightened — prose returns to exactly its pre-#366 gap. Calling that out rather than burying it: #366's real win was the floor and the estimates, which is why rows stay tight regardless; the global gap reduction was collateral, and it made prose pay for a problem that belonged to tool runs.
Compact =
command,toolUse,mcpToolCall,webSearch, collapsedthinking, and the transient working row. Classification is kind-based on purpose: a row the reader expanded is still part of its burst, and keeping it kind-based keepsbuildTimelineLayoutpure.No grouping chrome. The issue floated a shared left edge. The
.pf-chat-linerows already carry one, and at a 4px pitch those existing edges do the grouping — a run-spanning rail would be new chrome for nothing, against the standing rule to reuse an edge that already exists.Scroll safety
applyRowHeightsis untouched — it carries the standingTODO(#263)complexity exemption and #366 just did delicate work there for #352. The gap choice lives entirely in the pure layout function, and the anchor path still compares the samestartsbefore and after, so a row shrinking above the viewport compensates exactly as before.Coverage this adds
tauriMockemitted notoolUse/mcpToolCall/webSearchitems at all, so those rows had zero VRT coverage. Adds a gatedagentChatToolRunfixture — prose → thinking → six consecutive commands → tool/mcp/web → prose → usage — and a VRT assertion that compares gaps by bounding box, so it pins the density independently of any baseline.Validation
bun run test:unit— 115 files, 1570 passedbunx tsc --noEmitclean,bun run lintclean (incl.check-design-tokens)buildTimelineLayoutto the uniform gap fails the three new layout tests; removingthinkingfrom the compact set fails the classification testVRT baselines will legitimately change and need the
update-vrt-baselinesworkflow; the newagent-chat-tool-runbaseline comes from there too.Open decisions carried forward
usagetreated as not compact, so a turn's token/cost receipt takes the wider distance after the last row. Low-confidence taste call; hugging the turn at 4px is defensible.Closes #367