Author worktree binding can disappear mid-session and mutation guards enforce it inconsistently #618

Open
opened 2026-07-09 21:21:12 -05:00 by jcwalker3 · 0 comments
Owner

Problem

The author MCP runtime can remain bound to a role worktree path that no longer exists on disk.

Observed case:

  • GITEA_AUTHOR_WORKTREE pointed to branches/mcp-author-clean-ns
  • that path did not exist on disk
  • it was not present in git worktree list
  • runtime context showed preflight_workspace.inspected_git_root: null

create_issue correctly failed closed under the branches-only / worktree-existence guard.

However, an earlier create_issue_comment mutation succeeded from the same broader author environment. This suggests mutation guard behavior is inconsistent between issue creation and issue comment paths.

Impact

This creates confusing and unsafe behavior:

  • one mutation path blocks because the bound worktree is missing
  • another mutation path may still mutate
  • the runtime may appear partially healthy
  • author sessions cannot reliably know whether the namespace is safe for mutation
  • missing worktree binding becomes an environment/tooling blocker instead of a clear early runtime failure

Required behavior

If a role-bound worktree path is configured but missing, the MCP runtime must fail early and consistently before any mutation.

All author mutation tools should agree on workspace safety.

At minimum, these paths must not disagree:

  • create_issue
  • create_issue_comment
  • label mutations
  • issue status mutations
  • PR/review/merge/reconcile mutations where applicable

Acceptance criteria

  1. Runtime context fails or clearly reports an unhealthy state when a configured role-bound worktree path does not exist.

  2. The error must identify:

    • role/profile
    • configured worktree path
    • whether the path exists
    • whether it appears in git worktree list
    • whether inspected_git_root is null
    • operator recovery instructions
  3. create_issue and create_issue_comment must enforce the same worktree-existence rule.

  4. If GITEA_AUTHOR_WORKTREE points to a missing path, all author mutation tools must fail closed before API mutation.

  5. The runtime should return a clear blocker message:
    bound worktree missing; operator must recreate or repoint the worktree and reconnect

  6. Add tests for:

    • missing GITEA_AUTHOR_WORKTREE
    • deleted role-bound author worktree
    • create_issue blocked
    • create_issue_comment blocked consistently
    • runtime context reports inspected_git_root=null
    • operator recovery by recreating/repointing the worktree
  7. Add or update canonical [THREAD STATE LEDGER] example for this blocker class.

Related issues

Related but not duplicates:

  • #450 — create_issue worktree_path fail-closed
  • #560 — create_issue_comment worktree binding
  • #460 — branches-only guard vs runtime_context agreement
  • #510 — workspace binding isolation
  • #610 — resolver vs parity disagreement on stale runtime
  • #617 — auto-mode classifier mutation-budget issue

Desired outcome

A missing role-bound worktree should be a clear environment/tooling blocker.

The MCP runtime must not allow one author mutation path to proceed while another blocks on the same missing worktree binding.

## Problem The author MCP runtime can remain bound to a role worktree path that no longer exists on disk. Observed case: - `GITEA_AUTHOR_WORKTREE` pointed to `branches/mcp-author-clean-ns` - that path did not exist on disk - it was not present in `git worktree list` - runtime context showed `preflight_workspace.inspected_git_root: null` `create_issue` correctly failed closed under the branches-only / worktree-existence guard. However, an earlier `create_issue_comment` mutation succeeded from the same broader author environment. This suggests mutation guard behavior is inconsistent between issue creation and issue comment paths. ## Impact This creates confusing and unsafe behavior: - one mutation path blocks because the bound worktree is missing - another mutation path may still mutate - the runtime may appear partially healthy - author sessions cannot reliably know whether the namespace is safe for mutation - missing worktree binding becomes an environment/tooling blocker instead of a clear early runtime failure ## Required behavior If a role-bound worktree path is configured but missing, the MCP runtime must fail early and consistently before any mutation. All author mutation tools should agree on workspace safety. At minimum, these paths must not disagree: - `create_issue` - `create_issue_comment` - label mutations - issue status mutations - PR/review/merge/reconcile mutations where applicable ## Acceptance criteria 1. Runtime context fails or clearly reports an unhealthy state when a configured role-bound worktree path does not exist. 2. The error must identify: - role/profile - configured worktree path - whether the path exists - whether it appears in `git worktree list` - whether `inspected_git_root` is null - operator recovery instructions 3. `create_issue` and `create_issue_comment` must enforce the same worktree-existence rule. 4. If `GITEA_AUTHOR_WORKTREE` points to a missing path, all author mutation tools must fail closed before API mutation. 5. The runtime should return a clear blocker message: `bound worktree missing; operator must recreate or repoint the worktree and reconnect` 6. Add tests for: - missing `GITEA_AUTHOR_WORKTREE` - deleted role-bound author worktree - `create_issue` blocked - `create_issue_comment` blocked consistently - runtime context reports `inspected_git_root=null` - operator recovery by recreating/repointing the worktree 7. Add or update canonical `[THREAD STATE LEDGER]` example for this blocker class. ## Related issues Related but not duplicates: - #450 — create_issue worktree_path fail-closed - #560 — create_issue_comment worktree binding - #460 — branches-only guard vs runtime_context agreement - #510 — workspace binding isolation - #610 — resolver vs parity disagreement on stale runtime - #617 — auto-mode classifier mutation-budget issue ## Desired outcome A missing role-bound worktree should be a clear environment/tooling blocker. The MCP runtime must not allow one author mutation path to proceed while another blocks on the same missing worktree binding.
jcwalker3 added the bugtype:guardrailstatus:readymcp-health labels 2026-07-09 21:21:12 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

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