Skip to content

bug(mcp): a denied chat_with_agent / fan_out call is audited as a successful tool call #2807

Closed

Description

@webmixgamer

Summary

Every MCP tool is wrapped by withAudit (src/mcp-server/src/server.ts), which sets details.success by whether the tool threw (src/mcp-server/src/audit.ts). The checkAgentAccess denials in src/mcp-server/src/tools/chat.ts return a JSON string ({"error": "Access denied", "reason": …}) instead of throwing, so the audit row for a refused agent-to-agent call says success: true and carries no denial marker. An operator reading the audit log cannot tell a permitted call from a refused one.

Context

Found while building the J10 journey harness (#2349): its "the denial is observable" criterion holds for the caller (the tool result says why) but not for the operator. The harness asserts today that the row exists, and carries the denial marker as a strict=True xfail.

Acceptance Criteria

  • A checkAgentAccess denial in chat_with_agent, the dedicated chat_with_<slug> tools and fan_out produces an audit row with details.success == false (or an explicit denied: true plus the reason), without changing the JSON the caller receives — agents parse it
  • Flip condition for the J10 xfail: test_the_operator_can_see_that_a_call_was_refused passes and the marker is removed in the same PR

Technical Notes

Smallest shape: the deny branch records the audit outcome itself (success=false, reason) before returning, or throws an error the wrapper classifies while a thin catch preserves the caller-visible JSON.

Activity

  1. added
    priority-p2
    type-bug
    theme-security
    complexity-low
    status-ready
    on Sep 15, 2026
  2. removed
    status-ready
    on Sep 16, 2026
  3. webmixgamer commented on Sep 16, 2026

    @webmixgamer
    ContributorAuthor

    /claim

  4. added
    status-in-progress
    on Sep 16, 2026
  5. github-actions commented on Sep 16, 2026

    @github-actions

    Claimed by @webmixgamer. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/2807-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #2807
  6. added
    status-in-dev
    and removed
    status-in-progress
    on Sep 17, 2026
  7. webmixgamer commented on Sep 17, 2026

    @webmixgamer
    ContributorAuthor

    Landed on dev as 6c7e3d27c (PR #2855, squash-merged 2026-09-17 13:18Z); Deploy to Dev green on that SHA at 13:18:40Z, so the dev instance now records a refused tool call as success: false, denied: true, error: <reason>. The J10 journey asserts it on every PR. Closes at the next release cut. Follow-ups registered in the trinity-dev debt inbox: returned non-denial failures still audit as success; id-addressed tools leave target_id empty; refusals are not listable through the audit-log filters. Side finding filed as #2856 (a worker-history flake in test_2638).

  8. removed
    status-in-dev
    on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-lowpriority-p2theme-securitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions