Repository navigation
Description
mcpx: callWithLedger ignores operator-declared readOnlyTools — a declared read-only tool that times out after dispatch records an unknown outcome and blocks later writes
Finding (from PR review)
On PR #6265 ("mcpx: operator-declared readOnlyTools + typed gate refusals (#6116)"), Codex review raised a P2 finding that was never replied to, never fixed, and whose review thread is still unresolved; the PR merged with the finding live.
Reviewer: chatgpt-codex-connector[bot], 2026-11-05T15:38:25Z
Comment: #6265 (comment)
Location: pkgs/mcpx/internal/daemon/consumer.go:694 (the flagged call path; the ledger classification itself lives in registry.go)
Honor read-only declarations when recording unknown outcomes
When an operator-declared read-only tool without
readOnlyHinttimes out or loses its connection after dispatch,callWithLedgerinregistry.gostill classifies it using only the annotation-basedtoolReadOnlyhelper. Consequently, a declared search such asfff.grepreturnsErrUnknownOutcomeand persists a server-wide block on subsequent non-read-only calls until manually cleared, despite the new declaration classifying it as read-only here. Apply the requested server's declaration to the post-dispatch ledger classification as well, not just the gate and existing-block exemption.
No-response evidence
- PR mcpx: operator-declared readOnlyTools + typed gate refusals (#6116) #6265 merged 2026-11-05T16:03:17Z (merge commit 4e6cdb9), after the comment.
- The comment has no replies (verified by a fresh
gh apiread of the PR's inline comments, reviews, and conversation comments, cross-checked twice), and its GraphQL review thread reportsisResolved: false.
Still-live evidence (current main, verified 2026-11-06)
pkgs/mcpx/internal/daemon/registry.go,callWithLedger(~line 2330): on a post-dispatch error it records an unknown outcome whenever!toolReadOnly(p, tool)— andtoolReadOnly(~line 2309) classifies solely from cached tool annotations (policy.Classify(candidate.Annotations).ReadOnly), treating missing annotations as a write.registry.gocontains no use of the operator declaration at all (zero occurrences ofdeclaredReadOnlyin the file).- The declaration helper does exist and is used elsewhere:
pkgs/mcpx/internal/daemon/consumer.godefinesdeclaredReadOnly(server, tool)(~line 446) and applies it inconfirmDestructiveand in the gate classification — exactly the "gate and existing-block exemption" surfaces the reviewer named — but the post-dispatch ledger path inregistry.gonever consults it. - Net effect, as the reviewer described: an operator-declared read-only search (e.g.
fff.grep, declared inhome/common/mcpx-settings.nix) that times out or disconnects after dispatch returnsErrUnknownOutcomeand persists a server-wide unknown-outcome block on subsequent non-read-only calls until manually cleared.
Acceptance criteria
callWithLedger's unknown-outcome classification also honors the requested server's operator-declaredreadOnlyTools(e.g. via the existingdeclaredReadOnlyhelper), so a declared read-only tool's post-dispatch timeout/disconnect does not record an unknown outcome or persist a block.- A regression test covers the declared-read-only + post-dispatch failure case (and the annotation-only behavior for undeclared tools is unchanged).
- Or: the finding is resolved by a documented decision on this issue explaining why the ledger path must remain annotation-only.
Activity
developing-today commentedon Nov 6, 2026
CODE-1960
dezren39 commentedon Nov 6, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 6, 2026
🤖 Agent note · done
gh apiraw reads at mainb7a15d73e9e3782e03d4b9c376b07e0c5e10dac5(2026-11-06):pkgs/mcpx/internal/daemon/registry.gocallWithLedger(line 2330) records an unknown outcome on a post-dispatch error whenever!toolReadOnly(p, tool)— andtoolReadOnly(line 2309) classifies solely frompolicy.Classify(candidate.Annotations).ReadOnly, treating missing annotations as a write.registry.gocontains zero occurrences ofdeclaredReadOnly. The helper exists as aRegistrymethod inpkgs/mcpx/internal/daemon/consumer.go(line 452) and is applied inconfirmDestructive(line 458) and the gate classification (lines 597, 686) — the post-dispatch ledger path is the only classification surface that never consults it. Net effect as the reviewer described: an operator-declared read-only tool that times out/disconnects after dispatch returnsErrUnknownOutcomeand persists a server-wide block on later non-read-only calls until manually cleared.repo-health:v1:fix:developing-today/code:issue:6493): applydeclaredReadOnly(server, tool)incallWithLedger's classification (it is aRegistrymethod, directly callable there) plus a regression test for the declared-read-only + post-dispatch failure case, with undeclared-tool behavior unchanged. Per the packet, the source PR mcpx: operator-declared readOnlyTools + typed gate refusals (#6116) #6265 review thread is not replied to or resolved by this triage.103 remaining items
dezren39 commentedon Nov 11, 2026
🤖 Agent note · picked up (resume)
queue/10982-6493-declared-readonly-ledger, aabd09b) from a prior tranche of this same task: diff is exactly the two scoped files (registry.go classification nowtoolReadOnly(p, tool) || r.declaredReadOnly(server, tool), plus the regression test). No Codex comments or reviews on the PR. PR checks are all QUEUED on the runner backlog.Merge pull request #8390 from developing-today/queue/10982-6493-decla…
dezren39 commentedon Nov 11, 2026
🤖 Agent note · done (fixed_merged)
callWithLedger's unknown-outcome classification is nowtoolReadOnly(p, tool) || r.declaredReadOnly(server, tool)inpkgs/mcpx/internal/daemon/registry.go, with regression testTestCallWithLedgerHonorsDeclaredReadOnlyAfterDispatchinwrite_policy_test.go.ok github.com/developing-today/code/pkgs/mcpx/internal/daemon 30.603s; fix confirmed present on origin/main (registry.go:2340). PR checks were still QUEUED on the runner backlog at merge time; per standing merge authority the locally verified test is the gate and CI runs on main.