Skip to content

Escape terminal controls in commit subjects and PR context - #4605

Merged
max-sixty merged 1 commit into
mainfrom
codex/escape-terminal-controls
Oct 27, 2026
Merged

max-sixty merged 1 commit into
mainfrom
codex/escape-terminal-controls

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Commit subjects and forge metadata could emit terminal commands in styled output, including OSC 52 clipboard sequences. Escape control bytes with the existing helper before truncating or styling the list message and PR/MR context. JSON retains the original subject.

Regression tests reproduce both input paths and verify that application styling remains enabled. Both also passed real 80-column xterm PTY probes. Independent review found no issues.

Local validation: linting, documentation, and doctests passed. The full gate ran 5,443 tests: 5,440 passed and three failed in foreground-process, fish-wrapper, and detached-removal tests outside the changed paths.

This was written by Codex on behalf of max-sixty

@max-sixty
max-sixty merged commit 215507b into main Oct 27, 2026
46 of 47 checks passed
@max-sixty
max-sixty deleted the codex/escape-terminal-controls branch October 27, 2026 01:11
max-sixty pushed a commit that referenced this pull request Nov 8, 2026
`wt list`'s Summary column printed the first line of the configured
`[commit.generation]` command's output without escaping. #4605 made the
Message column run commit subjects through `escape_controls` before
truncating, but the Summary column was left out. So an ESC, BEL or CR in
the LLM's reply, such as an OSC 52 clipboard sequence echoed from a diff
it was asked to summarize, went straight to the terminal and also threw
off the width math that keeps columns aligned. The path is
`compute_summary_generate` → `generate_summary_core` →
`execute_llm_command`, which only trims the output, then `render_cell`.

This PR escapes the summary in the Summary arm of `render_cell`, as the
Message arm already does. JSON output still carries the raw text,
matching #4605.

`test_summary_column_rendering` gets a fourth case: a summary containing
an OSC 52 sequence now renders as visible `\u{1b}…\u{7}` escapes.
Without the fix, that case fails.

The picker's Summary preview tab renders the full generated summary
through its own path, and this PR doesn't change it.

Found during the nightly survey by reading the code, not from a user
report.

Co-authored-by: worktrunk-bot <[email protected]>
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.

2 participants