[DOCS] `claude attach` and `claude agents` reattach: literal `^[[I` / `^[[O` focus-event escape codes appear in the prompt

Open 💬 1 comment Opened Jul 7, 2026 by coygeek

Documentation Type

Incorrect/outdated documentation

Documentation Location

https://code.claude.com/docs/en/agent-view

Section/Topic

  • The "Attach to a session" subsection under "Monitor sessions with agent view" (around the paragraph that begins "Attached sessions always render in fullscreen mode").
  • The "Version history" table at the bottom of agent-view.md, which currently stops at v2.1.202.

Current Documentation

The "Attach to a session" section in agent-view.md currently describes what an attached session looks like without mentioning how the terminal mode state is reconciled when you reattach to a session that was started earlier:

Attached sessions always render in fullscreen mode, regardless of your tui setting, because a background session has no terminal scrollback to append to. Scroll with PgUp, PgDn, or the mouse wheel, and press Ctrl+O for transcript mode. Your terminal's native scroll and tmux copy mode show only the current viewport, the same as when you run any fullscreen application.

The version history table on the same page lists the latest entry as v2.1.202:

| v2.1.202 | {/ min-version: 2.1.202 /}A name set with /rename or Ctrl+R on a background session persists when the supervisor stops and restarts its process, instead of reverting to the name the session was dispatched with. |

fullscreen.md line 204 documents the alternate-screen behavior for attached sessions, but does not mention how terminal focus-tracking modes (DEC private mode 1004) are negotiated when a session is reattached:

Background sessions opened from agent view or claude attach always use fullscreen rendering. The attaching terminal enters the alternate screen buffer to show the session, and the classic renderer has no scrollback or mouse handling there, so the tui setting and CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN don't apply to them.

What's Wrong or Missing?

A. The reattach path printed the raw focus-event escape sequences before v2.1.203

The v2.1.203 changelog records:

Fixed literal ^[[I / ^[[O escape codes being printed when reattaching to a background session

^[[I (ESC [ I) is the DEC focus-in event and ^[[O (ESC [ O) is the focus-out event that terminals emit under DEC private mode 1004 ("report focus changes"). Before v2.1.203, attaching to a background session via claude attach <id> or from a row in claude agents left the terminal's focus-tracking mode in an inconsistent state for one render pass, so the first focus-in/focus-out events that followed were emitted as printable text in the prompt area instead of being consumed by the renderer. Users on terminals with focus tracking enabled (most modern emulators that opt in) saw a line like ^[[I^[[O or ^[[O^[[I appear right after claude attach returned the prompt.

B. The fix is not reflected on the page that documents attach behavior

agent-view.md is the canonical page for attaching to a background session, but it never describes what terminal mode state Claude Code reconciles on attach, or what the user should expect from focus events after reattach. The fix in v2.1.203 silently changes that behavior, so users who upgrade and notice the escape codes are gone have no doc entry to confirm it was intentional and to learn what to expect going forward.

C. The version history table still ends at v2.1.202

The version history table at the bottom of agent-view.md is the place users look to confirm a recent fix landed on this surface. The table currently stops at v2.1.202 and does not include a v2.1.203 row, so the focus-event fix is invisible to anyone reading the page.

Suggested Improvement

Add a row to the version history

Add a v2.1.203 row at the top of the version history table that calls out the focus-event fix:

| v2.1.203 | {/ min-version: 2.1.203 /}Reattaching to a background session via claude attach <id> or from a row in claude agents no longer prints the literal ^[[I and ^[[O focus-event escape sequences from your terminal's focus tracking in the prompt area; focus events are consumed by the renderer on the first frame after attach. Before v2.1.203, the first focus-in/focus-out events that followed reattach appeared as text. |

Add a short note in the "Attach to a session" section

Add a sentence right after the existing "Attached sessions always render in fullscreen mode..." paragraph so users hitting the symptom can find the cause:

{/ min-version: 2.1.203 /}As of v2.1.203, reattach also reconciles the terminal's focus-tracking state (DEC private mode 1004), so the focus-in (^[[I) and focus-out (^[[O) escape sequences your terminal emits when you switch to and from the Claude Code window are consumed by the renderer instead of being printed as text in the prompt. Before v2.1.203 those events could appear as a stray ^[[I^[[O line right after the prompt returned, on terminals with focus tracking enabled.

Impact

Medium - Makes feature difficult to understand

Additional Context

Affected Pages:
| Page | Context |
|------|---------|
| https://code.claude.com/docs/en/agent-view | "Attach to a session" section describes reattach behavior; version history table is the canonical place to log attach-path fixes |
| https://code.claude.com/docs/en/fullscreen | Attached sessions always use fullscreen rendering, so any fix that affects attached-session terminal behavior is also relevant context here |

Total scope: 2 pages affected.

Version note: The fix is in v2.1.203. The mirror's changelog currently ends at v2.1.202, so the entry will need to be added when the v2.1.203 release notes are written. The doc-side note and version history row can be drafted from this issue and merged alongside the release notes.

Related fixes documented elsewhere: Earlier releases included similar terminal-handling fixes on the attached-session path that were documented in the agent-view version history or troubleshooting section — for example:

  • v2.1.200: "Fixed control bytes from background-agent output reaching the terminal in the agent view"
  • v2.1.199: "Fixed Esc, arrow keys, and typing becoming unresponsive on Windows when attached to a background session or in the agent view while the host is under heavy CPU load"
  • v2.1.196: attached-session rendering, scrollback, and clipboard fixes
  • Earlier entries for cmd+k not repainting attached sessions, IME candidate placement, background-color bleed, and cmd+k repaint on macOS terminals

These are the same class of fix (terminal/control-byte cleanup on the attached-session path) as the v2.1.203 focus-event fix, so it belongs in the same version history table on agent-view.md.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