Skip to content

fix(chat): persist follow intent before session or project navigation - #1916

Merged
vastsa merged 65 commits into
vastsa:mainfrom
new-Beginner:fix/live-transcript-bookmark
Oct 28, 2026
Merged

vastsa merged 65 commits into
vastsa:mainfrom
new-Beginner:fix/live-transcript-bookmark

Conversation

@new-Beginner

Copy link
Copy Markdown
Contributor

Summary

  • Persist explicit return-to-latest intent synchronously, before smooth scrolling can yield to an immediate session/project switch.
  • Preserve intentional history reading and search isolation; do not force every returning chat to the bottom.
  • Extend the real Electron regression to cover retained hide/reveal and actual pane unmount/remount with background output, including follow position and Running/Stop consistency.
  • Synchronize interaction and E2E specifications.

Root cause

Current upstream already includes restored-history continuation and live-tail status fixes. A remaining race exists in jumpToLatest: the local pinned ref is updated immediately, but the renderer-lifetime bookmark can remain unpinned until a native scroll event. Navigating in that gap restores the stale reading bookmark. Calling the existing rememberReadingPosition callback before scrollToBottom persists explicit follow intent without changing history ownership or persisted formats.

The new regression failed on the old implementation with: return to latest must synchronously replace the old reading bookmark. It passes with this fix.

Validation

Task candidate: 69fba16
Base main: 5aa2538
Environment: isolated request worktree on Windows; existing compatible external dependencies reused; fresh workspace dependency and Desktop builds. No live user Desktop/provider testing.

  • 85/85 targeted Node tests (transcript reading, reveal ownership, reading-position fallback, scrolling, disclosure reading, search focus, session panes).
  • Desktop TypeScript check and fresh electron-vite build.
  • Style-token checks and Biome lint (131 files); git diff --check.
  • node scripts/e2e-transcript-reading-position.mjs (all four probes).
  • node scripts/e2e-transcript-minimap-jump.mjs.
  • node scripts/e2e-transcript-disclosure-anchor.mjs.
  • Latest origin/main ancestry and PR base check.

The reading-position harness process watchdog increases from 45s to 90s: the unmodified upstream four-probe suite exceeded 45s on this host but passed in about 58s with a diagnostic extended budget. Assertions and wait conditions are unchanged.

Full monorepo/Rust suites were not run because this change is limited to renderer scrolling and its isolated test harness. No dependency, protocol, persistence, release-version, or security-boundary changes.

Seraph-x and others added 22 commits October 22, 2026 21:25
Remote project identities are not local paths. Route plugin directory and
classified preview reads through a separate owner-only Host service that
preserves scope, canonical containment and credential protections.

Capture workspace admission before awaiting and reject stale bindings or
unloaded plugins, including legacy SDK calls. Keep older Hosts compatible
with existing remote operations and report missing preview support clearly.

Refs vastsa#1711
Include the upstream tool-identity and Gemini Live fixes that landed after
the remote file candidate was published. Preserve the shared branch history
and validate the combined tree before updating the pull request.

Refs vastsa#1711
Include the maintainer's newly merged notification changes without altering
them. Validate the remote file candidate against this updated upstream tree
before publishing the branch update.

Refs vastsa#1711
Keep the remote Host file service within the same per-directory result limit as local plugin reads. Share the limit through the SDK so the two implementations cannot drift, and cover the boundary with a large-directory regression.
Default remote-file acceptance to the shipped plugin and record the
loaded directory, so a passing development-plugin run cannot stand in
for a completed bundled update. Keep the paired release gate explicit
in both delivery specifications.

Repair the two CI test assumptions exposed by the updated integration
candidate: permit attributes on the main pane and supply the WebSocket
close reason at the transport fixture boundary.
Preserve the upstream window stacking correction while preparing the
remote File Manager delivery. Validate the resulting integration state
without rewriting the shared contributor or maintainer commits.
Refresh the paired File Manager delivery against the current target
branch, keeping the original contributors' file-reference and activity
disclosure repairs intact. Revalidate the affected boundaries and
plugin journey on the combined candidate without rewriting history.
Preserve both ADR entries when integrating current main so the scoped
remote-file repair remains reviewable alongside the AskTool draft fix.

Initialize the newly required draft map in the existing restoration test
fixture; production state already supplies it. Keep the original
restoration assertions and timeouts intact.
Keep the remote-file candidate current with the newly merged empty-reply
persistence repair without changing its production implementation.

