Skip to content

mcpx: callWithLedger ignores operator-declared readOnlyTools — a declared read-only tool that times out after dispatch records an unknown outcome and blocks later writes #6493

Closed

Description

@dezren39

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 readOnlyHint times out or loses its connection after dispatch, callWithLedger in registry.go still classifies it using only the annotation-based toolReadOnly helper. Consequently, a declared search such as fff.grep returns ErrUnknownOutcome and 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

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) — and toolReadOnly (~line 2309) classifies solely from cached tool annotations (policy.Classify(candidate.Annotations).ReadOnly), treating missing annotations as a write.
  • registry.go contains no use of the operator declaration at all (zero occurrences of declaredReadOnly in the file).
  • The declaration helper does exist and is used elsewhere: pkgs/mcpx/internal/daemon/consumer.go defines declaredReadOnly(server, tool) (~line 446) and applies it in confirmDestructive and in the gate classification — exactly the "gate and existing-block exemption" surfaces the reviewer named — but the post-dispatch ledger path in registry.go never consults it.
  • Net effect, as the reviewer described: an operator-declared read-only search (e.g. fff.grep, declared in home/common/mcpx-settings.nix) that times out or disconnects after dispatch returns ErrUnknownOutcome and 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-declared readOnlyTools (e.g. via the existing declaredReadOnly helper), 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

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    priority/normalOrdinary priority (the default)
    on Nov 6, 2026
  2. developing-today commented on Nov 6, 2026

    @developing-today
    Contributor
  3. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  4. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 6, 2026
  5. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

  6. 103 remaining items

  7. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 11, 2026
  8. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up (resume)

  9. added a commit that references this issue on Nov 11, 2026
  10. dezren39 commented on Nov 11, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done (fixed_merged)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/mcpxPackage/app: mcpx (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/pr-comment-reviewFiled by the pr-comment-review jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions