Repository navigation
Description
Context
A Claude chat that has no summary yet takes its title from the raw first prompt. That prompt can carry the host-context block brain-kit appends to the user's words, so the block shows up in the session list.
prepare(packages/ui-sdk/src/server/session-prompt-context.ts:61-72) appends[Host context for this turn; advisory facts, never permission] … [End host context]to the user's text whenever a host fact changed. It keeps the original text separately (state.turns[id].original).- History replay uses the original, so the transcript is clean.
- The list does not.
listSessionsusess.customTitle || s.summary || s.firstPrompt(packages/ui-backend-claude/src/history.ts:69), and the transcript archive copies the same expression into its manifest (packages/ui-backend-claude/src/transcript-archive.ts:294).firstPromptis the text that went over the wire, block included.
Observed on a hosted 0.44.0 install. GET /api/sessions returned 108 sessions. In 10 of them the title reads like Continue [Host context for this turn; advisory facts, never permission] sandbox: # Where files go in this turn **Profile: \governed`.** …`. Short first prompts ("Continue", a one-line correction) are the worst case: the host block is most of the title. The block also puts host sandbox guidance in front of anyone who sees the list.
Scope
- When a title falls back to
firstPrompt, strip the host-context block, on the live list and in new archive manifests. The block's delimiters are fixed and owned bysession-prompt-context.ts. Export one function from there that removes the block, so the delimiter is never spelled twice. Alternatively, look up the stored original for that session. - Apply the same rule to already-archived manifests when they are listed (
listArchivedSessions). Rewriting committed manifests is out of scope. - Check Pi's session list for the same fallback and fix it with the same function if it is affected.
Out of scope
- Changing the host-context block, its wording, or when it is sent. The provider-facing prompt stays byte-identical (provider history).
- Pill labels (ui-server: label working-session and pending-prompt pills with a few words from a small fast model #1004) and SDK
summarytitles. - Rewriting stored transcripts or archive manifests.
Acceptance criteria
- A session whose first prompt is
"Continue"plus a host-context block lists with title"Continue". Ahistory.tstest proves it and fails before the change. - An archived session whose manifest title contains the block lists without it.
- A first prompt that contains the opening delimiter as user-typed text, with no closing delimiter, is left unchanged. Removal only takes a complete trailing block.
- Host-context delimiter definitions stay owned by
session-prompt-context.ts; title consumers use its helper or exact stored ownership and do not duplicate delimiter literals. A complete trailing block is removed while unmatched user-typed opening text is preserved.
Verification
bun run test packages/ui-backend-claude/tests(history and archive listing cases) and the session-prompt-context unit tests.- Mutation: return the raw
firstPrompt, and the new title test fails.
Contract impact
None. ChatSession.title stays a nullable display string. Only its derived value is cleaned.
Bounded reproduction — 2026-11-09
Inspected source: 9c7eb25825fdad5f4485db0df472188805edb450; Bun 1.4.4 (38afee6c8), frozen lockfile, isolated temporary checkout, repository test wrapper and offline preload. Command: bun run test ./tmp/triage/new-issues.test.ts. A temporary keyless fixture used real sessionPromptContext(...).prepare("Continue", { sandbox: "Use the voyage scratch area." }), fed its wire text to the injectable SDK session metadata, and called real createHistory(...).listSessions(). The title was the complete wire text, including both host-context delimiters and the sandbox fact. TITLE_EXCLUDES_HOST_CONTEXT failed expecting "Continue". Only temporary fictional files and metadata were used. The fixture failed at the named behavioral assertion, after module loading succeeded. Temporary diagnostic fixtures are outside authored source; this triage changes no product code.
Triage 2026-11-09 at main 9c7eb25825fdad5f4485db0df472188805edb450: Recorded the bounded intended-assertion failure and clarified current source/verification. The existing p1 and 0.45.0 commitment are preserved. It remains standalone: the GitHub-tools epic does not own this backend correction, and no existing open epic owns its full deliverable.
Activity
schlessera commentedon Nov 15, 2026
Claimed for implementation. Claim token:
claim-fe97c28a. Branch:fix/3789-claude-session-title.Checking overlap with neighbouring Claude backend work; scoped to session title display.
schlessera commentedon Nov 15, 2026
Completed by PR #4022, squash
a9bcdbd6734c1733390570e2a68c10afde3b00a9. Live and archived first-prompt titles omit a complete trailing host-context block; unmatched opening text remains intact. Provider prompts and stored transcripts are unchanged. Pi already takes the first line before the appended block.Failing-first and restored mutation evidence, 32 passing focused tests, build, and preflight are recorded in the PR. Candidate run 43758006657 passed. Automatic main push run 43760470794 passed all 17 jobs; each executing job checked out the actual squash. Issue and PR retain release milestone
0.45.0. No follow-up issues were filed.