Repository navigation
[Visible Copilot folder] - Step 2: Remove the hidden Copilot folder fallbacks - #3620
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: edb2655b20
ℹ️ 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".
| const folder = app.vault.getAbstractFileByPath(folderPath); | ||
| if (folder instanceof TFolder) { | ||
| return app.vault.getMarkdownFiles().filter((f) => f.path.startsWith(folder.path)); | ||
| } | ||
|
|
||
| if (await app.vault.adapter.exists(folderPath)) { | ||
| const listing = await app.vault.adapter.list(folderPath); | ||
| const mdPaths = listing.files.filter((f) => f.endsWith(".md")); | ||
| const result: TFile[] = []; | ||
| for (const filePath of mdPaths) { | ||
| result.push(await createSyntheticTFile(app, filePath)); | ||
| } | ||
| return result; | ||
| } | ||
|
|
||
| return []; | ||
| if (!(folder instanceof TFolder)) return []; | ||
| return app.vault.getMarkdownFiles().filter((f) => f.path.startsWith(folder.path)); |
There was a problem hiding this comment.
Keep disk fallback until migrated files enter the vault cache
On the upgrade path from a hidden Copilot root, revealHiddenCopilotFolder() moves the directories with vault.adapter.rename() immediately before startup migrations scan projects and chats. Those adapter operations do not synchronously populate Obsidian's Vault cache, so returning [] whenever the destination folder is not yet a cached TFolder can make the just-migrated conversations disappear from Recent Chats and makes the initial project scan cache an empty project list until a reload or later filesystem event. Retain the adapter-backed listing until the migration explicitly ensures the moved tree is indexed.
AGENTS.md reference: AGENTS.md:L84-L89
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed the timing in Obsidian 1.14.4: adapter.rename() from a hidden source doesn't update the vault index, so only the file watcher indexes the moved tree. It recovers without a reload, though. I reproduced the race by holding back watcher events by 3 s on a vault with a hidden .copilot root: the project scan saw no folder, and once the files were indexed, ProjectRegister's create listener (subscribed before the scan) added both projects to the list. Recent Chats lists the moved chats because it reads files on each open instead of caching them at startup. Keeping the adapter fallback would bring back synthetic TFiles that processFrontMatter/vault.read can't use, just to cover that gap.
edb2655 to
0884819
Compare
With the Copilot folder always visible, every Copilot file is in Obsidian's vault index. Drop the code that read, wrote, listed, and deleted files outside the index: synthetic TFiles, adapter listings and writes in chat and project persistence, the hidden chat image path, the AGENTS.md adapter paths, and the hidden-directory notice. Keep the adapter reads that cover case-insensitive name collisions and notes whose metadata Obsidian has not parsed yet. Relates to Brevilabs/obsidian-copilot-private#712 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guard only routed hidden-folder notes to an adapter branch that no longer exists; when false it marked a timestamp persisted that was never written. Relates to Brevilabs/obsidian-copilot-private#712 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0884819 to
32ab1e3
Compare
Relates to Brevilabs/obsidian-copilot-private#712
Why
Obsidian does not index dot folders, so Copilot carried a second way to reach its own files for a hidden Copilot folder. Chat save, history, pins, titles, chat images, AGENTS.md, and projects each checked whether a file was in the vault index and, when it was not, read, wrote, listed, or deleted it through the raw file system instead. With the previous PR in this stack, the Copilot folder is always visible, so every file Copilot owns is in the index and that second path never runs.
What
No visible change for any vault. Copilot now reads and writes its chats, chat images, projects, and AGENTS.md only through Obsidian's vault APIs.
chat.mdvsChat.md.obsidianand other hidden folders, not the Copilot folderThe "Cannot open source files from hidden directories" notice goes away, since a chat note can no longer be in one.
Non goal
.agents/and.claude/keep their disk access for skills..copilot/keep using the raw file system.Screenshot
Not applicable: this PR removes code paths that a visible Copilot folder never reaches, and nothing on screen changes.
Risk
Medium
Review: read
listMarkdownFilesandpatchFrontmatterinsrc/utils/vaultAdapterUtils.ts,ensureFileinsrc/instructions/agentsFile.ts, andupdateProjectinsrc/projects/ProjectFileManager.ts. Then run Verification steps 1-4.Verification
copilot, start an Agent Chat, attach an image, and send a message. Open Recent Chats; the chat is listed, and its note incopilot/copilot-conversations/embeds the image.copilot/projects/is created, renamed, and removed.