Skip to content

Windows Terminal tab title resets to 'Windows PowerShell' after Ctrl+C copy (v1.17.x regression) #32293

Description

@Vcza5

Description

In opencode v1.17.3+, pressing Ctrl+C to copy selected text in the TUI causes Windows Terminal's tab title to reset from the session title to "Windows PowerShell". The title does not recover on new messages, only on session rename (Ctrl+R) or route switch (Home -> Session). Downgrading to v1.16.2 resolves the issue entirely.

Environment

  • OS: Windows 11
  • Terminal: Windows Terminal 1.24.11321.0
  • Shell: PowerShell 7 (pwsh.exe)
  • OpenCode version: v1.17.3 through v1.17.6 (confirmed not fixed)
  • Profile: cmd.exe /c opencode via WT profile

Steps to Reproduce

  1. Start opencode in Windows Terminal
  2. Wait for TUI to load (tab title shows session title, e.g. "OC | ...")
  3. Mouse-select any text in the chat area
  4. Press Ctrl+C to copy
  5. Tab title immediately changes to "Windows PowerShell"
  6. Sending a new message does not restore the title
  7. Only Ctrl+R (rename session) or Ctrl+P to Home then back to Session restores it

Root Cause Analysis

The title is set via OpenTUI's renderer.setTerminalTitle() which outputs OSC 0 escape sequence. On Ctrl+C copy, something triggers a title reset. Windows Terminal falls back to startingTitle ("Windows PowerShell") either because an empty title is emitted or the OSC 0 sequence is not reaching ConPTY correctly.

Introduced between v1.16.2 and v1.17.3. The ConPTY rewrite in WT v1.22 may be a compounding factor but is not the root cause (v1.16.2 works fine on the same WT version).

Workaround

Downgrade to v1.16.2: npm install -g opencode-ai@1.16.2

Or set suppressApplicationTitle: true in the WT profile (disables all app-driven title changes).

Related

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions