fix: hide unstable BYO directory activation - #2213
Merged
Merged
Conversation
yuezengwu
approved these changes
Aug 6, 2026
yuezengwu
left a comment
Contributor
There was a problem hiding this comment.
这项改动的目标是避免在 provider 无法提供跨 session 稳定目录时暴露误导性的 BYO directory activation,同时让 first-tree-read 在所有可读 SCOPE 都明确无关时直接继续原任务。
核心改动:
- setup location 新增稳定目录可用性判定;pathless、Codex Documents scratch path、默认 Codex managed worktree 仅返回 global/session choice,同时保留 canonical project identity。
- directory availability 纳入 plan identity;隐藏 scope 没有 after-fingerprint/apply command,手工构造的 directory apply 也会 fail closed。
- Claude setup 只采用 CLAUDE_PROJECT_DIR 或显式 project-root;Read skill 增加 all-clearly-unrelated 分支,但 unavailable、overlap、unclear、selectionBlocked 与 exact snapshot 边界保持 fail closed。
- 文档、floor contract 与跨 surface QA case 同步到动态 choice 和 tri-state reader 语义。
我检查了 location classifier、plan/apply 校验、既有 grant 优先级、SCOPE selection 分支和相关文档/测试 diff,没有发现 blocker。该 PR 不涉及核心数据结构、v3 grant schema 或数据库变更;按 review 要求未额外运行测试或 QA。
非阻塞后续:现有 Context Tree 的 External BYO 节点仍描述“临时目录保留 directory choice 并警告”的旧决策,源码合并后应通过 source-backed Tree change 同步;PR #2207 若后合并,也需按描述整合 enable.ts 与文档的重叠改动。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CLAUDE_PROJECT_DIR(or explicit--project-root) for Claude setup directory availabilityThis implements the agreed resolution for #2209 without introducing a
git-projectscope or changing the v3 grant schema. It replaces the issue's original Git identity proposal with a narrower setup-only rule that omits a misleading directory choice when the current path is not stable across sessions.Safety boundaries
selectionBlocked, unavailable candidates, overlapping/unclear SCOPE files, exact snapshot selection, and BYO Write confirmation remain fail closed.Validation
pnpm --filter first-tree-dev exec vitest run src/__tests__/context-project-resolver.test.ts src/__tests__/context-enable-command.test.ts --maxWorkers=2pnpm --filter @first-tree/skill-evals exec vitest run src/suites/first-tree-read/__tests__/floor.test.ts --maxWorkers=2pnpm --filter @first-tree/skill-evals eval:floor(8/8 deterministic floors)pnpm --filter @first-tree/qa exec vitest run --passWithNoTests --maxWorkers=2pnpm check && pnpm typecheckumask 0022 && pnpm exec turbo run test --concurrency=1 -- --maxWorkers=2(12/12 workspaces)The host defaults to
umask 0002, which caused the first full client test run to create fixture directories with group-write permissions and fail four managed-skill permission assertions. Re-running the unchanged tree under the standardumask 0022passed all 2,417 client tests and the complete monorepo suite.Coordination
PR #2207 independently changes Context enable preflight and overlaps
enable.ts, its tests, and the two Context integration documents. This branch does not merge or rebase that work; whichever PR lands second may need a small semantic integration of both changes.Closes #2209