Skip to content

Fix session ownership follow-up review issues / 修复会话归属后续评审问题#4273

Merged
esengine merged 1 commit into
esengine:main-v2from
SivanCola:fix/session-ownership-followup
Jun 13, 2026
Merged

Fix session ownership follow-up review issues / 修复会话归属后续评审问题#4273
esengine merged 1 commit into
esengine:main-v2from
SivanCola:fix/session-ownership-followup

Conversation

@SivanCola

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #4250 for the bot review threads that were left as post-merge cleanup:

  • Flush stale MEMORY.md entries even when the active memory file is already absent.
  • Archive/remove the old active memory copy and stale index line when the same memory name is saved into a different scope.
  • Keep DestroySession waiting on jobs that were already marked Killed but have not finished unwinding.
  • Route memory suggestion generation and acceptance through the selected Memory panel tab instead of the active tab.
  • The approved-plan complete_step review point is already resolved on current main-v2 by refactor(control): drop phrase-matched approved-plan continuation #4266, so this PR leaves that controller path unchanged.

Credits / Attribution

This follow-up is part of the #4250 integration and keeps the original contributor attribution:

The commit includes Co-authored-by trailers for @lifu963, @ashishexee, and @AresNing so GitHub can credit them as co-authors.

Verification

  • PATH="$(go env GOPATH)/bin:$PATH" wails generate module with Wails 2.12.0
  • go test ./internal/memory
  • go test ./internal/jobs
  • go test ./internal/control -run 'TestApprovedPlan'
  • go test . -run 'TestMemorySuggestions' in desktop/
  • npm run build in desktop/frontend

Clean stale memory index entries, remove old scoped copies when a memory changes scope, keep session destruction waiting on already-killed jobs, and route memory suggestions through the selected desktop tab.

Co-authored-by: lifu963 <56394323+lifu963@users.noreply.github.com>
Co-authored-by: ashishexee <144021866+ashishexee@users.noreply.github.com>
Co-authored-by: AresNing <49557311+AresNing@users.noreply.github.com>
@github-actions github-actions Bot added desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 13, 2026
@SivanCola SivanCola marked this pull request as ready for review June 13, 2026 07:57
@SivanCola SivanCola requested a review from esengine as a code owner June 13, 2026 07:57
@lifu963

lifu963 commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

荣幸之至😄

@SivanCola SivanCola enabled auto-merge June 13, 2026 08:00
@SivanCola

Copy link
Copy Markdown
Collaborator Author

@codex review

@esengine esengine merged commit 87da37b into esengine:main-v2 Jun 13, 2026
14 checks passed

@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: a381032aac

ℹ️ 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 on lines +965 to +967
const path = selectedTabId
? await app.AcceptMemorySuggestionForTab(selectedTabId, candidate)
: await app.AcceptMemorySuggestion(candidate);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset suggestions when switching memory tabs

When a user scans suggestions in one tab and then changes the Memory page selector to another tab, the existing suggestions state is left visible and autoSuggestions will not rescan because it is non-null. Accepting one of those stale candidates now calls AcceptMemorySuggestionForTab(selectedTabId, candidate), so history-derived memories from the previous tab can be written into the newly selected tab's memory store; the same stale-state issue applies to skill suggestions just below. Clear/key the suggestions by tab or force a refresh on selectedTabId changes before accepting.

Useful? React with 👍 / 👎.

Comment on lines +156 to 159
tab := a.tabByIDLocked(tabID)
workspaceRoot := ""
if tab != nil {
workspaceRoot = tab.WorkspaceRoot

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid global skill creation for stale tab IDs

If the Memory panel keeps a selected tab id after that tab is closed (or any caller passes an invalid id), tabByIDLocked returns nil here but the method continues with an empty workspaceRoot; a project-scoped suggestion is then downgraded by !st.HasProjectScope() and written into the user's global skill store. That differs from the tab-scoped memory accept path, which no-ops when the target tab is missing, and can persist a workspace-specific workflow globally. Return without creating anything when a non-empty tabID does not resolve to a tab.

Useful? React with 👍 / 👎.

Comment thread internal/memory/store.go
Comment on lines +238 to 239
if p != "" || indexContainsIn(dir, name) {
if err := flushIndexIn(dir, indexLinesExceptIn(dir, name)); err != nil {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve hand-written MEMORY.md content when pruning stale links

When Archive/Delete is called for a name whose <name>.md file is already gone but whose index line remains, this new indexContainsIn branch rewrites MEMORY.md via flushIndexIn(indexLinesExceptIn(...)). indexLinesExceptIn only carries forward managed link lines, so any hand-written headings, notes, or imports in that MEMORY.md are silently dropped even though the requested cleanup was just a stale link; remove only the matching line or preserve non-managed lines when handling the missing-file case.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants