GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tui): stop session titles with newlines from crashing the TUI by ruck-syu · Pull Request #57523 · anomalyco/opencode

Conversation

@ruck-syu

@ruck-syu ruck-syu commented Oct 20, 2026 •
edited by opencode-agent Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #57494

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

If a session title has a newline, tab or other control character in it, the TUI crashes with ot_session_control failed: InvalidArgument. The title goes straight to OpenTUI's setTerminalTitle and the native side rejects it. Nothing catches the error, so the whole app dies. Renaming the session was the only way out.

All title updates already go through setTerminalTitle in util/renderer.ts, so I replaced control characters (C0, DEL and C1) with a space there. That covers the main TUI, the mini TUI and the clear on exit.

I only touched characters OpenTUI actually rejects. I tried emoji, CJK, bidi marks, zero-width joiner and lone surrogates and those are accepted fine, so they are left alone. A very long title is also rejected, but every caller already cuts it to 40 characters, so I didn't add anything for that.

How did you verify your code works?

  • Added a test for a title with a newline and a tab. bun test in packages/tui passes, and I ran it 10 times with --rerun-each 10.
  • bun run check is clean.
  • Ran the repro script from the issue with opencode-drive. Without the change the TUI crashes with the same stack trace as the issue. With it, the title updates fine and the TUI still answers a new prompt afterwards. I also tried a tab, an escape sequence and a C1 character.

Screenshots / recordings

Before (dev):
before-crash

After:
after-fixed

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Related: #47687

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ruck-syu
fix(tui): sanitize control characters in the terminal title
49d133c
@github-actions

github-actions Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

opencode-agent[bot]
opencode-agent Bot reviewed Oct 20, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Fixes the crash. I ran the #57494 opencode-drive repro with a session title containing a newline, an ESC sequence and a C1 character. On the base the TUI goes to the crash screen with ot_session_control failed: InvalidArgument. With this change the session view stays up and the title is set (screenshots below). bun test test/util/renderer.test.ts and typecheck in packages/tui pass.

Public API: unchanged. The change only touches the internal TUI title helper.

No blocking concerns. Since every title update goes through setTerminalTitle, sanitizing there covers the main TUI, the mini TUI and the clear on exit.

Related: #47687

Before

After

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Oct 23, 2026
TUI crash: ot_session_control failed: InvalidArgument #58360
Closed
TUI crash: ot_session_control failed: InvalidArgument #58369
Closed
TUI crash: ot_session_control failed: InvalidArgument #59274
Closed
@Tarquinen
test(tui): check control-character titles against the real renderer
8726605
@Tarquinen Tarquinen changed the title fix(tui): sanitize control characters in the terminal title fix(tui): stop session titles with newlines from crashing the TUI Nov 4, 2026
@Tarquinen
Tarquinen enabled auto-merge (squash) November 4, 2026 21:46
@Tarquinen
Tarquinen merged commit 65f646f into anomalyco:dev Nov 4, 2026
15 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@amrkmn amrkmn mentioned this pull request Nov 7, 2026
opencode 2.2.6 amrkmn/homebrew-tap#1217
Closed
1 task
This was referenced Nov 7, 2026
feat: opencode release v2.2.6 sprisa/opencode-server#84
Merged
Tool release: OpenCode 2 v2.2.6 (was v2.2.5) agent-sh/agnix#1808
Closed
@opencodejr opencodejr Bot mentioned this pull request Nov 11, 2026
TUI crash: ot_session_control failed: InvalidArgument #63344
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencode-agent opencode-agent[bot] opencode-agent[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

TUI crash: ot_session_control failed: InvalidArgument

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ruck-syu @Tarquinen
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.