CLI 0.162.0 panics at terminal_hyperlinks.rs:392: UTF-8 boundary inside ➡ while rendering Chinese text
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start at remap_source_wrapped_line in codex-rs/tui/src/terminal_hyperlinks.rs near line 392, where text[source_byte..wrapped.range.start] panics. Trace where wrapped.range values come from, since the invalid offset is the upstream cause, and note that the #52330 clamp does not cover it. Done means a regression test that remaps long CJK text with emoji such as ➡️ across several wrap widths without panicking, with visible text and source mappings preserved.
Written by the indexing model from the issue text.
Description
What version of Codex CLI is running?
codex-cli 0.162.0, installed globally via npm (@openai/codex). The npm latest endpoint also returned 0.162.0 when checked.
What subscription do you have?
Not provided.
Which model were you using?
Not confirmed for the crashing turn.
What platform is your computer?
Linux 7.0.0-38-generic x86_64 GNU/Linux.
What terminal emulator and version are you using (if applicable)?
Kitty 0.49.0, with zsh.
Codex doctor report
Not collected. No account credentials or private workspace logs are included in this report.
What issue are you seeing?
The interactive Codex CLI panicked and exited to the shell while handling a Chinese question containing emoji. The terminal retained this error:
The application panicked (crashed).
Message: end byte index 159 is not a char boundary; it is inside '➡' (bytes 158..161) of [application text omitted for privacy]
Location: tui/src/terminal_hyperlinks.rs:392
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
What steps can reproduce the bug?
This is an observed crash, not yet a deterministic end-to-end reproducer. The exact terminal dimensions and triggering UI action were not captured, and a full backtrace is unavailable.
- Run
codexversion 0.162.0 in Kitty. - The affected interaction contains a long Chinese question, including
➡️(business text omitted). - The TUI exits with the panic above during source-range remapping.
The application's business text has been omitted for privacy. The original panic identifies ➡ at UTF-8 bytes 158..161; offset 159 is inside that character.
What is the expected behavior?
Rendering/wrapping Chinese text and emoji should not terminate the CLI. Source ranges used for slicing should remain valid UTF-8 boundaries and correctly map to the displayed text.
Additional information
The reported location matches the code in the 0.162.0 tag:
https://github.com/openai/codex/blob/rust-v0.162.0/codex-rs/tui/src/terminal_hyperlinks.rs#L392
Inside remap_source_wrapped_line:
source_column += display_width(&text[source_byte..wrapped.range.start]);
The panic indicates that the range start used here was inside a multibyte character. The upstream cause of the invalid wrapped range still needs investigation; this report does not establish that the arrow alone always triggers a crash.
Related change: #52330 (commit 22ebb0fb178fe369190123c256ba200585765725) clamps wrapped range offsets to text.len() to address a cursor sentinel past the end of the input. That particular clamp does not address this case: 159 is already below the input length but is not a character boundary. A local Python byte-boundary check using the reported text confirmed that min(159, len(text.encode("utf-8"))) remains 159 and the prefix still fails UTF-8 decoding. This was a boundary check only, not a Rust/TUI regression test.
Suggested investigation/regression coverage: exercise source-range remapping of long CJK questions with emoji/variation selectors across different wrap widths, and check both in-bounds character boundaries and preservation of visible text/source mappings.
- Dominant language
- Rust
- Stars
- 129k
- Forks
- 20.3k
- Avg merge
- 1m
- Merged PRs (30d)
- 998
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/codex
-
Python SDK: CodexClient.close() leaves the app-server's stdout/stderr pipes open (and never waits after kill)Possibly taken @akhil9tiet claimed this today. Openapp-server bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
openai/codex#54908 · 2 comments ·
Maintainers usually reply within 1 day
-
bug CLI tool-calls windows-os
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
bug tool-calls
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Clarification about NODE_REPL_TRUSTED_BROWSER_CLIENT_SHA256S in the VS Code extension environmentOpendocumentation extension windows-os
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
openai/codex#54780 · 1 comment ·
Maintainers usually reply within 1 day
-
bug context
Difficulty 2/5 Under an hour Newbie friendliness 74/100
Maintainers usually reply within 1 day
Similar issues
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
IntersectMBO/developer-experience#347 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
registrystack/registry-stack#2168 ·
Maintainers usually reply within 1 day
-
bug crate: 3d help wanted triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
kornia/kornia-rs#1203 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[Bug] ComponentType classifies 0x8A8A-0xEAEA as GREASE; mls-extensions §7.5 makes them private useOpen
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day