Skip to content

fix(mcp): stop register_project_dir/register_bridge_repo bypassing worktree_repo_root - #463

Merged
getappz merged 7 commits into
masterfrom
task/94
Aug 12, 2026
Merged

fix(mcp): stop register_project_dir/register_bridge_repo bypassing worktree_repo_root#463
getappz merged 7 commits into
masterfrom
task/94

Conversation

@getappz

@getappz getappz commented Aug 12, 2026

Copy link
Copy Markdown
Owner

Working tree is clean and the commit is in place. Only 1 failure this run (mcp_prompts::tests::optimize_review_returns_full_skill_body — the same pre-existing, unrelated failure noted before; dashboard::server didn't reappear, confirming it's a timing flake, not caused by this change). 1249/1250 passed, no failures in mcp_server::.

Summary

Fixed item #94: register_project_dir and register_bridge_repo in src/mcp_server.rs now call self.worktree_repo_root() instead of the raw, cwd-derived Self::repo_root(), so a process dispatched into a linked worktree (e.g. .worktrees/task/40) no longer poisons the shared project_dirs/bridge_repos registries with its own worktree path — the root cause of item #91's nested-worktree bug.

  • project_link_path and resolve_repo_key were audited per the item's guidance and left unchanged (documented why in the commit).
  • Added a regression test (resolve_project_registers_the_worktree_redirected_root_not_the_raw_repo_root) exercising the fix via worktree_repo_root_override, avoiding the real-cd race that caused the earlier "Reopened" regression in resolve_project_relinks_to_existing_project_when_link_file_is_deleted.
  • item_tests.rs had grown past the repo's 1500-line LOC gate; split the project-resolution tests into a new project_resolution_tests.rs submodule to pass the pre-commit hook cleanly (no --no-verify used).
  • Committed as 9a6acce; full suite is green aside from one pre-existing, unrelated flaky failure in mcp_prompts.

…epo_root()

register_project_dir and register_bridge_repo called the raw, cwd-derived
repo_root() instead of worktree_repo_root(), so a process dispatched into
a linked worktree (e.g. an agent running from .worktrees/task/40) wrote
its own worktree path into the shared, daemon-wide project_dirs and
bridge_repos registries. The next discovery tick then built a new item's
worktree relative to that poisoned path, nesting one worktree inside
another (item #91).

project_link_path and resolve_repo_key were audited and left unchanged:
project_link_path only produces a redundant per-worktree link file since
.agentflare/ is gitignored and resolve_repo_key() reconnects worktrees to
the same project via the git remote regardless; resolve_repo_key only
falls back to the raw repo_root() when there is no git remote, which
never happens for a GitHub-hosted repo.

Added a regression test exercising register_project_dir/register_bridge_repo
through worktree_repo_root_override, asserting the registries end up with
the redirected root rather than the raw one. Split the project-resolution
tests out of item_tests.rs into their own submodule to keep it under the
repo's LOC gate.

Agentflare-Agent: claude-code
Agentflare-Branch: task/94
Agentflare-Item: 94
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a247f754-2c2a-477a-8d08-08e469811872

📥 Commits

Reviewing files that changed from the base of the PR and between 633c85f and da22cb3.

📒 Files selected for processing (4)
  • src/mcp_server.rs
  • src/mcp_server/tests/item_tests.rs
  • src/mcp_server/tests/mod.rs
  • src/mcp_server/tests/project_resolution_tests.rs

Comment @coderabbitai help to get the list of available commands.

@getappz getappz changed the title register_project_dir/register_bridge_repo bypass worktree_repo_root, poisoning shared registries with a worktree's own path fix(mcp): stop register_project_dir/register_bridge_repo bypassing worktree_repo_root Aug 12, 2026
@getappz
getappz merged commit 085de53 into master Aug 12, 2026
16 checks passed
@getappz
getappz deleted the task/94 branch August 12, 2026 15:58
getappz added a commit that referenced this pull request Aug 13, 2026
…ries (#463) (#478)

Queue::fail now reports whether a failure was terminal (retries
exhausted) vs a requeue. WorkerPool gains a terminal_failure_hook fired
from run_in_process on that terminal case; the daemon wires it to
dashboard::orphan_reconcile::handle_terminal_job_failure, which swaps
the item off dispatched onto needs-manual-dispatch (or ready-for-work
as a fallback) -- the clean-failure counterpart to reconcile_orphaned_jobs,
which only ever covered a job whose process crashed mid-flight.

Previously an item whose dispatched job failed for an ordinary reason
(no billing balance, transient network error) stayed labeled dispatched
forever, invisible to every future discovery tick.

Agentflare-Agent: claude-code
Agentflare-Branch: task/463-failed-jobs-retries-exhausted-leave-item
Agentflare-Item: 463
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