Conversation
A message sent from a linked git worktree (git worktree add, including Claude Code's .claude/worktrees/agent-...) now lands in the main repository's project instead of a project of its own. One module, packages/server/inbox-project-root.ts, decides where a path files, with one cache shared by sends, New message's live sessions and the message-image route. The message keeps the worktree folder as its base_path, so relative images and attachment links resolve where the agent works; the image route re-checks that folder at serve time. Existing worktree projects are never rewritten; routing reads only recorded project ids, so a replay routes as before. Co-Authored-By: Claude <noreply@anthropic.com>
- wait_for_reply and read_thread's list cover the project an older Inbox kept for the agent's worktree (threadReadScope), so an agent that asked from a worktree before the upgrade still finds the person's reply. - A git that ran past its time limit never makes a project: the nearest existing project holding the folder, else project_unresolved (try again). - Project-root gits clear GIT_DIR, GIT_WORK_TREE, GIT_INDEX_FILE and GIT_COMMON_DIR; no git installed is an answer, not a retry. - AGENTS.md: the upgrade's effect on reads and new projects. Co-Authored-By: Claude <noreply@anthropic.com>
Owner
Author
|
Review fixes in b8b5c97 (one new commit, no force-push):
|
The fallback after a git timeout took the nearest existing project holding the folder, which could be a folder project at ~: a new worktree under it was filed there for good. It now accepts a holder only when its root is a repository (.git exists, read from disk without git), and refuses with project_unresolved otherwise. Also clear GIT_CONFIG_PARAMETERS, GIT_CONFIG_COUNT and the GIT_CONFIG_KEY_<n> / GIT_CONFIG_VALUE_<n> variables for project-root gits. Co-Authored-By: Claude <noreply@anthropic.com>
1 task
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Folds git worktrees into their main repository's Inbox project, the "separate small change" in the approval record
.product/approved/inbox-project-menu/approval.md(DESIGN.md §5).The problem
Each linked git worktree is its own
--show-toplevel. That includes Claude Code's<repo>/.claude/worktrees/agent-…. So every subagent worktree became its own Inbox project, and the sidebar filled with rows likeagent-aa0c12ba3edf0ee3f.What changes
New messages from a linked worktree now land in the main repository's project.
One module decides where a path files:
packages/server/inbox-project-root.ts. It has one cache (createInboxProjectRoots), and three places share it, so they always agree:resolveProject);Resolution rules
validation_error, as before.git rev-parse --show-toplevel --git-dir --git-common-dirin that folder. If git refuses (not a work tree), the folder is the project, as before.<common dir>/worktrees/<id>(compared as realpaths). If it is not, the toplevel is the project, as before.<repo>/.gitgives<repo>.rev-parse --is-bare-repositorysays the common dir is bare, the project is the bare repository itself. When it is named.bareor.git(a bare repo inside a container folder), the project is the folder that holds it.core.worktree).Edge cases
core.worktree. A superproject worktree folds into the superproject.repo.git, or into the container folder for therepo/.bareandrepo/.gitlayouts..gitlink is dangling, so git cannot open the worktree. The folder (the worktree's toplevel) is the project, which is the behavior before this change. Aftergit worktree repair, the worktree folds into the moved repo. If the main checkout was replaced, verification fails and the worktree keeps its toplevel.--separate-git-dir/tmp.--git-common-dir)-is not a path, so the toplevel is the project.node:path(resolve,join,dirname,basename) andrealpathSyncare used, with no separator strings. git'sC:/…output resolves normally. Not run on Windows here.interaction: "forbid", likeinbox-repos.ts). An answer git could not give is used once and never cached.Caching (git off hot paths)
Paths relative to the worktree
base_path. A message keeps the folder it was sent from as itsbase_path, even when that folder is outside the project's root (sendBasePath, through a new optionalprojectRootOfon the MCP context). Relative image refs and the window's attachment links therefore start where the agent works. Claude Code worktrees are inside the repo, so they already got abase_pathbefore this change.base_pathgains nothing.project_path, and they are unchanged. A test checks it.Existing data and routing determinism
reply_tointo one of them stays there. Those projects hide once they are archived (the project-menu change).sessionThreadsandnamedThreads, rebuilt byindexRoot) is keyed byproject_id. That field is recorded on each message line, and a replay never resolves a path. So an older store routes exactly as before. The new test checks this by reopening a store that holds both kinds of project and routing into each one.Known transitional effects (narrow):
read_threadandwait_for_replycalled with a worktreeproject_pathnow list the main project.Tests
packages/server/inbox-project-root.test.ts(18 tests) uses real git repos in temp folders. It covers:repo.gitand the.barecontainer;git worktree repair;--separate-git-dir;packages/server/inbox-worktree-projects.test.ts(5 tests) runs a real Inbox, the MCP SDK client and real git worktrees. It covers:base_path;403, and aftergit worktree removethe image is404;bun test packages/server/inbox packages/shared/inbox: 570 pass, 0 fail. This run includes the store property tests (store.test.ts, the generated-sequence and routing-determinism properties).tests/never-touch-the-real-inbox.test.ts,apps/hook/server/inbox-cli.test.tsandapps/hook/hooks/mod/inbox.test.ts: 48 pass.tscpasses for the server, shared and hook-server projects.Docs