Skip to content

fix(chat): refresh external context on nested folder re-selection - #34

Open
luoxuanzao wants to merge 1 commit into
mainfrom
fix/external-context-refresh
Open

fix(chat): refresh external context on nested folder re-selection#34
luoxuanzao wants to merge 1 commit into
mainfrom
fix/external-context-refresh

Conversation

@luoxuanzao

Copy link
Copy Markdown
Member

Summary

  • Fix "workspace folder doesn't update after re-selection" in the external context picker (ExternalContextSelector.openFolderPicker).
  • Root cause (verified end-to-end on a real Obsidian via ComputerUse): re-selecting a folder that nests inside or contains an existing entry hit the conflict guard, showed a Cannot add ... Notice and left the list unchanged.
  • New refresh semantics: conflicting entries are replaced by the re-selected folder, with a Replaced "X" with "Y" Notice; persistence (lock) is inherited when a replaced entry was persistent. Unrelated folders still append; exact duplicates still rejected with the existing Notice.
  • Adds findAllConflictingPaths() in src/core/context/external-context.ts and 5 picker tests (electron remote dialog mocked).

Verification

  • npm run typecheck
  • npm run lint
  • npm run test (3354 passed, incl. 5 new picker cases)
  • npm run build
  • npm run release:check
  • npm run audit:prod (unchanged deps; ran on sibling branch this week)
  • Tested affected behavior against a real Obsidian: add .../50-素材 → re-select parent .../testObsidian → entry replaced, Notice Replaced ~/Documents/testObsidian/50-素材 with "~/Documents/testObsidian"

Safety

  • No credentials, private vault content, internal URLs, or personal paths are included
  • User-visible changes are documented in CHANGELOG.md

Re-selecting a folder in the external context picker that nests inside
(or contains) an existing entry previously showed a conflict Notice and
left the list unchanged, which read as 'the workspace folder never
updates'. The picker now applies refresh semantics: conflicting entries
are replaced by the new pick (persistence inherited from a replaced
locked entry), with a 'Replaced X with Y' Notice. Unrelated folders
still append and exact duplicates are still rejected.

Co-authored-by: QoderAI (Qwen 3.8 Max) <qoder_ai@qoder.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant