Skip to content

fix(issue): [Bug]: Terminal rendering glitch / display misalignment when scrolling up in GSD‑2 CLI#6186

Merged
jeremymcs merged 5 commits into
mainfrom
issue/5762-bug-terminal-rendering-glitch-display-mi-1778892817
May 17, 2026
Merged

fix(issue): [Bug]: Terminal rendering glitch / display misalignment when scrolling up in GSD‑2 CLI#6186
jeremymcs merged 5 commits into
mainfrom
issue/5762-bug-terminal-rendering-glitch-display-mi-1778892817

Conversation

@jeremymcs

@jeremymcs jeremymcs commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Disabled synchronized terminal output wrapping on Windows in the TUI renderer and verified compilation with npm run test:compile.

Verification

  • Completed in the repository worktree before push.

Related Issue

Repo

  • gsd-build/gsd-2

Branch

  • issue/5762-bug-terminal-rendering-glitch-display-mi-1778892817

Summary by CodeRabbit

  • New Features

    • Added PI_DISABLE_SYNC_OUTPUT env var to allow disabling synchronized terminal output on non-Windows platforms.
  • Documentation

    • Documented the new variable and its default behavior on macOS, Linux, and Windows.
  • Tests

    • Added a regression test to verify renders when the variable disables synchronized-output sequences.
    • Updated native stream tests to safely handle environments where native stream hooks can’t be overridden.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a6ca32b7-f7fd-4870-a473-8c08b2c5d98f

📥 Commits

Reviewing files that changed from the base of the PR and between 81b650a and 69d7ef6.

📒 Files selected for processing (1)
  • packages/pi-tui/src/__tests__/tui.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/pi-tui/src/tests/tui.test.ts

📝 Walkthrough

Walkthrough

Adds a private useSynchronizedOutput flag (disabled on Windows or when PI_DISABLE_SYNC_OUTPUT="1") and gates all synchronized-output escape sequences in TUI render paths. Updates tests to verify suppression and hardens native stream tests. Documents the new environment variable.

Changes

Synchronized Terminal Output Control

Layer / File(s) Summary
Conditional synchronized output flag initialization
packages/pi-tui/src/tui.ts
useSynchronizedOutput flag is initialized to true when platform is not Windows and PI_DISABLE_SYNC_OUTPUT is not "1".
Apply conditional synchronized output to render paths
packages/pi-tui/src/tui.ts, packages/pi-tui/src/__tests__/tui.test.ts
Full redraw, tall→tall realignment repaint, deletion-only clearing, and the main differential render path now conditionally emit synchronized-output begin/end sequences based on the flag. Tests assert output remains while sequences are suppressed when the env var is set.
User documentation
docs/user-docs/configuration.md, gitbook/reference/environment-variables.md
Adds PI_DISABLE_SYNC_OUTPUT docs describing that setting literal 1 disables synchronized terminal output on non-Windows platforms and documents platform defaults.
Native test helper and updates
packages/native/src/__tests__/stream-process.test.mjs
Adds replaceNativeProcessStreamChunk helper to safely override native.processStreamChunk, updates three fallback/ANSI/UTF-8 tests to use the helper and restore originals in finally, and skip tests when native export isn’t writable.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • gsd-build/gsd-2#5801: Modifies packages/pi-tui/src/tui.ts rendering/shrink logic that overlaps with these render-path changes.
  • gsd-build/gsd-2#6131: Also changes packages/pi-tui/src/tui.ts render fallback and clearing behavior at similar code points.
  • gsd-build/gsd-2#6135: Adds a regression test targeting the tall→tall realignment repaint path affected by this PR.

Poem

🐰 A hush for the terminal, soft as night,
a carrot-sized flag that tucks sequences tight.
On Mac and Linux the dances still play,
set 1 for quiet, and watch them stay away.
The rabbit nods, content with calm display.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: disabling synchronized terminal output on Windows to fix terminal rendering glitches when scrolling in the GSD-2 CLI.
Linked Issues check ✅ Passed The PR implements a solution to issue #5762 by conditionally disabling synchronized output on Windows, which directly addresses the reported terminal rendering misalignment when scrolling up.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the terminal rendering issue: implementation in tui.ts, documentation of the new environment variable, regression tests, and test infrastructure updates align with the stated objective.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue/5762-bug-terminal-rendering-glitch-display-mi-1778892817

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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 and usage tips.

