Skip to content

fix(session): survive OSC 8 hyperlink capacity exhaustion#326

Merged
forketyfork merged 2 commits into
mainfrom
fix/osc8-hyperlink-session-death
May 30, 2026
Merged

fix(session): survive OSC 8 hyperlink capacity exhaustion#326
forketyfork merged 2 commits into
mainfrom
fix/osc8-hyperlink-session-death

Conversation

@forketyfork
Copy link
Copy Markdown
Owner

Summary

  • Codex emits a lot of OSC 8 hyperlinks (clickable file paths in output). ghostty-vt allocates only 4 hyperlink slots per terminal page by default.
  • When a scroll operation copies a hyperlinked row to a page whose hyperlink set is already full, it returns HyperlinkSetOutOfMemory. That error escaped through stream.nextSlice() into processOutput(), which treated it as unrecoverable and killed the session.
  • The fix catches HyperlinkSetOutOfMemory, HyperlinkSetNeedsRehash, and HyperlinkMapOutOfMemory inside processOutput() and logs a warning instead. Affected cells lose their hyperlink, but the session keeps running. ghostty-vt already uses this exact strategy inside Terminal.print for the same failure mode.

Test plan

  • Run Codex in a terminal session long enough to generate substantial output with file links. Confirm the session stays alive throughout.
  • Check the Architect log and verify hyperlink capacity hits appear as WARN rather than causing event=session_failed.

Issue: terminal session dies when Codex emits too many OSC 8 hyperlinks.
ghostty-vt starts with 4 hyperlinks per page; scroll operations that copy
hyperlinked rows to full pages return HyperlinkSetOutOfMemory, which escaped
through processOutput() and marked the session dead.

Solution: catch HyperlinkSetOutOfMemory, HyperlinkSetNeedsRehash, and
HyperlinkMapOutOfMemory inside processOutput() and log a warning instead of
propagating them. Affected cells lose their hyperlink, but the session keeps
running. ghostty-vt already uses this strategy in Terminal.print for the same
class of failure.
@forketyfork forketyfork marked this pull request as ready for review May 30, 2026 18:15
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ca0c988de

ℹ️ 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".

Comment thread src/session/state.zig Outdated
…rors

Address review: nextSlice drops the unprocessed tail of the current PTY read
when a hyperlink capacity error occurs mid-buffer. Switch to next(byte) so only
the failing byte's side effect is lost; bytes after the failure point are still
dispatched to the terminal.
@forketyfork forketyfork merged commit c3d6c56 into main May 30, 2026
4 checks passed
@forketyfork forketyfork deleted the fix/osc8-hyperlink-session-death branch May 30, 2026 18:26
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.

1 participant