Repository navigation
fix(cli): preserve terminal contrast across light and dark themes - #729
mergify[bot] merged 12 commits into
Conversation
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of 9653874. No blocking correctness or regression findings.
The fix addresses the cause described in #728 at the shared rendering boundary. Removing the forced foreground colors lets the terminal choose readable text colors while retaining bold, italic, and heading emphasis. I inspected the locked termimad 0.23.2 implementation: its default skin provides those attributes without foreground overrides for these elements, and no_style removes the code/table styling as well. I also verified the separate crossterm versions: the renderer's 0.23.2 dependency does not implement the NO_COLOR handling present in the CLI's 0.29 dependency, so handling this explicitly in the renderer is justified.
I traced chat --no-color through process-environment initialization and checked both incremental rendering and the server-admission final-text caller. The presence-based NO_COLOR behavior, including an empty value, is consistent with the existing CLI theme/rendering checks. The change stays in the canonical renderer and does not introduce a terminal-specific theme detector or another rendering path.
The tests exercise useful observable behavior: vt100 cell foreground/background and emphasis for ordinary text, list labels, and headings; content preservation and absence of style escapes across code, quotes, lists, and tables; and subprocess-isolated environment cases that verify the selected test actually ran. Streaming cursor control remains outside the documented no-style contract.
Independent validation:
- Compiled the actual streaming_md, terminal_region, and output_sink modules in an isolated Cargo test harness, using the repository's test stdout macro and pinned direct dependencies: all 47 tests passed.
- git diff --check against the PR base passed.
- Reviewed both changed files and the relevant callers/dependency implementation.
Limits: this was focused module validation, not a full Astra Cargo/workspace build or a live CLI/model session. I did not visually validate Ghostty or other native terminal applications. The combined-status API returned no status entries, so this review does not claim that all CI checks are green.
Merge Queue Status
This pull request spent 18 minutes 4 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #729 has been dequeued Queue conditions are not satisfied:
Failing checks:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Requeued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 2 minutes 46 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. Requeued — the merge queue status continues in this comment ↓. |
aad3ab6 to
eed5ab8
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of e9b8c71 against 9db5806. This is substantially broader than the small rendering patch I previously approved. I found no confirmed blocking defect in the reviewed code.
The presentation changes use terminal-default body foregrounds, pair opaque surfaces with explicit foregrounds, and share the selected palette with syntax highlighting. Stderr rendering uses its own capability selection. Explicit profiles, unknown-background fallback, and NO_COLOR remain deliberate choices rather than assuming every terminal is dark.
I traced StartupTerminal through asynchronous initialization, terminal ownership handoff, and the shutdown monitor; inspected the shared OSC framing, filtered-event queue, both Unix reader backends, and late DA1/Sixel handling. The query shares the existing input reader, limits its response wait, and does not start a competing TUI Sixel probe. The explicit normal-session Esc tradeoff and malformed-response recovery behavior are documented. Vendoring crossterm creates an ongoing maintenance obligation, but the patch documents provenance, modified files, and a retirement condition.
The PTY tests meaningfully exercise the real guard/query/poll/EventStream boundary, including fragmented replies, keyboard/paste preservation, cancellation, terminal restoration and late capabilities. The surface/highlighting tests check rendered properties rather than only selecting an enum. I also inspected the Ubuntu-source isolation change: it retains repository verification and failure propagation rather than ignoring apt errors.
Validation: current-head Static Checks jobs passed, as did PR Title and several Test Suite shards. CLI non-edge, runtime and other tests were still running at the latest check: https://github.com/matrixorigin/Astra/actions/runs/34384931626 . Local git diff --check passed when excluding vendor; the full base-to-head check reports trailing whitespace in vendored Markdown documentation. That is not a correctness blocker, but the PR description's clean full-diff claim does not match my check. This environment has no available Rust/Cargo toolchain, so I did not independently execute the Rust/PTY suites, either Unix backend, a complete CLI session, or native-terminal visual acceptance. The author's local test counts are not my execution results. Approval is a source-review conclusion; outstanding CI still needs to pass.
Rechecked the live head before submission; it remains e9b8c71.
Merge Queue Status
This pull request spent 18 seconds in the queue, including 2 seconds running CI. Required conditions to merge
|
Summary
Fixed light foregrounds and dark panels made parts of Astra unreadable on light terminals. Use terminal-default body text, paired foreground/background surfaces, and a shared light/dark palette for welcome text, conversation input, syntax highlighting, and the exit resume hint. Keep colorful ANSI accents when the background is unknown.
Interactive startup now queries OSC 10/11 and DA1 through the existing crossterm reader before choosing the theme. This includes a vendored crossterm 0.29 patch and the follow-up fixes for startup cancellation, Esc delivery, malformed replies, initialization order, and late Sixel capability replies.
Rust CI linker setup now limits APT to the runner’s Ubuntu sources, so an unrelated Chrome repository hash mismatch cannot block all Rust jobs. Ubuntu source failures and package verification remain enforced.
Related issue
Closes #728
Change type
User and compatibility impact
astradefaults to automatic theme selection; ordinary users need no environment configuration. Interactive Unix terminals share a 300 ms startup response budget for colors and DA1. Missing colors fall back per channel to environment hints and terminal defaults. Explicit profiles andNO_COLORremain supported./dev/ttyprobe.vendor/crossterm/ASTRA-PATCH.mdand the configuration reference.Architecture and complexity delta
StartupTerminal, and the crossterm input reader. Signal cancellation uses the existing TUI shutdown monitor. Session, provider, policy, and database semantics are unchanged.ASTRA-PATCH.md.Verification
CI setup follow-up (
e9b8c71e1): executed the actual workflow shell block in an Ubuntu 24.04 amd64 Docker container. The original command failed with an injected broken third-party repository; the updated block installed mold 2.30.0 successfully. Verified both deb822 and legacy sources.list layouts, preservation of source files and existing RUSTFLAGS, and fatal failure with no RUSTFLAGS update when the selected Ubuntu source is broken. This tests repository failure isolation, not a byte-for-byte reproduction of the remote Chrome hash mismatch.python3 scripts/ci/validate_repository.pyandgit diff --checkpassed. Full Rust CI results remain pending.Commands and results (local macOS arm64, offline; no live provider or credentials):
cargo test -p astra-cli --lib tui::terminal_startup --locked --offline -- --test-threads=2— 14 passed.cargo test -p astra-cli --lib --features crossterm/use-dev-tty tui::terminal_startup --locked --offline -- --test-threads=2— 14 passed. Terminal restoration compares all settings except Darwin's transient kernelPENDINbit; a plain raw/restore pair independently reproduced that bit change.tui::terminal_palette::,tui::theme::,tui::render::highlight::,tui::event::,banner_and shutdown-label test filters — 40 passed.cargo test --manifest-path vendor/crossterm/Cargo.toml --lib --features event-stream --offline— 105 passed, 7 upstream interactive tests ignored.cargo clippy -p astra-cli -p astra-tools --lib --locked --offline -- -D warnings— passed.cargo clippy --manifest-path vendor/crossterm/Cargo.toml --lib --features event-stream --locked --offline -- -D warnings— passed; also passed withevent-stream,use-dev-tty.make format-checkandgit diff --check— passed.cargo build -p astra-cli --bin astra --locked --offline— passed from the working tree used for this update. macOS emitted the compact-unwind size warning for the debug link.Public entrypoint exercised: the real startup guard, terminal query API,
poll, TUI EventStream, theme/render owners, Sixel tool's unknown-capability path, and local CLI build. Synthetic PTY replies avoid model/network dependencies. Full workspace tests and Linux CI were not run locally; real-terminal visual acceptance of this latest binary remains pending.Unhappy paths exercised: no response, fragmented/late/malformed/oversized OSC replies, standalone Esc and Esc-then-character, arrows/Alt, CJK and bracketed paste, Ctrl-C during query/asynchronous startup and after handoff, early palette/theme access, delayed/negative/missing DA1, manual profiles/backgrounds, NO_COLOR, and redirected input/output.
Database verification: N/A; no database changes or migrations.
Final checklist
explained why no test is needed.
change needs no documentation update.
generated files, and other sensitive information.