Cross-repository MCP workspace binding fails because canonical repo root is derived from script location #706

Open
opened 2026-07-13 21:01:07 -05:00 by jcwalker3 · 1 comment
Owner

Problem

The Gitea-Tools MCP server blocks cross-repository namespaces (like eagenda-author) because it derives the canonical_repo_root from the MCP script's execution path rather than the configured workspace binding.

When validating author mutations in a cross-repository namespace, the mutation guards (assess_workspace_repo_membership and assess_author_mutation_worktree) assume the task workspace must belong to the same .git directory as the Gitea-Tools installation (PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))). This permanently blocks mutations for external repositories.

Reproduction

  1. Define an MCP server namespace (e.g. eagenda-author) in mcp_config.json running the Gitea-Tools server script, but with cwd and target repository set to an external project (e.g. eAgenda).
  2. Authenticate the namespace correctly.
  3. Attempt to create an issue. The Branches-only mutation guard will block the operation, failing the repository membership and branches/ path assertions because they are evaluated against the Gitea-Tools root instead of the eAgenda root.

Acceptance Criteria

  1. Separate the concepts of immutable code/install root (PROJECT_ROOT) and namespace-specific repository workspace root (process_project_root / canonical repo root).
  2. Explicitly configure namespace-scoped workspace binding (e.g. via cwd or environment variables) so that the MCP server correctly identifies the target repository.
  3. Validate that the workspace belongs to the intended target repository, not necessarily the code installation root.
  4. Enforce the branches-only mutation guard inside the target repository.
  5. Fail closed for missing, conflicting, or forged bindings.
  6. Provide simultaneous isolation of prgs and mdcps (or other remote) namespaces.
  7. Add regression tests using two distinct repositories/worktrees to prove cross-repository bindings work safely.
  8. Ensure no weakening of the root-checkout, remote/repository, or anti-stomp guards.

Downstream Blocker

This defect currently blocks the eAgenda document-management reconciliation task, which depends on a functioning eagenda-author namespace.

Related Context

  • Does not overlap with #510 (intra-repository role isolation) or #672 (IDE config sync).
## Problem The Gitea-Tools MCP server blocks cross-repository namespaces (like `eagenda-author`) because it derives the `canonical_repo_root` from the MCP script's execution path rather than the configured workspace binding. When validating author mutations in a cross-repository namespace, the mutation guards (`assess_workspace_repo_membership` and `assess_author_mutation_worktree`) assume the task workspace must belong to the same `.git` directory as the Gitea-Tools installation (`PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))`). This permanently blocks mutations for external repositories. ## Reproduction 1. Define an MCP server namespace (e.g. `eagenda-author`) in `mcp_config.json` running the Gitea-Tools server script, but with `cwd` and target repository set to an external project (e.g. `eAgenda`). 2. Authenticate the namespace correctly. 3. Attempt to create an issue. The Branches-only mutation guard will block the operation, failing the repository membership and `branches/` path assertions because they are evaluated against the Gitea-Tools root instead of the eAgenda root. ## Acceptance Criteria 1. Separate the concepts of immutable code/install root (`PROJECT_ROOT`) and namespace-specific repository workspace root (`process_project_root` / canonical repo root). 2. Explicitly configure namespace-scoped workspace binding (e.g. via `cwd` or environment variables) so that the MCP server correctly identifies the target repository. 3. Validate that the workspace belongs to the intended target repository, not necessarily the code installation root. 4. Enforce the branches-only mutation guard inside the target repository. 5. Fail closed for missing, conflicting, or forged bindings. 6. Provide simultaneous isolation of `prgs` and `mdcps` (or other remote) namespaces. 7. Add regression tests using two distinct repositories/worktrees to prove cross-repository bindings work safely. 8. Ensure no weakening of the root-checkout, remote/repository, or anti-stomp guards. ## Downstream Blocker This defect currently blocks the eAgenda document-management reconciliation task, which depends on a functioning `eagenda-author` namespace. ## Related Context - Does not overlap with #510 (intra-repository role isolation) or #672 (IDE config sync).
jcwalker3 added the type:bug label 2026-07-13 21:01:07 -05:00
Author
Owner

Canonical Issue State

STATE: Blocked
WHO_IS_NEXT: user
NEXT_ACTION: Fix cross-repository workspace binding logic in namespace_workspace_binding.py or gitea_mcp_server.py.
NEXT_PROMPT:

Resume the Gitea-Tools workspace binding fix for Issue #706.

WHAT_HAPPENED: The eAgenda umbrella and eight child issues remain blocked. Downstream eAgenda validation showed that the native eagenda-author daemon restarted correctly on current master with identity 913443 / mdcps-author and required read/create/comment capabilities. The MCP cwd points to the clean eAgenda author worktree. However, runtime_context still reports both canonical_repository_root and active_task_workspace_root as /Users/jasonwalker/Development/Gitea-Tools.
WHY: The hardcoded workspace binding logic persists on the current deployed master, proving this is not stale-process or client-configuration residue.
RELATED_PRS: N/A
BLOCKERS: Gitea-Tools MCP server is resolving the workspace root based on the script directory rather than the passed cwd. Unblock condition: The server must successfully parse the MCP client's cwd and bind active_task_workspace_root to it.
VALIDATION: gitea_whoami and gitea_get_runtime_context were called natively on the eagenda-author server; no direct API, CLI bypass, process kill, or cross-project patch was attempted.
LAST_UPDATED_BY: Antigravity AI

## Canonical Issue State STATE: Blocked WHO_IS_NEXT: user NEXT_ACTION: Fix cross-repository workspace binding logic in `namespace_workspace_binding.py` or `gitea_mcp_server.py`. NEXT_PROMPT: ```text Resume the Gitea-Tools workspace binding fix for Issue #706. ``` WHAT_HAPPENED: The eAgenda umbrella and eight child issues remain blocked. Downstream eAgenda validation showed that the native `eagenda-author` daemon restarted correctly on current master with identity `913443` / `mdcps-author` and required read/create/comment capabilities. The MCP `cwd` points to the clean eAgenda author worktree. However, `runtime_context` still reports both `canonical_repository_root` and `active_task_workspace_root` as `/Users/jasonwalker/Development/Gitea-Tools`. WHY: The hardcoded workspace binding logic persists on the current deployed master, proving this is not stale-process or client-configuration residue. RELATED_PRS: N/A BLOCKERS: Gitea-Tools MCP server is resolving the workspace root based on the script directory rather than the passed `cwd`. Unblock condition: The server must successfully parse the MCP client's cwd and bind active_task_workspace_root to it. VALIDATION: `gitea_whoami` and `gitea_get_runtime_context` were called natively on the `eagenda-author` server; no direct API, CLI bypass, process kill, or cross-project patch was attempted. LAST_UPDATED_BY: Antigravity AI
Sign in to join this conversation.
No labels type:bug
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#706