@github-actions

github-actions Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

🟡 PR Risk Report — MEDIUM

Files changed 5
Systems affected 1
Overall risk 🟡 MEDIUM

Affected Systems

Risk System
🟡 medium TUI Components
File Breakdown
Risk File Systems
🟡 packages/pi-tui/src/tui.ts TUI Components
docs/user-docs/configuration.md (unclassified)
gitbook/reference/environment-variables.md (unclassified)
packages/native/src/__tests__/stream-process.test.mjs (unclassified)
packages/pi-tui/src/__tests__/tui.test.ts (unclassified)

@jeremymcs

Copy link
Copy Markdown
Contributor Author

🤖 Dispatched codex with the following prompt:

Agent prompt (click to expand)
You are acting as an autonomous PR babysitter for gsd-build/gsd-2 PR #6186.
PR URL: https://github.com/gsd-build/gsd-2/pull/6186
Base repository: gsd-build/gsd-2
Head repository: gsd-build/gsd-2
Head branch: issue/5762-bug-terminal-rendering-glitch-display-mi-1778892817
Head remote: origin
You are running inside an isolated app-owned worktree under ~/.patchdeck.
Make only targeted changes that resolve the approved tasks.
Do not wait for user input, confirmation, or approval at any point.
Do not rewrite unrelated files.
Use the available git tooling for inspection and verification only.
If dependencies are missing, install them using the repository's lockfile/package manager as needed inside this isolated worktree.
Leave file edits uncommitted; the babysitter app will handle Git finalization after your run.
GitHub follow-up replies and review-thread resolution will be handled by the babysitter after your run.
If a task is invalid after inspection, explain it in your final response and include the exact audit token.

Approved review-comment tasks:
None

Approved status-check tasks:
None

Approved documentation tasks:
Documentation updates are required for this PR.
Assessment summary: This PR introduces a new user-facing environment variable (`PI_DISABLE_SYNC_OUTPUT`) and platform-specific output behavior, so configuration/operator docs should be updated to document the flag, default behavior, and when to use it.
Update the appropriate repository documentation for these changes.
Choose the right docs files for this repository (for example README, docs pages, API/config/operator docs).
If, after inspection, the repository documentation is already accurate or there is no appropriate docs target, leave docs unchanged and report that using the docs summary block with `no_change`.

When done:
1) Run the relevant verification for your changes.
2) Leave any changed files in the worktree for the babysitter app to finalize.
3) For each feedback item you addressed or were blocked on, emit a summary block in the following format:
   FEEDBACK_SUMMARY_START <auditToken>
   <A concise 1-2 sentence summary of what you did or why you were blocked>
   FEEDBACK_SUMMARY_END
   Include one block per audit token. These summaries will be posted as follow-up comments on the PR.
4) If documentation tasks were assigned, emit exactly one docs summary block in the following format:
   DOCS_SUMMARY_START <changed|no_change>
   <A concise 1-2 sentence summary of the docs you updated, or why no docs changes were necessary after inspection>
   DOCS_SUMMARY_END

@jeremymcs

Copy link
Copy Markdown
Contributor Author

⚠️ CI Alert

The babysitter pushed changes (commit 5087481), but CI/CD checks are still failing:

  • lint: Check run failure (details)

Manual investigation may be required.

@jeremymcs

jeremymcs commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Accepted — this comment requires code changes. Queuing fix...
🧰 Agent runningcodex is working on the fix...
Agent failedcodex exited with an error: OpenAI Codex v0.130.0.
🧰 Agent runningcodex is working on the fix...
🧰 Agent runningclaude is working on the fix...
Agent failedclaude exited with an error: Command timed out after 900000ms.

