Repository navigation
fix(project): use directory root for non-git projects - #33668
lin-hongkuan wants to merge 1 commit into
Conversation
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
|
I think this issue should be reopened (though I don't know how to inform the developers). I encountered this issue a lot, and this is exactly why on macOS, opencode frequently caused me to see a bunch of permission windows because the AI agent (in my case, it is Grok) would grep over the user root directory, and it is a very annoying experience. |
Issue for this PR
Closes #24694
Type of change
What does this PR do?
When
ProjectV2.resolve()returns no VCS,Project.fromDirectory()was using/as the global project worktree/sandbox. That makes tool permission paths relative to the filesystem root, so a project file such assrc/secret.tscan be checked as a long root-relative path fragment instead of the project-relative rule users configured.This keeps git behavior unchanged, but normalizes the opened directory once and uses it as the non-git worktree/sandbox.
containsPath()keeps its/guard for legacy persisted rows so old data cannot make the filesystem root count as in-project.Regression coverage now checks that:
Project.fromDirectory()returns the opened directory for non-git worktree/sandbox.InstanceStore.load()exposes the opened directory as the non-git instance worktree.src/secret.ts.How did you verify your code works?
bun test test/project/project.test.tsbun test test/project/instance.test.tsbun test test/tool/read.test.tsbun run typecheckgit diff --checkScreenshots / recordings
Not applicable, no UI change.
Checklist