Repository navigation
fix(server): strip ANSI codes from extension session names - #1413
Merged
danyaberezun merged 3 commits intoNov 18, 2026
Merged
danyaberezun merged 3 commits into
danyaberezun merged 3 commits into
Conversation
markxu (markjoin123)
requested review from
Andrey Markin (Mark-Life),
Olga Lavrichenko (OLavrik),
artyomxx,
danyaberezun and
Rinat S (rsolmano)
as code owners
November 16, 2026 13:25
danyaberezun
approved these changes
Nov 18, 2026
Collaborator
|
Thanks markxu (@markjoin123) — verified that every read path a user sees is covered and that stripping is idempotent across the live event, summaries and the history index. I pushed one docs commit on top so the strip's behaviour and the reasons the built-ins don't fit are recorded once, in |
Chong Jiang (Bouchee)
added a commit
to Bouchee/raildesign
that referenced
this pull request
Nov 23, 2026
Adapt ThinkRail JetBrains#1413 (52ea03b) to RailDesign title and search handling.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
An extension that names a chat with
pi.setSessionName("\x1b[31mred\x1b[0m name")shows the raw escape bytes in the chat title and the session list, including after reload. #1353 strips escapes from text the ext-UI bridge displays, includingctx.ui.setTitle. A session name does not go through that bridge: pi stores it on the session file assession_info, and the host reads it back from the live event, the session records, and the history index.Approach
Strip escapes where the name is read, so a name already saved by an older build shows up plain. The session file is not rewritten, and the 80-character write cap stays on
renameSessiononly.stripAnsimoved to@thinkrail/shared/stripAnsi.historycannot importagent, and both modules read the title. Display reads are the forwardedsession_info_changedevent, every session summary and state-record title (including a disk list row'sSessionInfo.name), and the titleextractSessiontakes fromsession_info. A name that is only escapes is treated as a clear. A visible title longer than 80 characters is kept.Changes
stripAnsi/plainText, used by the ext-UI bridge and by session-title reads.pi.setSessionName, a name already on disk, and a coloured title past the write cap. The on-disksession_infoname is still the original string.Screenshots
Not applicable — no frontend changes. The page already renders the title string the host sends.
Related issues
Fixes #1374
Checklist
bun run lint,bun run typecheck,bun run testbun run e2e, orbun run e2e:fullwhen touching agent behavior)SPEC.md/ top-level specs updated to reflect any boundary, contract, or behavior changeThe lint, typecheck, and new session-title tests passed. One existing
@thinkrail/servertest (pushBranchreftable workspace) failed because this environment's Git has nogit refs; it is unrelated to session titles. E2E was not run: the page did not change, and the live and reload paths are covered by the server tests.This change was made with AI assistance and reviewed.