@jeremymcs

Copy link
Copy Markdown
Contributor Author

🤖 Dispatched codex with the following prompt:

Agent prompt (click to expand)
You are acting as an autonomous PR babysitter for gsd-build/gsd-2 PR #6186.
PR URL: https://github.com/gsd-build/gsd-2/pull/6186
Base repository: gsd-build/gsd-2
Head repository: gsd-build/gsd-2
Head branch: issue/5762-bug-terminal-rendering-glitch-display-mi-1778892817
Head remote: origin
You are running inside an isolated app-owned worktree under ~/.patchdeck.
Make only targeted changes that resolve the approved tasks.
Do not wait for user input, confirmation, or approval at any point.
Do not rewrite unrelated files.
Use the available git tooling for inspection and verification only.
If dependencies are missing, install them using the repository's lockfile/package manager as needed inside this isolated worktree.
Leave file edits uncommitted; the babysitter app will handle Git finalization after your run.
GitHub follow-up replies and review-thread resolution will be handled by the babysitter after your run.
If a task is invalid after inspection, explain it in your final response and include the exact audit token.

Approved review-comment tasks:
1. [general_comment] jeremymcs
   file=n/a line=n/a
   sourceId=4465000995 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6186#issuecomment-4465000995
   replyKind=general_comment threadId=n/a threadResolved=n/a
   auditToken=codefactory-feedback:gh-issue-comment-4465000995
   ## ⚠️ CI Alert

The babysitter pushed changes (commit `5087481`), but CI/CD checks are still failing:

- **lint**: Check run failure ([details](https://github.com/gsd-build/gsd-2/actions/runs/25949304672/job/76283857119))

Manual investigation may be required.

Approved status-check tasks:
None

Approved documentation tasks:
None

When done:
1) Run the relevant verification for your changes.
2) Leave any changed files in the worktree for the babysitter app to finalize.
3) For each feedback item you addressed or were blocked on, emit a summary block in the following format:
   FEEDBACK_SUMMARY_START <auditToken>
   <A concise 1-2 sentence summary of what you did or why you were blocked>
   FEEDBACK_SUMMARY_END
   Include one block per audit token. These summaries will be posted as follow-up comments on the PR.
4) If documentation tasks were assigned, emit exactly one docs summary block in the following format:
   DOCS_SUMMARY_START <changed|no_change>
   <A concise 1-2 sentence summary of the docs you updated, or why no docs changes were necessary after inspection>
   DOCS_SUMMARY_END

@blacksmith-sh

This comment has been minimized.

@jeremymcs

jeremymcs commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Accepted — this comment requires code changes. Queuing fix...
🧰 Agent runningcodex is working on the fix...
Agent completed — verifying changes...
🎉 Resolved — addressed in commit fcaa44a.

@jeremymcs

Copy link
Copy Markdown
Contributor Author

🤖 Dispatched codex with the following prompt:

Agent prompt (click to expand)
You are acting as an autonomous PR babysitter for gsd-build/gsd-2 PR #6186.
PR URL: https://github.com/gsd-build/gsd-2/pull/6186
Base repository: gsd-build/gsd-2
Head repository: gsd-build/gsd-2
Head branch: issue/5762-bug-terminal-rendering-glitch-display-mi-1778892817
Head remote: origin
You are running inside an isolated app-owned worktree under ~/.patchdeck.
Make only targeted changes that resolve the approved tasks.
Do not wait for user input, confirmation, or approval at any point.
Do not rewrite unrelated files.
Use the available git tooling for inspection and verification only.
If dependencies are missing, install them using the repository's lockfile/package manager as needed inside this isolated worktree.
Leave file edits uncommitted; the babysitter app will handle Git finalization after your run.
GitHub follow-up replies and review-thread resolution will be handled by the babysitter after your run.
If a task is invalid after inspection, explain it in your final response and include the exact audit token.