Supply the new completion-notice dependency in two existing persistence
test fixtures so terminal and shutdown regression checks continue to
exercise the original assertions.
Main now filters every empty assistant row unless it carries a tool, a
structured error, accepted steering or a trusted completion reply. The
older source assertion still required the removed failed-status clause.

Keep the complete new exclusion guard in the regression assertion and
retain the executable structured-error persistence checks. Integrate the
latest marketplace repair without altering its production behavior.
…date

Keep the remote-file candidate current with the accepted tab-close repair
and its geometry regression. Preserve the upstream implementation and
both branches of the documented acceptance scenarios.
Two Linux certificate preflights stopped after the expected baseline with
no indication of which later operation hung. Log each probe and cleanup
phase so another failure identifies the pending operation directly.

Keep every TLS, proxy, redirect and cancellation assertion and the
existing deadlines intact. Integrate the current upstream tool-abort
repair while retaining shared history and its production implementation.
Assertions in HTTPS and proxy event callbacks escape the scenario catch.
Electron then opens its default error dialog, hiding the assertion and
blocking the probe until the outer process deadline kills it.

Report uncaught fixture errors and exit with failure so Linux CI exposes
the actual assertion. A real Electron fault-injection comparison reproduces
the blocked dialog before this change and visible exit code 1 afterward.
The tool-abort repair moved detached Bash exclusion into the process
cancellation branch. The older source assertion still expected the
previous outer conditional and failed despite preserving that exclusion.

Assert the current local-background None branch and registration path.
Include exact viewport measurements when the unchanged long-history
reader-position assertion fails, so Linux failures are diagnosable.
Preserve the upstream test corrections and browser lifecycle changes
while retaining the scoped remote workspace read implementation and
its ADR entry. Drop a duplicate AskTool fixture field from the merge.

The refreshed candidate passes targeted Desktop regressions, scoped
protocol and plugin checks, workspace builds, and Desktop typecheck.
Local Electron acceptance is not run because its runtime is missing;
the paired plugin release and shipped bundle update remain pending.
The newly merged visualization feature appended its acceptance scenario
at the same location as remote File Manager coverage. Keep both sections
intact while incorporating the current main without rewriting history.

Preserve all upstream runtime changes and the paired-release blocker.
The refreshed candidate passes targeted Desktop and runtime regressions,
shared contracts, builds, typecheck, and static documentation checks.
A bare /quota/ match classified spending, credit, billing, and disk
exhaustion as PROVIDER_RATE_LIMITED. The runtime then backed off and
retried failures that cannot recover. Keep insufficient_quota and real
throttle wording retryable, and mark those account and filesystem
quotas terminal.
The Host route alone leaves the shipped panel on local filesystem reads.
Bundle the pinned companion consumer as an explicitly identified Desktop
hotfix, retaining the accepted search-theme repair and source provenance.
Its version supersedes stale installed copies without claiming publication.

Exercise the actual bundled process and view, including real remote bytes,
stale-workspace rejection, read-only controls and restored local saving.
Integrate current main and retain the pending official-release requirement.

Refs vastsa#1711
Record return-to-latest intent before smooth scrolling can yield to a
session or project switch. Otherwise the old unpinned bookmark can win
on reveal or remount, stranding a running conversation in history.

Cover retained and remounted panes with the real renderer path, preserve
manual reading ownership, and give the four-probe fixture a bounded
budget suitable for hidden Windows frames.
The Linux CI probe hung after its baseline while the same fixture passes\non Windows and the upstream base. Identify each network and teardown\nphase without changing assertions, request budgets, or production code.

@muzimu217 muzimu217 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Checked the call chain this depends on, and the ordering in jumpToLatest is the load-bearing part — it is correct.

remember() in apps/desktop/src/hooks/use-transcript-reading-position.ts:59-65 captures through captureTranscriptReadingPosition(scroller, content, pinnedRef.current, windowSize), so it records pinned: true only because pinnedRef.current = true is set on the line before the new call. It also bails out when pendingRef.current is set, and that is already cleared by cancelReadingPosition() at the top of the same callback — so calling rememberReadingPosition() between setShowJump(false) and scrollToBottom(...) is the one position where it records follow intent rather than being skipped. Moving it after scrollToBottom would record a mid-animation offset; moving it before pinnedRef would record pinned: false.

