Correct the Repo Tools manifest-failure and scope claims - #988
Merged
Conversation
A malformed .dispatch/tools.json entry throws out of loadRepoTools, which propagates through createDispatchMcpServer and out of the (already hijacked) MCP route — so the whole Dispatch MCP server fails for that session rather than just the repo_ tools going missing. Both docs-pane and the repo-tools SKILL.md described it as "repo_ tools disappear". parseRepoToolScope drops unrecognized scope entries and returns undefined when nothing is left, so a misspelled scope silently re-exposes a job-only tool to every agent. SKILL.md also still listed "reviewer" as a usable scope; routes/ mcp.ts only ever sets toolScope to "job" or "agent", so a tool scoped to "reviewer" alone reaches no one. api-spec said only agent-scoped MCP loads repo tools, from the agent's working directory. The job-scoped route loads them too, and both resolve the checkout root (worktree root, else repo root) from agent.cwd. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KzXr7HNouFonD29oEpgwPr
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.
Nightly docs audit — deep-dive on the docs-pane Repo Tools section (
next_focusfrom the previous run), plus its agent-facing restatement inplugins/dispatch/skills/repo-tools/SKILL.md.The diff since the last audited SHA (
60fdf6d1) was #983 (the previous run's own docs PR), #984 (mermaid split), #985 (type import) and #987 (palette tests) — nothing docs-relevant, so no pivot away fromnext_focus.Verified clean
Checked as sets in both directions, no changes needed:
AGENT_TOOLS(63 entries) — exact match in both directions, with the only extras being the fourjob_*and twodispatch_review_submit/add_feedbackentries the intro explicitly labels as job/reviewer-only.toolsRoot = worktreeRoot ?? repoRoot, matching "the worktree root for worktree agents, otherwise the repo root".runCommandonly arms one whentimeoutMsis passed) vs the 15s hard timeout on lifecycle hooks.--flag valuewhen non-empty, boolean appends--flagonly ontrue, omitted/null/false/""append nothing;name/type/flagrequired,descriptionnot.hooksonly.DISPATCH_AGENT_IDin the env for both tools and hooks; the stop hook firing from bothstopAgentandexecuteArchive; failures logged and never blocking.Fixed
Malformed manifest blast radius. Both docs-pane and SKILL.md said a typo makes "every
repo_tool disappear".parseRepoToolthrows insiderawTools.map, soloadRepoToolsrejects (verified with a two-entry manifest where only the second is bad — the good one is lost too). That rejection propagates throughcreateDispatchMcpServer→handleMcpRequestwith no catch, and the route has already calledreply.hijack(). The real symptom is the whole MCP server failing for that session, built-ins included — which is also the difference between "why did my repo tools vanish" and "why is Dispatch's MCP server down".Scope typos silently un-restrict.
parseRepoToolScopedrops unrecognized entries and returnsundefinedwhen nothing survives, which the filter reads as "no scope" — so a misspelledscopere-exposes a job-only tool to every agent. Documented on both surfaces.SKILL.md advertised a dead scope. The field table listed
revieweras a usable value.routes/mcp.tsonly ever setstoolScopeto"job"or"agent"(persona reviewers get"agent"), so a tool scoped torevieweralone is exposed to no one. The table now listsagent/job, with a note for manifests that still carry the old value.docs/03-api-spec.md. Said only agent-scoped MCP loads repo tools, "in the agent's working directory". The job-scoped route loads them too (that's what thescopearray selects between), and both resolve the checkout root fromagent.cwdrather than using it directly.Deferred
.dispatch/tools.jsonalready has one (repo-tools, since 0.11.12) pointing at this section, and a second tip for thestophook on the same config file didn't clear the bar.apps/server/src/shared/git/+archive.ts, including the backlog item aboutgit branch -Ddestroying unpushed commits on archive.🤖 Generated with Claude Code
https://claude.ai/code/session_01KzXr7HNouFonD29oEpgwPr