Approved review-comment tasks:
1. [general_comment] blacksmith-sh[bot]
   file=n/a line=n/a
   sourceId=4465357121 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6186#issuecomment-4465357121
   replyKind=general_comment threadId=n/a threadResolved=n/a
   auditToken=codefactory-feedback:gh-issue-comment-4465357121
   <!-- Blacksmith CI Status -->
Found 2 test failures on Blacksmith runners:

### Failures

| Test | View Logs |
| --- | --- |
| <code>TUI/TUI</code> | [View Logs](https://app.blacksmith.sh/gsd-build/runs/25951016890/jobs/76289615519?attempt=1&ref=gh_comment&autoLogin=true&tab=tests&status=failed#test=bf60593b-65fe-4a24-87dc-bf81c3c9f8fa) |
| <code>TUI/TUI</code> | [View Logs](https://app.blacksmith.sh/gsd-build/runs/25951016890/jobs/76289615519?attempt=1&ref=gh_comment&autoLogin=true&tab=tests&status=failed#test=2249bbb8-dca9-4bef-a159-9d5ab296b3b9) |

<a href="https://backend.blacksmith.sh/track/cursor?cursor_url=cursor%3A%2F%2Fanysphere.cursor-deeplink%2Fprompt%3Ftext%3DFix%2Bthese%2Bfailing%2Btests%253A%250A%250A1.%2BTUI%252FTUI%250A2.%2BTUI%252FTUI%250A&amp;expires=1781493361&amp;installation=gsd-build&amp;job_id=76289615519&amp;run_id=25951016890&amp;test_count=2&amp;signature=6303c511d572238e063ed6c647ee7e2c683d1a6a21b6f22da519b7a7b716e02e"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/fix_with_cursor_dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/fix_with_cursor_light.svg"><img alt="Fix in Cursor" src="https://pr-comments-assets.blacksmith.sh/fix_with_cursor.svg"></picture></a>


Approved status-check tasks:
None

Approved documentation tasks:
None

When done:
1) Run the relevant verification for your changes.
2) Leave any changed files in the worktree for the babysitter app to finalize.
3) For each feedback item you addressed or were blocked on, emit a summary block in the following format:
   FEEDBACK_SUMMARY_START <auditToken>
   <A concise 1-2 sentence summary of what you did or why you were blocked>
   FEEDBACK_SUMMARY_END
   Include one block per audit token. These summaries will be posted as follow-up comments on the PR.
4) If documentation tasks were assigned, emit exactly one docs summary block in the following format:
   DOCS_SUMMARY_START <changed|no_change>
   <A concise 1-2 sentence summary of the docs you updated, or why no docs changes were necessary after inspection>
   DOCS_SUMMARY_END

@jeremymcs

Copy link
Copy Markdown
Contributor Author

Addressed in commit fcaa44a by the latest babysitter run.

Responding to comment by @blacksmith-sh[bot]:

I audited the reported TUI/TUI failures and ran the compiled pi-tui TUI test suites directly in this PR worktree; all tests passed locally with zero failures, so there was no reproducible failing behavior to patch in this branch.

@jeremymcs

Copy link
Copy Markdown
Contributor Author

🤖 Dispatched codex with the following prompt:

Agent prompt (click to expand)
You are acting as an autonomous PR babysitter for gsd-build/gsd-2 PR #6186.
PR URL: https://github.com/gsd-build/gsd-2/pull/6186
Base repository: gsd-build/gsd-2
Head repository: gsd-build/gsd-2
Head branch: issue/5762-bug-terminal-rendering-glitch-display-mi-1778892817
Head remote: origin
You are running inside an isolated app-owned worktree under ~/.patchdeck.
Make only targeted changes that resolve the approved tasks.
Do not wait for user input, confirmation, or approval at any point.
Do not rewrite unrelated files.
Use the available git tooling for inspection and verification only.
If dependencies are missing, install them using the repository's lockfile/package manager as needed inside this isolated worktree.
Leave file edits uncommitted; the babysitter app will handle Git finalization after your run.
GitHub follow-up replies and review-thread resolution will be handled by the babysitter after your run.
If a task is invalid after inspection, explain it in your final response and include the exact audit token.

