Skip to content

Revert "fix: solve #3028 — forward DA1 query responses during shell init"#3127

Merged
Kitenite merged 1 commit into
mainfrom
revert-3030-triage/issue-3028-23758493792
Apr 3, 2026
Merged

Revert "fix: solve #3028 — forward DA1 query responses during shell init"#3127
Kitenite merged 1 commit into
mainfrom
revert-3030-triage/issue-3028-23758493792

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Apr 3, 2026

Reverts #3030


Summary by cubic

Reverts the change that forwarded headless emulator DA/DSR responses during shell init, restoring the previous behavior of dropping them while the shell is pending. This avoids queued query replies appearing as typed text; once a client attaches, the renderer handles terminal queries.

Written for commit fd4d431. Summary will update on new commits.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved terminal session handling to properly respect shell initialization state before processing emulator responses.
  • Tests

    • Removed obsolete test suite for terminal response forwarding behavior.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 3, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 36eeb5e0-592a-4664-aeb8-c0e52faba516

📥 Commits

Reviewing files that changed from the base of the PR and between be22b46 and fd4d431.

📒 Files selected for processing (2)
  • apps/desktop/src/main/terminal-host/session-shell-ready.test.ts
  • apps/desktop/src/main/terminal-host/session.ts

📝 Walkthrough

Walkthrough

The pull request removes tests validating headless emulator response forwarding during shell initialization and modifies the session logic to skip forwarding when shell readiness is "pending".

Changes

Cohort / File(s) Summary
Test Removal
apps/desktop/src/main/terminal-host/session-shell-ready.test.ts
Deleted 51 lines: removed waitForEmulatorFlush() helper and entire test suite for DA1 query response forwarding, including tests for fish capability queries and DSR handling during pending shell state.
Shell Readiness Logic
apps/desktop/src/main/terminal-host/session.ts
Added shell initialization state check in headless-emulator onData handler: emulator output forwarding to PTY now skips when shellReadyState is "pending", replacing previous behavior that forwarded terminal responses during shell init.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

Hoppity-hop, a test bids farewell,
"Pending" state needs no query to tell!
The flow grows cleaner, the logic more bright,
Shell initialization simplified just right! 🐰

✨ 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 revert-3030-triage/issue-3028-23758493792

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.

@Kitenite Kitenite merged commit 88bc7fb into main Apr 3, 2026
6 of 7 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 3, 2026

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 3, 2026

Greptile Summary

This PR reverts #3030, which had forwarded headless-emulator terminal query responses (DA1, DSR) to the subprocess during shell init. The revert adds an early-return guard in the emulator.onData callback that drops all emulator-generated data whenever shellReadyState === "pending", and removes the two corresponding test cases.

Key concerns:

  • The comment justifying the new guard is factually incorrect — sendWriteToSubprocess bypasses preReadyStdinQueue entirely, so responses would never "appear as typed text once flushed." If there is a legitimate reason to revert (e.g. the headless emulator generates malformed DA1 responses), it is not documented here.
  • The revert reintroduces the fish-shell 10-second startup delay described in issue Add Primary Device Attribute (DA1) query response support #3028: fish sends DA1 at startup and waits up to 10 seconds for a reply; with this guard in place, no reply arrives during the 15-second pending window, so fish will always degrade its feature set on headless startup.
  • No explanation is provided in the PR description for why fix: solve #3028 — forward DA1 query responses during shell init #3030 is being reverted; understanding the regression it caused would help determine whether a more targeted fix is feasible.

