Skip to content

fix(desktop): restore topic title from session fallback when switching projects in creation mode (#5438)#5478

Merged
SivanCola merged 3 commits into
esengine:main-v2from
ttmouse:fix/session-title-reset-5438
Jun 30, 2026
Merged

fix(desktop): restore topic title from session fallback when switching projects in creation mode (#5438)#5478
SivanCola merged 3 commits into
esengine:main-v2from
ttmouse:fix/session-title-reset-5438

Conversation

@ttmouse

@ttmouse ttmouse commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

修复内容

Fixes #5438

在创作模式(单表面布局)下切换项目时,keepOnlyVisibleTab 会移除先前可见 tab;切换回来重新打开 topic 时,如果 desktop-topic-titles.json 缺少该 topic 的标题条目,标题会退回默认的 新的会话

变更说明

  • openTopicTabWithActivation 的 topic 打开路径中改用受保护的 fallback:
    • 已有手动 topic 标题不会被自动标题覆盖,即使手动标题文本正好是 新的会话
    • topic title index 缺失时,优先从 session .jsonl.metaBranchMeta.TopicTitle 恢复
    • 如果 desktop session title sidecar 中有用户手动会话标题,也优先恢复
    • 只有恢复不到已保存标题且 source 允许自动标题时,才从首条 user message 生成 fallback
  • 移除了本 PR 中混入的 OpenAI stream cancel 改动,使最终 diff 聚焦 [Bug]: v1.12.0 创作模式下点击左侧已有项目的会话时,当前会话标题被重置为"新的会话" #5438
  • 新增回归测试覆盖 session meta 恢复、desktop session title sidecar 恢复、手动默认标题保护。

验证

  • cd desktop && go test . -run 'TestOpenProjectTab(RecoversMissingTopicTitleFromSessionMeta|RecoversMissingTopicTitleFromSessionTitle|PreservesManualDefaultTopicTitle)$'
  • cd desktop && go test ./...
  • go test ./internal/provider/openai/...
  • git diff --check

Cache-impact: low - desktop topic title persistence/recovery only; no prompt, tool schema, provider request serialization, compaction, or reasoning upload changes.
Cache-guard: not required for provider-visible cache shape; covered by desktop regression tests above.

…g projects in creation mode (esengine#5438)

In single-surface (creation/workbench) mode, switching between projects
removes the previous tab via keepOnlyVisibleTab. When the user switches
back, a new tab is created and the topic title is loaded from the
persisted topic-titles file. However, if the topic-title file has no
entry for this topic ID (e.g., due to path normalization differences
on Windows), the title would incorrectly show the default '新的会话'.

This fix adds a fallback: when the topic-title file has no entry and a
valid session path is known, extract the title from the session and
persist it back to the topic-titles file for consistency.
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) and removed v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 28, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0dd1923ab1

ℹ️ 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".

Comment thread desktop/tabs.go Outdated
Comment thread desktop/tabs.go Outdated
…ncelled

The stream-reconnect loop calls sendChunk(ctx, out, error) with the
caller's context after readStream returns context.Canceled.  Since
the context is already cancelled, sendChunk's second select races
<-ctx.Done() against out<-chunk (both ready), dropping the error
~50% of the time — the caller sees a nil error instead of
context.Canceled.

Fix: use context.Background() for the final non-reconnectable error
send, so the error chunk is always delivered to the reader.

Fixes TestStreamCancelDoesNotReconnect flaky failure under -race.
@github-actions github-actions Bot added provider Model providers & selection (internal/provider) v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 28, 2026
Restore saved topic titles from session metadata or desktop session title sidecars when the topic title index is missing, while preserving manually defaulted topic titles. Also removes the unrelated OpenAI stream change from this PR diff.

Co-authored-by: SivanCola <32437197+SivanCola@users.noreply.github.com>

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. This now restores topic titles from the stored session metadata/title sidecar before auto-generating from the first user message, while preserving manual titles that happen to equal the default text. The final diff is scoped to desktop topic-title recovery and regression tests, with no provider/cache/prompt surface changes.

Verified:

  • GitHub checks are passing, including desktop, race, CodeQL, and cache-impact.
  • Merged into latest main-v2 locally and ran the focused topic-title recovery tests.
  • Merged into latest main-v2 locally and ran the full desktop Go test suite.

@SivanCola SivanCola merged commit ff379b4 into esengine:main-v2 Jun 30, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) provider Model providers & selection (internal/provider) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: v1.12.0 创作模式下点击左侧已有项目的会话时,当前会话标题被重置为"新的会话"

2 participants