The reveal path also agrees with it: use-transcript-reading-position.ts:40-53 treats a stored pinned: false as authoritative on reveal, and leaves a pinned: true bookmark to the normal follow. So the fix does not need a second flag — the existing bookmark already carries the distinction.

One thing worth keeping in mind for the e2e: the probe now covers a project switch that genuinely unmounts the pane, which is the case that previously slipped through because the native scroll event never fired. The 45s → 90s budget is fine, but a four-probe process at 90s will mask a hang as a timeout rather than a failure; the assertion output is printed on non-zero exit, so the diagnosis stays possible.

xpeng5278-web and others added 27 commits October 28, 2026 09:59
…tting surrogate pairs (vastsa#1939)

The cap was measured in UTF-16 code units, then the slice kept that many
code points. Emoji and other supplementary-plane characters are two units
each, so truncated Bash progress stayed about twice the cap and every later
chunk was cut again from that oversized string.

Spend the same head/tail budget in code units and drop a code point that
does not fit, so a surrogate pair is never split.

Co-authored-by: xpeng5278-web <[email protected]>
Co-authored-by: Lan <[email protected]>
…sistants (vastsa#1937)

Degraded delegate context skipped failed assistants but only stripped a
leading prefix of tool results. A kept message in front of that result
left the provider an unmatched tool result. Filter the suffix with the
same orphan rule as compaction tails, and leave tool calls on retained
assistants in place.

Co-authored-by: xpeng5278-web <[email protected]>
Co-authored-by: Lan <[email protected]>
The shared Todo/background-task container derived its presence, its live
count, and its header count from every registry entry the session had
ever produced, not from the rows it could render. host-core keeps a
finished task so its output and exit code stay readable, so a stopped or
self-exited command left a permanent "1 background tasks" header above
the composer with no row to stop, dismiss, or read -- while the spec
already says a container with nothing to show renders nothing.

Gate and count on the renderable rows instead, and let the tab and badge
rules read that same description so a task that already left the
container cannot decide which panel is on screen.

Co-authored-by: Lan <[email protected]>
)

* fix(session): restore running state when the window reopens

A recreated renderer missed the turn's start event, so bootstrap restored
older completion notifications without knowing that Main still owned a
running turn. Include Main's live session IDs in the existing session-list
response and restore them before publishing the shell.

Keep start/end events received during bootstrap authoritative over that
snapshot. Cover the IPC snapshot, bootstrap races, session selection and
the real Sidebar across recreated Electron windows.

Fixes vastsa#1912

* test(session): isolate running snapshot compatibility

The compatibility case needs an empty running-state baseline so earlier bootstrap cases cannot leak into its assertion.

---------

Co-authored-by: Lan <[email protected]>
Co-authored-by: vastsa <[email protected]>
…a#1914)

Git stdout can split a filename in the middle of a UTF-8 character.
Decoding each Buffer independently corrupted those names in the cached
workspace index, so file mentions and searches could no longer find them.

Decode stdout as a continuous UTF-8 stream. Cover split two-, three-, and
four-byte characters through the index and search APIs, and document the
filename preservation contract.

Exercise Unicode file selection in the real renderer. Offscreen painting
lets its hidden Windows fixture advance the animation frames it awaits.

Co-authored-by: Lan <[email protected]>
…es (vastsa#1922)

* fix(desktop): avoid appending archived revision roots

fixes vastsa#1870

* fix(desktop): keep unloaded revision acknowledgements out of cache

---------

Co-authored-by: Lan <[email protected]>
…keys (vastsa#1935)

* fix(agent-runtime): collapse dot and duplicate segments in path-lock keys

normalizeLockPath only stripped one leading ./, so spellings such as
src/./a.ts, src//a.ts, and src/foo/../a.ts took different PathMutex keys.
Write/Edit and a parallel Read could then overlap on one file, and the
edit-recovery budget only holds if same-path attempts stay ordered.

Collapse segments lexically. Keep a relative .. and a Windows drive, and
do not let .. pop a delegate worktree id out of a worktreeKey\0path key.

* fix(agent-runtime): clamp absolute paths at root

Absolute paths cannot climb above their filesystem root. Keep root and drive-root aliases on one mutex key so equivalent writes and reads remain ordered.

---------

Co-authored-by: xpeng5278-web <[email protected]>
Co-authored-by: Lan <[email protected]>
Co-authored-by: vastsa <[email protected]>
Users judging what a turn produced had to count the per-call review
rows scattered through its process. A finished reply now carries a
read-only "Changes this turn" card (issue vastsa#1891, design 10) built only
from the turn's message-owned review records: one row per path with
merged status and counts, relaxed rows up to four files, dense rows
past that, and a +N more fold after twelve. Rolled-back files stay
listed and struck through.

A row opens the existing Review tab scrolled to that file with its
change expanded, through a transient renderer focus request instead
of new app-store state. The card mounts with the reply slots, so it
never grows while streaming and entryExtra blocks stay beneath it.
No capture, IPC, persistence, or host-core change (D674).
* fix(chat): send a queued follow-up with the steer shortcut

A follow-up queued while the turn is running leaves the composer empty, so
Alt+Enter found no draft and silently did nothing: the only way to promote
that row was its Send now button. With an empty composer the shortcut now
promotes the first waiting row through the same store action, so keyboard and
pointer reach the same Host delivery path.

Rows still awaiting Host admission and already promoted rows are skipped, a
visible draft keeps taking precedence over the queue, and a blocked composer
promotes nothing.

* docs(spec): point the queue section at the steering shortcut

Readers of the Send now rules should not have to reach §3.5 to learn that the
keyboard equivalent exists.

* docs(spec): state that the queued send shortcut ignores steering capability

The empty-composer shortcut mirrors the row's Send now, which is not gated
on canSteer; the Host decides delivery. Say so, so the spec does not read as
if the shortcut only works where steering is available.

* test(composer): exercise queued steer submission

Exercise the submit hook through its public boundary so the shortcut behavior is proven for empty, blocked, and populated drafts.

---------

Co-authored-by: Lan <[email protected]>
Co-authored-by: vastsa <[email protected]>
…rds (vastsa#1928)

* fix(settings): give model-provider and plugin rows their own busy guards

The models page and the plugins page ran their row-keyed async operations
through single shared busy slots — busyId, testingId and reloadingId —
with unconditional finally clears and, on the models page, no entry guard
at all. The first request to settle re-armed every row still in flight
(a second click double-fires the host write from an optimistically
flipped state), and the models list-wide busy gate froze all rows for
one row's operation.

Both pages now claim one independent key per row through the use-row-busy
guard introduced for the capability pages (vastsa#1881): toggleEnabled,
removeProvider, saveProviderKey and testProvider on the models page;
confirmReview, runInstall and reloadPlugin on the plugins page. The
plugins page model exposes isPluginBusy(id) instead of the busyId slot,
and the models list keeps only its modal-dialog terms in the page-wide
gate.

* test(plugins): pin the marketplace install gates to the per-row busy predicate

plugin-runtime-risk asserted the marketplace/detail install buttons
through the removed single busyId slot; the guard job moved to
isPluginBusy in the parent commit, so the pins follow the predicate.

* fix(settings): keep provider test spinners independent

Track active provider tests by row so one settled request cannot clear another row's in-flight indicator. Cover the page-to-list wiring with a regression check.

---------

Co-authored-by: Lan <[email protected]>
Co-authored-by: vastsa <[email protected]>
vastsa#1933)

The probe's proxy asserts that every tunnel it sees targets the fixture, but
Chromium's own component updater reaches the configured session proxy while the
probe is installed. On a cold CI runner that CONNECT arrives at an unrelated
moment — a gvt1.com CDN host in the failing run — and the assertion fired
through the probe's uncaughtException path even though every probe step had
already been logged green.

A CONNECT for any host but the fixture is now refused with 502 and never
counted, so `tunnels` keeps measuring fixture traffic only, and a self-check
asserts that refusal instead of relying on the runner staying quiet.

Co-authored-by: vastsa <[email protected]>
…astsa#1930)

* fix(plugin-view): follow the app type scale in docked plugin pages

A `contributes.views` page is its own webContents, so neither the renderer's
`--font-scale` nor the window zoom reached it. The bundled Browser and Files
panels kept author-sized 12/13px chrome while the app around them grew, so the
two never looked like one product at any font-size setting.

The host now republishes the Appearance multiplier (times the window zoom) as
the docked page's own zoom, re-applies it to every fresh document, and rescales
live views in place so plugin state survives. `pi.browser` measures its guest
hole in the chrome page's CSS pixels, so the guest rect is converted with the
same factor and a website keeps filling the area the toolbar leaves. Detached
plugin windows and widgets keep their own base size; they are their own windows
rather than surfaces composited inside the app.

D343 / ADR 0180 introduced the global type scale for the app document only.

* fix(e2e): ignore Chromium background CONNECTs in the certificate probe

The probe's proxy asserts that every tunnel it sees targets the fixture, but
Chromium's own component updater reaches the configured session proxy while the
probe is installed. On a cold CI runner that CONNECT arrives at an unrelated
moment — a gvt1.com CDN host in the failing run — and the assertion fired
through the probe's uncaughtException path even though every probe step had
already been logged green.

A CONNECT for any host but the fixture is now refused with 502 and never
counted, so `tunnels` keeps measuring fixture traffic only, and a self-check
asserts that refusal instead of relying on the runner staying quiet.

---------

Co-authored-by: vastsa <[email protected]>
Malformed provider calls could survive in live context and make every
later Continue fail during local preflight. Reject malformed batches
before execution and repair only the model-facing history projection.

Keep completed tools and durable transcripts intact, and ensure optional
usage estimation cannot suppress terminal tool events. Cover repeated
manual continuation through the real loop and offline sidecar transport.

fixes vastsa#1941
A 1.89 MB, 780 x 14182 full-page screenshot passed every byte bound,
was persisted by Read, and the provider rejected it with a
non-retriable 400. Every later request replayed it, so the session
could never continue, even after a restart (vastsa#1913).

Read image headers (PNG, JPEG, GIF, WebP) without a decoder and refuse
to inline an image whose longest edge exceeds 8000 px: host Read fails
with a message naming the size, prompt attachments and restored history
take the existing @path fallback, and convertToLlm replaces any
remaining oversized image block with a text notice so poisoned
sessions recover. The same bytes always produce the same notice, so
prompt caching stays stable. Unknown dimensions keep the byte-only rule.

Fixes vastsa#1913
Refresh the published recovery candidate against current upstream main
without rewriting the shared branch before validation.
Keep the localized specification mirror and E2E table shape aligned
with the authoritative recovery contract so documentation gates cover
the same scenario in both locales.
Provider billing and account exhaustion can arrive as HTTP 429 and use
the insufficient_quota type. Classify explicit exhaustion before the
generic 429 retry path while preserving retries for throughput limits.

Add classifier and retry-flow regressions and sync the runtime specs.
…isclassify

fix(agent-runtime): do not treat billing or disk quota as rate limit
After a long reply the reader is left at its last line and has to
scroll back up to find where the answer began (vastsa#1889). When a turn
completes while the transcript is visible and still following the
stream, the turn's prompt now scrolls to just below the titlebar band
and follow mode is released, so jump-to-latest is offered.

The view stays put when the reader had scrolled away, the prompt is
already in view, the reply failed or was aborted, the pane is hidden or
in a reading window, a disclosure position is held, or a queued
follow-up starts before the move. The logic lives in a small lib module
and a hook beside useTranscriptScroll rather than in that hook itself.

Closes vastsa#1889
…recovery-upstream-20261028

Merge the malformed tool-call recovery fix after verification on the latest main base.
A return-to-latest click is explicit follow intent. Persist it before smooth scrolling can yield so session and project navigation cannot restore a stale reading bookmark. Preserve the current stream-completion behavior and E2E coverage.

@vastsa vastsa left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The regression is real: an explicit return-to-latest click sets the live follow ref, but without persisting the pinned bookmark before the asynchronous smooth scroll, an immediate session/project switch can restore the previous unpinned reading offset. The change records that intent synchronously and leaves manual history reading untouched. The targeted suite passed 85/85, and the isolated Electron E2E passed all four probes, including retained-pane return and project remount with background output. I resolved the latest-main conflicts by preserving the current D676 completion behavior and current provider-certificate E2E implementation. Full Desktop typecheck was attempted but stopped on stale linked package declarations from the primary checkout (missing exports in unchanged shared/host/plugin packages; no diagnostic points to the changed hook). Thanks for adding the regression path and documenting the interaction.

@vastsa
vastsa merged commit 77c2b7c into vastsa:main Oct 28, 2026
5 of 6 checks passed

vastsa commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Thank you for the focused fix and the realistic navigation regression. I merged it after preserving the newer main behavior in the conflicts and validating the 85 targeted tests plus the isolated Electron flow on the current candidate.

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.

10 participants