Approved review-comment tasks:
1. [general_comment] jeremymcs
   file=n/a line=n/a
   sourceId=4465000995 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6186#issuecomment-4465000995
   replyKind=general_comment threadId=n/a threadResolved=n/a
   auditToken=codefactory-feedback:gh-issue-comment-4465000995
   ## ⚠️ CI Alert

The babysitter pushed changes (commit `5087481`), but CI/CD checks are still failing:

- **lint**: Check run failure ([details](https://github.com/gsd-build/gsd-2/actions/runs/25949304672/job/76283857119))

Manual investigation may be required.

Approved status-check tasks:
None

Approved documentation tasks:
None

When done:
1) Run the relevant verification for your changes.
2) Leave any changed files in the worktree for the babysitter app to finalize.
3) For each feedback item you addressed or were blocked on, emit a summary block in the following format:
   FEEDBACK_SUMMARY_START <auditToken>
   <A concise 1-2 sentence summary of what you did or why you were blocked>
   FEEDBACK_SUMMARY_END
   Include one block per audit token. These summaries will be posted as follow-up comments on the PR.
4) If documentation tasks were assigned, emit exactly one docs summary block in the following format:
   DOCS_SUMMARY_START <changed|no_change>
   <A concise 1-2 sentence summary of the docs you updated, or why no docs changes were necessary after inspection>
   DOCS_SUMMARY_END

@jeremymcs

Copy link
Copy Markdown
Contributor Author

🤖 Dispatched claude with the following prompt:

Agent prompt (click to expand)
You are acting as an autonomous PR babysitter for gsd-build/gsd-2 PR #6186.
PR URL: https://github.com/gsd-build/gsd-2/pull/6186
Base repository: gsd-build/gsd-2
Head repository: gsd-build/gsd-2
Head branch: issue/5762-bug-terminal-rendering-glitch-display-mi-1778892817
Head remote: origin
You are running inside an isolated app-owned worktree under ~/.patchdeck.
Make only targeted changes that resolve the approved tasks.
Do not wait for user input, confirmation, or approval at any point.
Do not rewrite unrelated files.
Use the available git tooling for inspection and verification only.
If dependencies are missing, install them using the repository's lockfile/package manager as needed inside this isolated worktree.
Leave file edits uncommitted; the babysitter app will handle Git finalization after your run.
GitHub follow-up replies and review-thread resolution will be handled by the babysitter after your run.
If a task is invalid after inspection, explain it in your final response and include the exact audit token.

Approved review-comment tasks:
1. [general_comment] jeremymcs
   file=n/a line=n/a
   sourceId=4465000995 sourceUrl=https://github.com/gsd-build/gsd-2/pull/6186#issuecomment-4465000995
   replyKind=general_comment threadId=n/a threadResolved=n/a
   auditToken=codefactory-feedback:gh-issue-comment-4465000995
   ## ⚠️ CI Alert

The babysitter pushed changes (commit `5087481`), but CI/CD checks are still failing:

- **lint**: Check run failure ([details](https://github.com/gsd-build/gsd-2/actions/runs/25949304672/job/76283857119))

Manual investigation may be required.

Approved status-check tasks:
None

Approved documentation tasks:
None

When done:
1) Run the relevant verification for your changes.
2) Leave any changed files in the worktree for the babysitter app to finalize.
3) For each feedback item you addressed or were blocked on, emit a summary block in the following format:
   FEEDBACK_SUMMARY_START <auditToken>
   <A concise 1-2 sentence summary of what you did or why you were blocked>
   FEEDBACK_SUMMARY_END
   Include one block per audit token. These summaries will be posted as follow-up comments on the PR.
4) If documentation tasks were assigned, emit exactly one docs summary block in the following format:
   DOCS_SUMMARY_START <changed|no_change>
   <A concise 1-2 sentence summary of the docs you updated, or why no docs changes were necessary after inspection>
   DOCS_SUMMARY_END

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.

[Bug]: Terminal rendering glitch / display misalignment when scrolling up in GSD‑2 CLI

1 participant