Confidence Score: 2/5

  • Not safe to merge as-is — reintroduces a confirmed user-facing bug (Add Primary Device Attribute (DA1) query response support #3028) without documented justification for the trade-off.
  • The change is small and structurally clean, but it knowingly reintroduces a 10-second fish-shell startup regression that was fixed in the PR being reverted. The comment used to justify the behavioral change is inaccurate, and there is no documented reason in the PR description explaining what regression in fix: solve #3028 — forward DA1 query responses during shell init #3030 motivated this revert. Until the root cause is explained and either the original bug is re-fixed or the trade-off explicitly accepted, the PR should not merge.
  • apps/desktop/src/main/terminal-host/session.ts — the emulator.onData guard and its comment need attention.

Important Files Changed

Filename Overview
apps/desktop/src/main/terminal-host/session.ts Reverts DA1/DSR forwarding during pending shell-ready state; adds an early-return guard that drops headless-emulator responses when shellReadyState === "pending", reintroducing the fish-shell 10-second startup delay from #3028. The comment justifying this guard is factually inaccurate (responses never go through preReadyStdinQueue via the onData path).
apps/desktop/src/main/terminal-host/session-shell-ready.test.ts Removes the two DA1/DSR forwarding tests added in #3030; the remaining test suite is consistent with the reverted behavior.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Fish shell starts\nSends DA1 query ESC-c] --> B{attachedClients.size === 0?}
    B -- No --> C[Renderer xterm handles DA1\nForwards response to shell]
    B -- Yes --> D[HeadlessEmulator processes DA1\nGenerates response via onData]
    D --> E{shellReadyState === pending?\nNEW GUARD added by this revert}
    E -- Yes --> F[🚫 Response DROPPED\nFish waits up to 10s for reply\nIssue 3028 reintroduced]
    E -- No --> G[sendWriteToSubprocess\nResponse forwarded to shell]
    F --> H[After 10s timeout:\nFish disables cursor-shape\nand reflow detection]
Loading

Reviews (1): Last reviewed commit: "Revert "fix: solve #3028 — forward DA1 q..." | Re-trigger Greptile

Comment on lines +227 to +231
// The headless emulator responds to terminal queries (e.g. DA)
// when no renderer client is attached. During shell init we drop
// these — they'd land in the pre-ready stdin queue and appear as
// typed text like "?62;4;9;22c" once flushed. After a client
// attaches the renderer's xterm handles all terminal queries.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Inaccurate comment — sendWriteToSubprocess bypasses the preReadyStdinQueue

The comment justifies dropping headless-emulator responses during pending by saying they'd "land in the pre-ready stdin queue and appear as typed text like ?62;4;9;22c once flushed." This is factually incorrect.

The onData callback calls this.sendWriteToSubprocess(data) directly, not this.write(data). Only write() routes through preReadyStdinQueue. The emulator's response would be sent straight to the subprocess's stdin — it would never touch the pre-ready queue. If the real motivation is something else (e.g. the headless emulator generates an incorrect or incomplete DA1 response that confuses fish/zsh), the comment should say so.

this.subprocess &&
this.subprocessReady
) {
if (this.shellReadyState === "pending") return;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Reintroduces fish shell 10-second startup delay (#3028)

By returning early when shellReadyState === "pending", this change drops all headless-emulator responses (DA1, DSR, etc.) during the critical shell-init window. Fish shell sends a DA1 query (\x1b[c) at startup and waits up to 10 seconds for a response before disabling cursor-shape changes and reflow detection.

The SHELL_READY_TIMEOUT_MS is 15 seconds, so when a session starts without a renderer client attached, fish's 10-second DA1 timeout will always fire before the shell-ready marker arrives, degrading the shell experience every single headless startup.

The original PR #3030 was specifically introduced to fix this. If this revert is needed because #3030 introduced a separate regression, that regression should be documented here (and ideally addressed separately) so the trade-off is clear.

MocA-Love pushed a commit to MocA-Love/superset that referenced this pull request Apr 5, 2026
MocA-Love added a commit to MocA-Love/superset that referenced this pull request Apr 5, 2026
cherry-pick方式で内容を取り込み済みの14コミットをgit履歴上もマージ済みにする。

取り込み済み (cherry-pick / 手動移植):
- be22b46 superset-sh#3125 — スキップ (下記参照)
- 88bc7fb superset-sh#3127 — Revert DA1 ✓
- 92d0ff9 superset-sh#3054 — DA1 fix ✓
- c48450e superset-sh#3093 — file viewer pane fix ✓
- fffa8db superset-sh#3128 — version 1.4.7 ✓
- 589a7c7 superset-sh#3136 — fuzzy scorer (ハイブリッド方式) ✓
- ceb8c81 superset-sh#3150 — Electron 40.8.5 ✓
- 8922b94 superset-sh#3137 — terminalId分離 ✓
- c7508e5 superset-sh#3152 — GitHub無料化 ✓
- 2b91f11 superset-sh#3155 — v2 terminal theme ✓
- b8b11af superset-sh#3154 — TUI dimension fix ✓
- 7599ace superset-sh#3149 — v2 sidebar file tree (手動統合) ✓
- 4d7c612 superset-sh#3174 — DnD重複削除 ✓
- 864977d superset-sh#3157 — Host Service分離 ✓

意図的にスキップ:
- be22b46 superset-sh#3125 (GitHub polling簡素化)
  フォーク独自のGitHubSyncService (バックエンド集中ポーリング) と
  設計が異なるため不採用。upstreamはフロントエンドhover駆動、フォークは
  バックエンドキャッシュウォーマー方式。詳細は githubQueryPolicy.ts と
  github-sync-service.ts のFORK NOTEを参照。

ゴースト・マージ復元 (revert 134cfd5 で消失した内容):
- 538f306 superset-sh#3120 — Patch vuln ✓
- 1588d20 superset-sh#3108 — terminal lifecycle分離 ✓
- 59426f6 superset-sh#3122 — file tree + FilePane + Alert refactor (手動統合) ✓
- 10d9a5d superset-sh#3097 — tiptap line-height ✓
- 337a9ae superset-sh#3121 — Codex hooks削除 ✓
@Kitenite Kitenite deleted the revert-3030-triage/issue-3028-23758493792 branch May 6, 2026 04:54
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.

1 participant