Skip to content

fix(workspace): support jump and auto-follow in agent terminal views - #838

Merged
Juliusolsson05 merged 10 commits into
mainfrom
feat/agent-terminal-follow
Sep 8, 2026
Merged

fix(workspace): support jump and auto-follow in agent terminal views#838
Juliusolsson05 merged 10 commits into
mainfrom
feat/agent-terminal-follow

Conversation

@Juliusolsson05

@Juliusolsson05 Juliusolsson05 commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #837.

Jump to Latest, Auto-follow Focused Agent, and Tail All now operate on raw agent terminal viewports, including OpenCode Terminal and Claude/Codex terminal views, without switching into the rendered feed. Plain shell panes remain excluded.

Implementation

  • Preserve the existing jump counter and follow flags; mask forced follow by composed pane visibility.
  • Pin after asynchronous PTY writes and attach replay finish parsing, with fire-time state/lifetime checks.
  • Coalesce and defer scroll-event re-pins to respect real xterm viewport reentrancy.
  • Use public xterm markers to restore retained content after follow ends. Markers track scrollback trimming; evicted anchors fall back to the oldest retained normal-buffer line.
  • Reset saved state on session changes; clean up markers/listeners and display TAIL status on raw views.
  • Update palette and external-control descriptions without changing schemas or persisted data. No migration is required.

Review

One Claude and one Codex reviewer ran through Agent Code MCP orchestration. Both initially requested fixes. Deferred-write races, replay timing, reentrant scrolling, trim drift, session-state leakage, and a tautological command test were corrected. Both independently approved integrated revision 25eabfc with no remaining blocker. These are agent reviews, not GitHub account approvals.

Verification

Node 24.14.1, fresh npm ci, origin/main integrated and submodules updated.

  • Typecheck passed.
  • Targeted renderer suite: 30 tests passed across follow, submit, dimension ownership, and command guards.
  • Full renderer: 563 passed across 129 files, using --maxWorkers=4 --testTimeout=15000 for local cold-transform load.
  • Full system: 111 passed across 17 files, including the new real Electron/xterm test.
  • Real-engine regression proves re-pin, jump, restoration after trimming, eviction fallback, alternate-buffer handling and marker disposal. Before the fix it restored line-1191 instead of line-1091 after trimming; public markers made it pass.
  • Full unit: 2206 passed, one local image-fixture provenance test failed because a cited historical private session no longer exists. This unrelated local source-retention issue is tracked in test(media): make image fixture provenance checks survive local transcript rotation #839; no fixture, citation or assertion was weakened.
  • Test contract, keybinding check and git diff --check passed.
  • Earlier Node 25 runs and one timed-out combined run are not claimed as passing verification. CI results on this exact head are the merge gate.

Limits

Raw follow controls xterm scrollback, not an alternate-screen TUI internal history/keybindings. If anchored content is evicted or removed during reflow, restore falls back to the oldest retained line. No new provider, no plain-shell follow, no shared-checkout changes.

The user explicitly authorized merge after Claude/Codex review. Merge remains gated on passing CI; no bypass or auto-merge requested.

…lign harnesses

@xterm/xterm v6 exposes buffer.active.viewportY as readonly (v5 allowed
assignment), so the tail-restore path typechecks only through
Terminal.scrollToLine with an explicit clamp.

The submit and dimension-ownership harness mocks also needed the scroll
surface (onScroll/scrollToBottom/scrollToLine) and a tailAllMode store
slice: the follow wiring subscribes to viewport movement at mount, and a
mock without onScroll aborts xterm init inside the leaf's try block,
taking those suites down with a missing-method TypeError.
…utput

Resolve Claude and Codex review findings with fire-time callback guards, deferred viewport re-pinning, session-local markers and real Electron/xterm coverage. Markers preserve content across scrollback trimming where numeric offsets and baseY arithmetic cannot. Update the execution plan and command contracts to match verified behavior.

Refs #837
@Juliusolsson05
Juliusolsson05 merged commit 31e81ef into main Sep 8, 2026
2 checks passed
@Juliusolsson05
Juliusolsson05 deleted the feat/agent-terminal-follow branch September 8, 2026 02:22
@Juliusolsson05

Copy link
Copy Markdown
Owner Author

Delivery complete: both reviewers approved 25eabfc, then quality-gate (10m19s) and minimum-node-fixture-gate (47s) passed on that exact head. CI covered typechecks, core/system/renderer tests, coverage, and distributable verification. Merged with an exact-head fence under the user explicit review-then-merge authorization; merge commit 31e81ef. Issue #837 closed via this PR. Local main was fast-forwarded without altering the unrelated untracked user plan. The separate local source-retention test issue remains tracked in #839.

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.

fix(workspace): support jump and auto-follow in agent terminal views

1 participant