Skip to content

fix(tui): harden terminal dimming and multiplexer copy#14906

Merged
teknium1 merged 1 commit into
mainfrom
bb/fix-tui-terminal-compat
Apr 24, 2026
Merged

fix(tui): harden terminal dimming and multiplexer copy#14906
teknium1 merged 1 commit into
mainfrom
bb/fix-tui-terminal-compat

Conversation

@OutThisLife

Copy link
Copy Markdown
Collaborator

Summary

  • disable ANSI dim by default on VTE terminals so reasoning text and accent colors stay readable on dark backgrounds, with an env override for terminals that want the old behavior
  • stop emitting local multiplexer OSC52 copy sequences by default so copy actions do not boomerang back into the TUI as repeated paste events, while keeping remote passthrough and opt-in override support
  • add regression coverage for both compatibility decisions in the shared hermes-ink layer

Test plan

  • cd ui-tui && ./node_modules/.bin/vitest run
  • cd ui-tui && ./node_modules/.bin/tsc --noEmit -p tsconfig.json (currently fails on pre-existing packages/hermes-ink/src/ink/dom.ts error unrelated to this PR)
  • Manual check in a VTE terminal dark theme and a local tmux/cmux session

- disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable
- suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Apr 24, 2026
@OutThisLife OutThisLife requested a review from Copilot April 24, 2026 05:43
@teknium1 teknium1 merged commit acdcb16 into main Apr 24, 2026
12 of 13 checks passed
@teknium1 teknium1 deleted the bb/fix-tui-terminal-compat branch April 24, 2026 05:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Hardens TUI terminal compatibility by changing defaults for ANSI dim (on VTE terminals) and OSC52 clipboard emission (in local multiplexers), with environment-variable overrides and regression tests.

Changes:

  • Add shouldUseAnsiDim() and gate dim styling to disable ANSI dim by default on VTE terminals (override via HERMES_TUI_DIM).
  • Add shouldEmitClipboardSequence() and suppress OSC52 clipboard sequences by default in local tmux/screen sessions (override via HERMES_TUI_CLIPBOARD_OSC52 / HERMES_TUI_COPY_OSC52), while keeping remote behavior.
  • Add Vitest coverage for both new compatibility decisions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
ui-tui/packages/hermes-ink/src/ink/termio/osc.ts Adds env-driven OSC52 emission decision and applies it to setClipboard().
ui-tui/packages/hermes-ink/src/ink/termio/osc.test.ts Adds tests for OSC52 emission decision defaults and overrides.
ui-tui/packages/hermes-ink/src/ink/components/Text.tsx Adds env-driven ANSI dim decision and gates dim usage accordingly.
ui-tui/packages/hermes-ink/src/ink/components/Text.test.ts Adds tests for ANSI dim decision defaults and override behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +86 to +88
export function shouldEmitClipboardSequence(env: NodeJS.ProcessEnv = process.env): boolean {
const override = (env.HERMES_TUI_CLIPBOARD_OSC52 ?? env.HERMES_TUI_COPY_OSC52 ?? '').trim()

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

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

The parameter name env in shouldEmitClipboardSequence shadows the imported env helper from ../../utils/env.js used elsewhere in this module (e.g., osc()). This makes the code harder to read/grep and can lead to accidental misuse. Consider renaming the parameter to something like processEnv or envVars.

Copilot uses AI. Check for mistakes.
Comment on lines +97 to +98
return !!env['SSH_CONNECTION'] || (!env['TMUX'] && !env['STY'])
}

Copilot AI Apr 24, 2026

Copy link

Choose a reason for hiding this comment

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

With the new default (!env['TMUX'] && !env['STY']), local GNU screen sessions (STY set, no SSH_CONNECTION) will suppress OSC52 emission, but getClipboardPath() still returns 'osc52' for screen because it only checks TMUX. That can make caller UX/toasts inaccurate and also removes the previous OSC52 fallback when no native clipboard tool is available. Consider updating getClipboardPath() to incorporate the new emission decision (or add a 'native-only'/'none' path when emission is suppressed).

Copilot uses AI. Check for mistakes.
Comment thread ui-tui/packages/hermes-ink/src/ink/termio/osc.ts
nekorytaylor666 pushed a commit to nekorytaylor666/hermes-agent that referenced this pull request Apr 24, 2026
…14906)

- disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable
- suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
justrhoto pushed a commit to justrhoto/hermes-agent that referenced this pull request Apr 24, 2026
…14906)

- disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable
- suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
ulasbilgen pushed a commit to ulasbilgen/hermes-adhd-agent that referenced this pull request May 1, 2026
…14906)

- disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable
- suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
aj-nt pushed a commit to aj-nt/hermes-agent that referenced this pull request May 1, 2026
…14906)

- disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable
- suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
donald131 pushed a commit to donald131/hermes-agent that referenced this pull request May 2, 2026
…14906)

- disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable
- suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…14906)

- disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable
- suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…14906)

- disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable
- suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…14906)

- disable ANSI dim on VTE terminals by default so dark-background reasoning and accents stay readable
- suppress local multiplexer OSC52 echo while preserving remote passthrough and add regression coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants