Skip to content

Keep margin thread reading stable after a streaming interjection - #4865

Merged
leaf-agent merged 13 commits into
mainfrom
repro/issue-4863
Nov 1, 2026
Merged

leaf-agent merged 13 commits into
mainfrom
repro/issue-4863

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Keep a margin thread's messages at their reading position when more words arrive after the user sends an interjection. The card grows down while retaining the transcript's existing scroll travel, and follows its tail after fitting. The reproduction keeps classic scrollbars explicit and preserves its original stability assertions.

Send can legitimately leave earlier lines scrolled away: the failing baseline has 320px of content in a 309px transcript, at scrollTop: 11. Previously, arriving tokens expanded the transcript to its full content height, clamping that scroll to zero and moving every message down 11px. Fitting now retains the reading taken before the update. The placement owner supplies whether the attachment moved, and CardAnchor supplies whether the user is writing, so scrolling into more room and growing a draft retain their existing behavior. Newer input invalidates an earlier saved reading.

The on-screen states covered are the card immediately after Send, arriving words after that interjection (accepted and pending), reading back through a longer answer, a card gaining room after page scrolling, and the next draft. A catalogue state also exercises an interjection and arriving progress through the delivery contract. Its before/after captures are unchanged at rest; the streaming regression checks message positions across captured frames. The kernel is rebuilt.

Validation: 11 focused margin-card cases, both pending-reply smoke cases, and all 717 runtime tests pass. pnpm run check:browser and the changed files' pre-commit checks pass. The two streaming cases failed before the runtime repair with the recorded 11px movement. Current main is merged into this branch.

Startup comparison against main on review-a-plan: both arms load 36 requests through widget upgrade and first state presentation; the repair adds 691 code bytes, with no console errors or recorded layout shifts. The added code preserves the reading during live card fitting; it adds no startup requests.

Closes #4863

Exercise the streaming-interjection test with a scrollbar that takes room on every host, and include transcript scroll, content height, viewport height and gutter width in its failure. Both accepted and pending cases still fail on current main: the first token update clamps scrollTop from 11 to 0 as the transcript grows to fit its contents, moving every message down 11px while the card stays at 8px. This is a reproduction, not a repair; the reading-stability assertion remains intact.

Refs #4863

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runtime repair remains the merge blocker, as the description states. Both focused cases (accepted and pending) fail at append_tokens(8): message tops move from [10, 111, 191] to [21, 122, 202] while the card stays at 8px and transcript scrollTop clamps from 11 to zero. This confirms the reproduction, but leaves the reading-stability failure in #4863 unresolved. Withholding the merge verdict until that repair is included.

@leaf-agent leaf-agent changed the title test: reproduce transcript jumps after Send with classic scrollbars Keep margin thread reading stable after a streaming interjection Oct 31, 2026
# Conflicts:
#	dist/kernel/kernel.json

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current head fails test because check:browser reports a stale dist/kernel/kernel.json. I reproduced that failure locally; rebuilding changes the vendored chunk paths and hashes in the manifest, and the browser build check then passes. I’m applying that generated-file repair on this bot-authored branch before handing the new head to its queued review.

@leaf-agent
leaf-agent merged commit 7b9b550 into main Nov 1, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the repro/issue-4863 branch November 1, 2026 01:57
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.

Streaming tokens can move the transcript after a pending reply

1 participant