Repository navigation
feat(session): show the live session name in the Status tab - #445
Open
ayush5harma wants to merge 9 commits into
Open
ayush5harma wants to merge 9 commits into
ayush5harma wants to merge 9 commits into
Conversation
- add the session_title_update session update to types.ts and the Rust wire types, read from getSessionInfo().customTitle after every connect, replacement and conversation reset, and after each top-level turn when it changed - drop a read that a later read, a replacement or a close superseded, and refresh the session list when a turn changed the title - strip control characters once in the converter, hold the active session's title as one Option cleared with its identity and on a conversation reset, and name the terminal tab after it - cover the read rules, resume, a launch-time name, /rename, /clear and a conversation reset at the bridge boundary, and the converter and reset handling in Rust tests
- draw a `──── name ─` rule as the editor's top row when the session has a title, cut with an ellipsis to the width, and give it up first on a one-row slot - name the session in the Status tab by the title Claude Code reports instead of the listed custom title, keeping the summary fallback - cover the rule's layout and the Status row in unit tests, and /rename and a Status-tab rename against the fake bridge in PTY tests
- read the title back through getSessionInfo() after rename_session and generate_session_title succeed, so the composer rule, tab title and Status tab follow a rename made outside a turn - keep both commands on renameSession() and the SDK's title generation; the session list is still emitted as before - cover a rename and a generated ai-title at the command boundary against transcripts read through the SDK
…ve title - start the rename draft from the title the bridge reported instead of the listed session's custom title, which can lag behind it - describe the session for title generation by that title first, then the listed summary and first prompt as before - the Status tab, the composer rule and both actions now read one title; the config tests and the Status-tab PTY test cover the prefill
- add a Session Name section: /rename and the Status tab change it, the app shows what the session API reports, including after a reset - state that Claude Code generates a title only for a session without one, and that the API's generated-title fallback shows a name where Claude Code's prompt bar shows none - add a session title owner table: Claude Code persists it, the bridge reads and sends it, Rust holds one value that every display reads
This was referenced Oct 10, 2026
- remove the composer rule and its layout hookup; no display placement was agreed before it was added - restore upstream's terminal tab title so it keeps naming the folder - keep one PTY test proving the Status tab shows the name a /rename reports - drop the fake bridge's resume title and rename handler that only the removed tests used
…ecords - have the SDK stand-in report titles from its own state through getSessionInfo, so no test writes CLI-private custom-title or ai-title records - drive every case through the spawned bridge and assert the NDJSON it emits: resume, a launch-time name after the first turn, /rename, the Status rename and title generation, a conversation reset and /clear - prove a superseded read is dropped with a held read that resolves after a later one starts - prove a failed read is logged and sends nothing - merge session_resume.test.ts into session_title.test.ts, since both tested the same title workflow
- remove the bridge's sentTitle copy, which mirrored the title Rust already holds - send whatever each read returns; Rust stores it idempotently and nothing else reacts to a repeat - keep the titleReads counter so a superseded read is still dropped - remove the per-turn session-list refresh that depended on change detection - cite Claude Code 2.1.288, the version bundled with the pinned SDK
- say where the name shows (the Status tab), when it is read, and that it is whatever the SDK session API reports - state the generated-title fallback as a property of the API and drop claims about how Claude Code keeps titles - name the SDK as the title's owner and the listing as a separate snapshot refreshed by listSessions - reword the Rust field comments the same way
Author
|
Hi @srothgan, this is ready for review whenever you have time. Before opening it I read CONTRIBUTING.md, AGENTS.md and
After a self-review against those rules, I cut this PR down to the foundation:
One question for you: would you like the session name shown anywhere else, such as the footer or the terminal tab title? I'd rather follow your call on placement than guess. I can do that in a follow-up. I couldn't apply labels. Per CONTRIBUTING, I think Could you check it on your end and merge it if it looks good? Happy to change anything you'd like done differently. |
ayush5harma
added a commit
to ayush5harma/claude-code-rust
that referenced
this pull request
Oct 10, 2026
…s-prs chore: make the fork exactly upstream plus PRs srothgan#444 and srothgan#445
This branch has not been deployed
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.
Summary
This is the foundation for showing the session name. It gets the name into the app through the SDK's public session API and shows it in the Status tab. Where else to show it is left for you to decide (see Notes).
getSessionInfo(sessionId, { dir }).customTitleand sends a newsession_title_updatesession update. The type is added inagent-sdk/src/types.tsandsrc/agent/types.rstogether.conversation_resetand every top-level turn result. Also after the Status tab's existingrename_sessionandgenerate_session_titlesucceed; both keep usingrenameSession()and the SDK's title generation as onmain. A read that a later read overtakes is dropped, and no other bridge state is kept.session_runtime.session_titleis the one copy of the title. It is cleared with the session identity and on a conversation reset, asSDKConversationResetMessageasks. A repeated title is stored idempotently.r) and title generation (g) start from it, so both use the live name instead of the session list's snapshot.commands.md, and a session-title owner table inarchitecture.md, which separates the live title from the session list's snapshot.Why
On
main, a/renametyped in the composer, or a name given at launch, never reaches the Status tab. The tab shows the session list's snapshot, which nothing refreshes after a typed rename. This is the session-name half of #438; the reply half is #444.#442 tried this with undeclared stream fields, raw transcript records and
--name. This version uses only the session API, following your review on #443.Refs #438
Validation
cargo fmt --all -- --check,cargo fetch --locked: passcargo clippy --locked --all-targets --all-features -- -D warnings: pass, with the same five clippy 1.98 lints allowed thatmainfails (collapsible_match,manual_is_multiple_of,manual_is_variant_and,map_unwrap_or,while_let_loop)cargo test --locked --all-features: pass. The serialterminal_resizerun: pass.agent-sdk:npm run build,test,lint,knipandaudit: pass.quality:duplicatesfinds no clone in a file this PR touches.The bridge test spawns the bridge with a stubbed SDK (
getSessionInfo,renameSession,query). It asserts the NDJSON for:/rename;/clearreplacement;Removing the stale-read guard makes the test fail.
The Rust tests cover the converter and reset handling. A PTY test renames through the fake bridge and reads the Status row.
/rename status-probe-title3, then/configand Tab to Status, the tab readSession name: status-probe-title3. Nothing refreshed the session list after that typed rename, so the value came from the live title.Notes
docs/src/commands.md,docs/src/architecture.md@anthropic-ai/claude-agent-sdk0.3.288. The read points come from behaviour measured on the Claude Code 2.1.288 it bundles: a launch-time name and a/renamereachgetSessionInfoonly once the turn has finished, and right after init it reports nothing.customTitlefalls back to a generated title for a session nobody named, although its doc comment describes the/renametitle. Such a session therefore shows that generated title after its first turn. No public field tells the two apart, and the docs state this as the API's behaviour.main, the resume picker's list is not refreshed after a/renametyped in the composer, only on connect, replacement and the Status-tab actions. I left that as it is rather than add state for it.