Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): stop the transcript scrolling itself on every streamed chunk #4884

ClosedAsimNet(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/4884/headopened View on GitHub

The chat transcript follows the live edge while an agent streams, which fires a scroll once per chunk. Over a long session that continuous movement is tiring to read, and there is no way to turn it off.

How it's fixed

Two per-device client settings in Settings → Appearance:

  • chatAutoScroll gates live-follow, defaulting to off. The transcript holds still while output streams; the send-time anchor still positions the new turn once, so you are not left looking at old messages; and the scroll-to-end pill becomes the way back to the edge.
  • reduceMotion forces the reduced-motion path on regardless of the OS preference — scrolls become instant instead of animated, and the looping indicator animations stop (status pulse, skeleton shimmer, working indicator, ultrathink gradients).

Two details worth review attention:

The pill's visibility guard needed the setting too. It treats "left the live edge" as the list settling rather than the reader navigating — which is only true while something is actually following. Without that, turning follow off hid the pill exactly when it became the only way back.

Spinners are deliberately left spinning under reduce-motion. A frozen spinner reads as a hung app, which is worse than the motion it removes.

Verification

tsgo --noEmit, vp test run --project unit (1666 tests), vp lint, and vp build all pass on this branch against current main. MessagesTimeline.test.tsx gains a case asserting the list only re-pins to the end when the setting is on.

Screenshots

The new rows in Settings → Appearance:

Appearance settings

This change is behavioural rather than visual — the difference is motion during streaming, which a still image can't show. Happy to record a short clip if that's wanted before review.


Written by Claude Opus 4.5 in Claude Code.


Note

Medium Risk Default-off live-follow changes behavior for all users during streaming, and scroll-mode/pill logic in ChatView is easy to regress; changes are UI-only with no auth or data impact.

Overview Behavior change: streaming transcripts no longer auto-follow the live edge by default. A new chatAutoScroll client setting (default off) gates per-chunk live-follow in ChatView and LegendList maintainScrollAtEnd in MessagesTimeline. Send-time turn anchoring still runs once; the scroll-to-end pill is shown when the reader is behind the edge, with settling guards updated so the pill is not suppressed when follow is off.

Adds reduceMotion (default off) plus a shared prefersReducedMotion helper and data-reduce-motion on <html> so scroll jumps (anchor, pill, minimap), draft-hero / mobile composer transitions, and looping status animations respect the setting or OS prefers-reduced-motion (spinners stay animated).

Settings → Appearance exposes both toggles, restore-defaults, and user docs. Chat timeline tests assert list re-pin only when auto-scroll is enabled. Minor RTL-oriented class swaps (ps/ms/start, force-ltr on tool output).

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit c376c94a79a2ae9db95933993bad6991a89fe54a. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Stop transcript auto-scrolling on every streamed chunk with a new "Follow agent output" setting

  • Adds chatAutoScroll and reduceMotion boolean client settings (both defaulting to false) in settings.ts; when chatAutoScroll is off the message list no longer re-pins to the end during streaming.
  • Introduces a settle window (LIVE_FOLLOW_SETTLE_MS) in ChatView.tsx to suppress the scroll-to-end pill from flashing during thread switches and post-send transitions.
  • Adds a prefersReducedMotion utility in reducedMotion.ts that checks both the new setting and the OS prefers-reduced-motion media query; mirrors the result to html[data-reduce-motion] for CSS.
  • CSS in index.css disables continuous animations (pulses, shimmers, view transitions) when reduced motion is active.
  • Exposes both settings as toggles in the Appearance settings panel in SettingsPanels.tsx.
  • Behavioral Change: existing users default to chatAutoScroll: false, meaning auto-follow of streaming output is off by default for all users.
Macroscope summarized c376c94.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: e27f51e1-f80a-46b5-bb71-7a05ef03fe43

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. One finding: a leftover temporary Effect script (packages/contracts/tmp-rexec.ts) was committed alongside the reduce-motion/auto-scroll change. The rest of the changed TypeScript (contracts schema additions, reducedMotion.ts, timeline/settings wiring) follows the Effect conventions — no service, layer, or error-model violations found.

      Posted via Macroscope — Effect Service Conventions
      @@ -0,0 +1 @@
      1+/**
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      This looks like a leftover debugging bridge rather than part of the reduce-motion / auto-scroll change, and it lands in a shared package at a non-canonical location: it sits outside packages/contracts/src, so the package tsconfig.json (include: ["src"]) never typechecks it, and it hardcodes a private host plus several as any casts. Suggest dropping it from this PR.

      If it does need to live in the repo, it would be worth moving it to a typechecked scripts location and tidying the Effect usage while it is still small: import * as RpcClient from "effect/unstable/rpc/RpcClient" instead of the barrel named import, Effect.provide(protocolLayer) instead of manually Layer.build-ing the context, and a typed failure instead of Effect.catchCause((cause) => Effect.logDebug(String(cause))), which swallows every failure and defect into a stringified message.

      Posted via Macroscope — Effect Service Conventions
    4. @@ -0,0 +69,21 @@
      69+ RpcClient.makeProtocolSocket({ retryTransientErrors: false, retryPolicy: Schedule.recurs(0) }),
      70+ ).pipe(Layer.provide(Layer.mergeAll(socketLayer, RpcSerialization.layerJson)));
      71+
      72+ const ctx = yield* Layer.build(protocolLayer);
      73+ const client = yield* RpcClient.make(WsRpcGroup).pipe(Effect.provide(ctx));
      74+
      75+ // Make sure the shell exists. Re-opening an existing terminal is fine.
      76+ yield* client[WS_METHODS.terminalOpen]({
      77+ threadId: THREAD_ID,
      78+ terminalId: TERMINAL_ID,
      79+ cwd,
      80+ cols: 200,
      81+ rows: 50,
      82+ }).pipe(Effect.catchCause((cause) => Effect.logDebug(`open: ${String(cause)}`)));
      83+
      84+ const done = yield* Deferred.make<number>();
      85+ let buf = "";
      86+ let printedUpTo = 0;
      87+ let streaming = false;
      88+
      89+ const onChunk = (chunk: string) =>
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium contracts/tmp-rexec.ts:89

      onChunk appends every terminal byte to buf and never trims data that has already been written to stdout. A long-running or high-output remote command causes the process to retain the command's entire output for up to the one-hour default timeout; sufficiently large build/test output exhausts memory and crashes the helper. Once the consumed prefix has been written to stdout, it should be discarded from buf, keeping only the small suffix needed to detect a split END marker.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @packages/contracts/tmp-rexec.ts around line 89:
      
      `onChunk` appends every terminal byte to `buf` and never trims data that has already been written to stdout. A long-running or high-output remote command causes the process to retain the command's entire output for up to the one-hour default timeout; sufficiently large build/test output exhausts memory and crashes the helper. Once the consumed prefix has been written to stdout, it should be discarded from `buf`, keeping only the small suffix needed to detect a split `END` marker.
      @@ -0,0 +135,21 @@
      135+
      136+ yield* Deferred.await(attached);
      137+ const line = `printf '\\n${BEGIN}\\n'; ${command}; printf '\\n${END}%s\\n' "$?"\r`;
      138+ yield* client[WS_METHODS.terminalWrite]({
      139+ threadId: THREAD_ID,
      140+ terminalId: TERMINAL_ID,
      141+ data: line,
      142+ });
      143+
      144+ const code = yield* Deferred.await(done).pipe(Effect.timeout(`${timeoutSec} seconds`));
      145+ process.stdout.write("\n");
      146+ return code;
      147+});
      148+
      149+Effect.runPromise(Effect.scoped(program) as any).then(
      150+ (code) => process.exit(Number(code)),
      151+ (err) => {
      152+ console.error("\n[rexec] failed:", err?.message ?? err);
      153+ process.exit(1);
      154+ },
      155+);
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium contracts/tmp-rexec.ts:149

      process.exit() is called immediately after writing the final stdout chunk, which can silently truncate output when stdout is piped and the write is still queued. Node forces termination on process.exit() regardless of pending stream writes, so the exit code is reported correctly but the command's output is incomplete. Set process.exitCode and let the event loop drain naturally, or await process.stdout before exiting.

      Suggested change
      149-Effect.runPromise(Effect.scoped(program) as any).then(
      150- (code) => process.exit(Number(code)),
      151- (err) => {
      152- console.error("\n[rexec] failed:", err?.message ?? err);
      153- process.exit(1);
      154- },
      155-);
      149+Effect.runPromise(Effect.scoped(program) as any).then(
      150+ (code) => {
      151+ process.exitCode = Number(code);
      152+ },
      153+ (err) => {
      154+ console.error("\n[rexec] failed:", err?.message ?? err);
      155+ process.exitCode = 1;
      156+ },
      157+);
      🤖 Copy this AI Prompt to have your agent fix this:
      In file @packages/contracts/tmp-rexec.ts around lines 149-155:
      
      `process.exit()` is called immediately after writing the final stdout chunk, which can silently truncate output when stdout is piped and the write is still queued. Node forces termination on `process.exit()` regardless of pending stream writes, so the exit code is reported correctly but the command's output is incomplete. Set `process.exitCode` and let the event loop drain naturally, or await `process.stdout` before exiting.
      @@ -0,0 +13,21 @@
      13+import { RpcClient } from "effect/unstable/rpc";
      14+import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
      15+import * as Socket from "effect/unstable/socket/Socket";
      16+import { WS_METHODS, WsRpcGroup } from "./src/rpc.ts";
      17+
      18+const BASE = process.env.T3_BASE ?? "http://100.77.192.114:3773";
      19+const TOKEN = process.env.T3_TOKEN ?? "";
      20+const THREAD_ID = process.env.T3_THREAD ?? "claude-remote-build";
      21+const TERMINAL_ID = process.env.T3_TERM ?? "term-1";
      22+
      23+const argv = process.argv.slice(2);
      24+let cwd = "~";
      25+let timeoutSec = 3600;
      26+const cmdParts: Array<string> = [];
      27+for (let i = 0; i < argv.length; i++) {
      28+ if (argv[i] === "--cwd") cwd = argv[++i]!;
      29+ else if (argv[i] === "--timeout") timeoutSec = Number(argv[++i]);
      30+ else if (argv[i] === "--") (cmdParts.push(...argv.slice(i + 1)), (i = argv.length));
      31+ else cmdParts.push(argv[i]!);
      32+}
      33+const command = cmdParts.join(" ");
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium contracts/tmp-rexec.ts:33

      cmdParts.join(" ") discards argument boundaries, so any argument containing spaces is split into separate words on the remote shell. For example, -- printf '%s\n' 'hello world' sends printf %s\n hello world, making hello and world separate arguments instead of one. Similarly, -- bash -lc 'echo one; echo two' no longer passes the script as a single -c argument, changing the command's semantics. Any argument with whitespace, glob characters, or other shell-significant text executes incorrectly unless the caller manually adds literal shell quoting that a normal shell would have stripped. Consider joining with proper shell escaping (e.g. shlex-style quoting) instead of a plain space.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @packages/contracts/tmp-rexec.ts around line 33:
      
      `cmdParts.join(" ")` discards argument boundaries, so any argument containing spaces is split into separate words on the remote shell. For example, `-- printf '%s\n' 'hello world'` sends `printf %s\n hello world`, making `hello` and `world` separate arguments instead of one. Similarly, `-- bash -lc 'echo one; echo two'` no longer passes the script as a single `-c` argument, changing the command's semantics. Any argument with whitespace, glob characters, or other shell-significant text executes incorrectly unless the caller manually adds literal shell quoting that a normal shell would have stripped. Consider joining with proper shell escaping (e.g. `shlex`-style quoting) instead of a plain space.
    5. Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot).

      Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

      Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8c01c834d2a4cd4db2335ce667da9c8fc53b561c. Configure [here](https://www.cursor.com/dashboard/bugbot).
    6. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      3 blocking correctness issues found. This PR introduces new user-facing settings and changes the default transcript scrolling behavior from on to off. Additionally, open review comments identify potential CSS issues with undefined variables and incomplete animation coverage that should be verified before merging.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    7. 💡 Codex Review

      Here are some automated review suggestions for this pull request.

      Reviewed commit: 8c01c834d2

      ℹ️ About Codex in GitHub

      Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

      • Open a pull request for review
      • Mark a draft as ready
      • Comment "@codex review".

      If Codex has suggestions, it will comment; otherwise it will react with 👍.

      Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

      @@ -5677,4 +5702,7 @@
      56775702 !inlineRightPanelOwnsTitleBar &&
      56785703 "wco:pr-[var(--workspace-native-controls-inset)]",
      56795704 )
      5680- : "workspace-topbar pl-[calc(env(safe-area-inset-left)+0.75rem)] pr-[calc(env(safe-area-inset-right)+0.75rem)] sm:pl-[calc(env(safe-area-inset-left)+1.25rem)] sm:pr-[calc(env(safe-area-inset-right)+1.25rem)]",
      5705+ : // --safe-area-inset-start/end resolve to the physical side that
      5706+ // matches the reading direction, so the notch inset lands on the
      5707+ // right edge in RTL instead of following the LTR assumption.
      5708+ "workspace-topbar ps-[calc(var(--safe-area-inset-start)+0.75rem)] pe-[calc(var(--safe-area-inset-end)+0.75rem)] sm:ps-[calc(var(--safe-area-inset-start)+1.25rem)] sm:pe-[calc(var(--safe-area-inset-end)+1.25rem)]",

      P2 Badge Define the logical safe-area variables before using them

      On every non-Electron chat surface, these padding declarations are invalid because neither --safe-area-inset-start nor --safe-area-inset-end is defined anywhere in the repository. Browsers therefore discard all four declarations, removing the previous 0.75rem/1.25rem horizontal header padding and placing its controls against the viewport edges; define the variables or retain declarations based on the existing env(safe-area-inset-*) values.

      Useful? React with 👍 / 👎.

      @@ -1498,0 +1508,21 @@
      1508+ .ultrathink-chroma,
      1509+ .ultrathink-pill,
      1510+ .ultrathink-word,
      1511+ [class*="animate-status-pulse"],
      1512+ [class*="animate-status-ping"],
      1513+ [class*="animate-sidebar-working-text"],
      1514+ [class*="animate-skeleton"],
      1515+ [class*="animate-pulse"] {
      1516+ animation: none !important;
      1517+ }
      1518+}
      1519+
      1520+html[data-reduce-motion="true"] .ultrathink-frame::before,
      1521+html[data-reduce-motion="true"] .ultrathink-chroma,
      1522+html[data-reduce-motion="true"] .ultrathink-pill,
      1523+html[data-reduce-motion="true"] .ultrathink-word,
      1524+html[data-reduce-motion="true"] [class*="animate-status-pulse"],
      1525+html[data-reduce-motion="true"] [class*="animate-status-ping"],
      1526+html[data-reduce-motion="true"] [class*="animate-sidebar-working-text"],
      1527+html[data-reduce-motion="true"] [class*="animate-skeleton"],
      1528+html[data-reduce-motion="true"] [class*="animate-pulse"] {

      P2 Badge Disable the provider-update bounce in Reduce motion mode

      When the in-app Reduce motion switch is enabled without the OS media preference, this selector list does not match the infinite [animation:bounce_2.4s_ease-in-out_infinite] on ProviderInstanceCard.tsx:626; its motion-reduce:animate-none only responds to the OS preference. Consequently the newly advertised setting still leaves a continuously repainting indicator bouncing, so include that animation in the data-reduce-motion path.

      AGENTS.md reference: AGENTS.md:L128-L134

      Useful? React with 👍 / 👎.

      @@ -0,0 +1,20 @@
      1+/**
      2+ * Temporary bridge: run a shell command on a remote T3 Code environment by
      3+ * driving the `terminal.*` WS RPCs. Lives inside packages/contracts so that
      4+ * `effect` and the contract schemas resolve without a root install.
      5+ *
      6+ * Usage: node tmp-rexec.ts --cwd <dir> [--timeout <sec>] -- <command...>
      7+ */
      8+import * as Deferred from "effect/Deferred";
      9+import * as Effect from "effect/Effect";
      10+import * as Layer from "effect/Layer";
      11+import * as Schedule from "effect/Schedule";
      12+import * as Stream from "effect/Stream";
      13+import { RpcClient } from "effect/unstable/rpc";
      14+import * as RpcSerialization from "effect/unstable/rpc/RpcSerialization";
      15+import * as Socket from "effect/unstable/socket/Socket";
      16+import { WS_METHODS, WsRpcGroup } from "./src/rpc.ts";
      17+
      18+const BASE = process.env.T3_BASE ?? "http://100.77.192.114:3773";
      19+const TOKEN = process.env.T3_TOKEN ?? "";
      20+const THREAD_ID = process.env.T3_THREAD ?? "claude-remote-build";

      P2 Badge Remove the temporary remote-execution bridge

      This commit adds an unreferenced maintainer scratch utility that opens a terminal and executes arbitrary shell commands against a hard-coded private T3 endpoint. It is unrelated to the web scrolling change, embeds environment-specific identifiers in distributed source, and introduces runtime logic into the contracts package; remove it from the commit rather than shipping it as supported repository code.

      AGENTS.md reference: AGENTS.md:L119-L124

      Useful? React with 👍 / 👎.

    8. Thanks — all four findings were real. Fixed and force-pushed as one clean commit.

      packages/contracts/tmp-rexec.ts — dropped. Correct call: it was a scratch remote-exec script that a git add -A swept in, unrelated to this change, outside src so the package never typechecked it, and it hardcoded a private tailnet IP. It is gone from the branch; the follow-on notes about the buffer never being trimmed, process.exit() truncating piped stdout, and join(" ") losing argument boundaries were all fair, and moot now that the file is out.

      Undefined --safe-area-inset-start/end — real bug, and my fault for how I split this work. Those logical variables and their [dir="rtl"] overrides belong to a separate RTL change; carving this PR out brought the use without the definition, so the four declarations were invalid and the header lost its horizontal padding on mobile web. Reverted to the original env(safe-area-inset-left/right) form. Good catch — a browser silently dropping an invalid calc() is exactly the kind of thing that survives a typecheck.

      Scroll pill flashing on thread switch — also real, and the fix needed more than the gate I had. Leaving the live edge without a user gesture means a programmatic scroll is still settling rather than the reader moving away. With follow on, live-follow owns the position for as long as it holds it. With it off, only the window just after a thread switch or a send is settling, because LegendList reports not-at-end while initialScrollAtEnd lands. So suppression is now keyed on both: the existing generation match plus, when follow is off, a short settle window stamped whenever live-follow takes the position. Suppressing indefinitely in that mode would hide the pill exactly when it is the only way back; not suppressing at all would flash it on every switch.

      Bouncing provider-update indicator — right, and it undercut the whole point of the setting. ProviderInstanceCard uses an arbitrary [animation:bounce_...] class, which the animate-* selectors never matched, and its motion-reduce: variant only answers to the OS preference. Both the media-query and data-reduce-motion paths now cover it. Verified in the built stylesheet rather than the source, since the minifier escapes the colon in that selector.

      tsgo --noEmit, 1666 unit tests, vp lint and vp build all pass on the updated branch.

    9. Closing as part of the open-PR backlog sweep (wave 1).

      Reason: Jul conflicted transcript auto-scroll; streaming list virtualization landed later. Related: #9688

      Reopen if this is still wanted and you’re willing to rebase onto current main.

    10. juliusmarminge closed this

Sign in to join this conversation.