fix(terminal): enable scrollback by suppressing tmux alternate screen#405
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: ProverCoderAI#404
|
Warning Review limit reached
More reviews will be available in 56 minutes and 10 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughВ файл ChangesОбновление .gitkeep
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~1 minutes Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 error, 3 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.gitkeep:
- Line 1: The `.gitkeep` file currently contains auto-generated metadata
comments, which violates the standard convention for `.gitkeep` files that serve
as placeholders for empty directories in git repositories. Remove all content
from the `.gitkeep` file completely, leaving it empty as per the established
convention. If metadata about PR generation needs to be preserved, use an
alternative mechanism such as a separate log file or documentation in a
different location.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 199d6567-e68f-4113-997b-e0f46ecb9e28
📒 Files selected for processing (1)
.gitkeep
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
- GitHub Check: E2E (Login context)
- GitHub Check: E2E (Browser command)
- GitHub Check: E2E (OpenCode)
- GitHub Check: Lint
- GitHub Check: E2E (Runtime volumes + SSH)
- GitHub Check: Test
- GitHub Check: Lint Effect-TS
- GitHub Check: E2E (Local package CLI)
- GitHub Check: Build
- GitHub Check: E2E (Clone cache)
- GitHub Check: E2E (Clone auto-open SSH)
- GitHub Check: Types
- GitHub Check: Final build (macos-latest)
- GitHub Check: Dist deps prune
- GitHub Check: Final build (windows-latest)
- GitHub Check: Final build (ubuntu-latest)
- GitHub Check: Snapshot
- GitHub Check: dist-deps-prune
🧰 Additional context used
📓 Path-based instructions (1)
**/{.git*,config*,*.sh,docker-compose*}
📄 CodeRabbit inference engine (README.md)
Use git credential helper to automatically select correct token by host for HTTPS clone/push operations
Files:
.gitkeep
…ble scrollback
Project terminals run inside tmux, which switches xterm into the alternate
screen buffer (DEC 47/1047/1049). The alternate screen keeps no scrollback,
so output was cleared on every repaint and wheel scroll had nothing to reveal
("constantly clears all text, only shows one page").
Wire the already-implemented suppressAlternateScreen query-suppression option
on for project terminals via a new pure gating module (terminal-screen-policy),
keeping tmux/TUI output in xterm's normal 50k-line scrollback buffer.
Refs ProverCoderAI#404
Working session summaryAll CI checks pass. The only failure is CodeRabbit ("Prepaid credits exhausted"), an account-level billing issue unrelated to this change. Working tree is clean and the PR is ready. SummaryIssue #404 ("Why is the terminal not able to scroll? It constantly clears all the text and only lets you see one page") is resolved in PR #405. Root cause: Project terminals run inside tmux, which switches xterm.js into the alternate screen buffer (DEC private modes Fix: Enabled the already-implemented-but-dormant
With the alternate screen suppressed, tmux/TUI output stays in xterm's normal buffer and accumulates in the 50k-line scrollback, so wheel scrolling reveals earlier history. Verification:
PR: #405 This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:Claude Opus 4.8: (2 sub-sessions)
Total: (24.2K new + 145.2K cache writes + 5.2M cache reads) input tokens, 46.4K output tokens, $4.802885 cost 🤖 Models used:
📎 Log file uploaded as Gist (2368KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
Problem
Issue #404: "Почему терминал не способен скролиться?" — the web terminal cannot be scrolled. The reporter clarifies: "Он постоянно очищает весь текст и даёт видеть только 1 страницу" (it constantly clears all the text and only lets you see one page).
Root cause
Project terminals run inside tmux (
renderTmuxAttachCommandinpackages/api/src/services/terminal-sessions.tsstarts tmux withmouse on,history-limit 50000). tmux switches xterm.js into the alternate screen buffer (DEC private modes47/1047/1049).The alternate screen keeps no scrollback in xterm. So every repaint wipes the visible buffer — the terminal shows only the current page — and wheel scrolling (
terminal.scrollLines) has nothing to reveal. xterm'sscrollback: 50_000setting only applies to the normal buffer, which tmux never used.Fix
The query-suppression layer already had a fully-implemented but never-enabled
suppressAlternateScreenoption (terminal-query-suppression.ts), with a comment explicitly anticipating "project terminals opt out to keep xterm scrollback visible". This PR turns it on for project terminals.packages/terminal/src/web/terminal-screen-policy.tsdecides per session (project terminals are identified bybrowserProjectId):shouldAllowTerminalMouseTracking(existing behaviour, extracted)shouldSuppressTerminalAlternateScreen(new)terminal-panel-runtime.tspassessuppressAlternateScreeninto thequerySuppressionoptions when creating the runtime.src/web/index.ts.With the alternate screen suppressed, tmux/TUI output stays in xterm's normal buffer, accumulating in the 50k-line scrollback, so wheel scrolling reveals earlier history.
Auth/login terminals (no
browserProjectId) are unaffected — they keep the conservative default and continue to use the alternate screen.Reproduction
seq 1 200).Tests
packages/terminal/tests/web/terminal-alternate-screen.test.tscovers the gating: project sessions suppress the alternate screen and allow mouse tracking; auth sessions do neither; session classification bybrowserProjectId.terminal-query-suppression.test.tsalready verifies thatsuppressAlternateScreen: truemakes the CSI?h/?lhandlers consume modes47/1047/1049.tsc --noEmitclean, all linters (lint,lint:tests,lint:effect) clean.Refs #404
Fixes #404