Keep Agent Mode session titles consistent across tabs and history - #3380
logancyang wants to merge 4 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c450f1d222
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e65c4d8c4f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5ea6096df
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (loaded.topic) session.setLabel(loaded.topic); | ||
| else if (loaded.label) session.setLabel(loaded.label); |
There was a problem hiding this comment.
Apply the filename fallback when restoring a cleared title
When a saved title is cleared, both topic and agentLabel are blank, so neither branch sets a session label when the note is reopened. The history row now falls back to the note filename, but the tab falls back to the backend display name (for example, “opencode”), leaving the two views inconsistent in the exact clear-and-reopen flow this change supports. Restore the same filename-derived title here when both persisted fields are absent.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36faf3f3f0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (loaded.topic) session.setLabel(loaded.topic); | ||
| else if (loaded.label) session.setLabel(loaded.label); |
There was a problem hiding this comment.
Preserve later legacy tab renames on reopen
For an existing note renamed first in history and later from its tab, the persisted fields legitimately differ: topic contains the older history name while agentLabel contains the newer tab name. This branch now always restores topic, and the ensuing autosave writes that stale value back into agentLabel, permanently discarding the user's latest rename. Existing conflicting records need migration or ordering metadata rather than assuming topic is newer.
AGENTS.md reference: AGENTS.md:L85-L90
Useful? React with 👍 / 👎.
| if (loaded.topic) session.setLabel(loaded.topic); | ||
| else if (loaded.label) session.setLabel(loaded.label); |
There was a problem hiding this comment.
Parse the reopened topic before preferring it
When an existing note uses valid YAML such as topic: >- with indented title lines, loadFile() still obtains loaded.topic from the line-based splitFrontmatter() parser, so this new preference sets the tab label to the literal >- instead of the folded title. Although the autosave metadata path now uses parseYaml, the fresh reopen path does not; parse the loaded frontmatter with the same full YAML parser before choosing topic.
AGENTS.md reference: AGENTS.md:L85-L90
Useful? React with 👍 / 👎.
Relates to #3378
Why
A user can rename an Agent Mode tab, then open Recent Chats or the previous-sessions list and still see the first prompt instead. Saved chat notes kept the tab label and history title in different fields, so finding a named workflow meant reopening chats one by one.
What
Existing chats use their saved history title, then their saved tab label, then the filename. Native-only sessions continue to use their local session index.
Non goal
Screenshot
No screenshot is attached because the dedicated dev vault displays unrelated note content beside Agent Chat. The live UI checks and saved-note inspection are recorded below.
Risk
High — this changes writes to saved chat notes and serializes a rename with an in-flight autosave. The existing frontmatter fields remain compatible with older chats, but a revert cannot undo a title the user changed while running this version.
topicandagentLabelfields are reused; no schema or external interface changes.Review: inspect
AgentChatPersistenceManager.saveSession(),updateTopic(), andreadExistingMeta()insrc/agentMode/session/AgentChatPersistenceManager.ts, thenAgentSessionManager.getChatHistoryItems(),updateChatTitle(),readSessionRefFromFile(), andrenameSession()insrc/agentMode/session/AgentSessionManager.ts. Run Verification steps 1–4, including the clear-title and overlapping-save cases.Verification
Observed in Obsidian (
logan-dev-vault): The built plugin was loaded and its new title code was confirmed at runtime. Renaming an existing Claude session tab changed Chat History and Recent Chats; opening it from Recent Chats kept the title. On a saved Markdown chat, a later tab rename updated the note’sagentLabeland Recent Chats. The saved title remained after disabling and re-enabling the plugin. I restored the test chat’s original title afterward. One immediate rename during the first manual save exposed a race; a deterministic red/green regression test now covers the reconciliation. The other edge cases in steps 3–4 are covered by unit tests, not a live UI run. Obsidian reported no captured errors.