fix(cli): adopt DA1 sandwich technique for robust OSC color query detection#986
fix(cli): adopt DA1 sandwich technique for robust OSC color query detection#986graphite-app[bot] merged 1 commit intomainfrom
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
How to use the Graphite Merge QueueAdd the label auto-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b73c07ccc
ℹ️ 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".
6b73c07 to
ab0d96c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ab0d96ca63
ℹ️ 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".
ab0d96c to
a855793
Compare
a855793 to
c8801ed
Compare
c8801ed to
cf721f2
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf721f232e
ℹ️ 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".
cf721f2 to
3e7fd1a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3e7fd1ace0
ℹ️ 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".
3e7fd1a to
403de46
Compare
403de46 to
f45a3fe
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f45a3fe0c1
ℹ️ 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".
f45a3fe to
2ca0070
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Merge activity
|
…ection (#986) Replace ad-hoc environment checks (CI, Warp, tmux, Docker) with a comprehensive `is_osc_query_unsupported()` pre-screen modelled after `terminal-colorsaurus`, and implement the DA1 sandwich technique to detect unsupported terminals at runtime without waiting for timeouts. Key changes: - Centralized quirks detection covering CI, Docker, devcontainers, Kubernetes, Emacs, GNU Screen, Eterm, tmux, and TERM=dumb - DA1 sentinel query appended after OSC queries; if its response arrives first the terminal doesn't support OSC and we bail immediately - drain_da1() consumes the trailing DA1 response to prevent leaks - BEL terminator instead of ST to work around urxvt response bug - SSH-aware timeout (1000ms vs 200ms local) - Ported regression test from terminal-colorsaurus issue #38 - Extended test coverage for parsing edge cases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Touches low-level `/dev/tty` I/O, raw-mode handling, and timeout/polling logic, so regressions could reintroduce hangs or garbled terminal output in edge-case terminals/environments. > > **Overview** > Makes terminal color detection for the Vite+ CLI header more robust by replacing ad-hoc OSC query handling with a centralized `is_osc_query_unsupported()` pre-screen and a DA1 “sandwich” sentinel to quickly detect terminals that won’t answer OSC color queries. > > Reworks `query_terminal_colors` to send BEL-terminated OSC 10/4 queries plus DA1, parse responses from `/dev/tty` via `BufReader` with delimiter-aware reads, apply SSH-aware timeouts, and drain DA1/CSI output to prevent escape-sequence leakage; adds extensive unit tests covering hex/RGB parsing edge cases, BEL termination, stream parsing helpers, and a non-hanging regression test. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2ca0070. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
2ca0070 to
af9cc5b
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2f33995a3
ℹ️ 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".
…ection (#986) Replace ad-hoc environment checks (CI, Warp, tmux, Docker) with a comprehensive `is_osc_query_unsupported()` pre-screen modelled after `terminal-colorsaurus`, and implement the DA1 sandwich technique to detect unsupported terminals at runtime without waiting for timeouts. Key changes: - Centralized quirks detection covering CI, Docker, devcontainers, Kubernetes, Emacs, GNU Screen, Eterm, tmux, and TERM=dumb - DA1 sentinel query appended after OSC queries; if its response arrives first the terminal doesn't support OSC and we bail immediately - drain_da1() consumes the trailing DA1 response to prevent leaks - BEL terminator instead of ST to work around urxvt response bug - SSH-aware timeout (1000ms vs 200ms local) - Ported regression test from terminal-colorsaurus issue #38 - Extended test coverage for parsing edge cases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes low-level `/dev/tty` I/O and escape-sequence parsing to avoid hangs/leaked output across many terminal environments; mistakes could regress header color detection or terminal interaction timing. > > **Overview** > Makes Vite+ header color probing **more robust across terminal emulators and container/CI environments** by replacing ad-hoc OSC query handling with a centralized `is_osc_query_unsupported()` gate plus the *DA1 sandwich* technique to detect lack of OSC support without waiting for timeouts. > > Reworks `query_terminal_colors` to send **BEL-terminated** OSC queries (urxvt workaround), parse responses **sequentially from the tty stream** via `BufReader` (with a poll-based, deadline-aware reader), and drain trailing DA1 output; also adds SSH-aware timeouts. > > Expands unix test coverage for hex/RGB parsing, BEL termination, mixed-response buffers, `read_until_either`, and includes a regression test ensuring `query_terminal_colors` doesn’t hang in CI. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a2f3399. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
a2f3399 to
cd41d58
Compare
…ection (#986) Replace ad-hoc environment checks (CI, Warp, tmux, Docker) with a comprehensive `is_osc_query_unsupported()` pre-screen modelled after `terminal-colorsaurus`, and implement the DA1 sandwich technique to detect unsupported terminals at runtime without waiting for timeouts. Key changes: - Centralized quirks detection covering CI, Docker, devcontainers, Kubernetes, Emacs, GNU Screen, Eterm, tmux, and TERM=dumb - DA1 sentinel query appended after OSC queries; if its response arrives first the terminal doesn't support OSC and we bail immediately - drain_da1() consumes the trailing DA1 response to prevent leaks - BEL terminator instead of ST to work around urxvt response bug - SSH-aware timeout (1000ms vs 200ms local) - Ported regression test from terminal-colorsaurus issue #38 - Extended test coverage for parsing edge cases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes low-level `/dev/tty` I/O and escape-sequence parsing to avoid hangs/leaked output across many terminal environments; mistakes could regress header color detection or terminal interaction timing. > > **Overview** > Makes Vite+ header color probing **more robust across terminal emulators and container/CI environments** by replacing ad-hoc OSC query handling with a centralized `is_osc_query_unsupported()` gate plus the *DA1 sandwich* technique to detect lack of OSC support without waiting for timeouts. > > Reworks `query_terminal_colors` to send **BEL-terminated** OSC queries (urxvt workaround), parse responses **sequentially from the tty stream** via `BufReader` (with a poll-based, deadline-aware reader), and drain trailing DA1 output; also adds SSH-aware timeouts. > > Expands unix test coverage for hex/RGB parsing, BEL termination, mixed-response buffers, `read_until_either`, and includes a regression test ensuring `query_terminal_colors` doesn’t hang in CI. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit a2f3399. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
cd41d58 to
55642c2
Compare


Replace ad-hoc environment checks (CI, Warp, tmux, Docker) with a
comprehensive
is_osc_query_unsupported()pre-screen modelled afterterminal-colorsaurus, and implement the DA1 sandwich technique todetect unsupported terminals at runtime without waiting for timeouts.
Key changes:
Kubernetes, Emacs, GNU Screen, Eterm, tmux, and TERM=dumb
arrives first the terminal doesn't support OSC and we bail immediately
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Note
Medium Risk
Changes low-level
/dev/ttyI/O and escape-sequence parsing to avoid hangs/leaked output across many terminal environments; mistakes could regress header color detection or terminal interaction timing.Overview
Makes Vite+ header color probing more robust across terminal emulators and container/CI environments by replacing ad-hoc OSC query handling with a centralized
is_osc_query_unsupported()gate plus the DA1 sandwich technique to detect lack of OSC support without waiting for timeouts.Reworks
query_terminal_colorsto send BEL-terminated OSC queries (urxvt workaround), parse responses sequentially from the tty stream viaBufReader(with a poll-based, deadline-aware reader), and drain trailing DA1 output; also adds SSH-aware timeouts.Expands unix test coverage for hex/RGB parsing, BEL termination, mixed-response buffers,
read_until_either, and includes a regression test ensuringquery_terminal_colorsdoesn’t hang in CI.Written by Cursor Bugbot for commit a2f3399. This will update automatically on new commits. Configure here.