Skip to content

Peer skill check: a slashed mention is still refused, and the drift report offers Grant for mentions (follow-up to #3949) #4071

Open

Description

@webmixgamer

Follow-up to #3949 (fixed by PR #4070). That PR changed only the refusal text. Two parts of the problem remain.

Summary

  • A. The drift report counts a mention as a use. Settings → Agents then offers Grant for it. This part is not blocked.
  • B. A peer message that only mentions a library skill with a leading slash is still refused 403 skill_not_granted. This part waits for abilityai/trinity-enterprise#925.

A. The drift report counts a mention as a use

peer_skill_policy._recent_uses reads the execution ledger through db.recent_peer_messages and runs utils/skill_invocation.find_gated_invocations over each message. That matcher finds a /name anywhere in the text. recent_peer_messages (db/peer_skill_grants.py) also has no status filter.

As a result, each of these messages counts as a "use" of the skill:

  • a message that only mentions /<library-skill>;
  • a fan-out or other execute_task row that the peer check itself refused. Such a row is closed SKIPPED with Refused by the skill gate (skill_not_granted): ….

drift_report() then lists the caller × skill pair in Settings → Agents with a Grant button. The per-edge view shows it as "last used". An admin is invited to widen a standing permission for something that was never an invocation.

This is the admin-side twin of the harm #3949 fixed in the refusal text.

B. A mid-text mention is still refused

The ent#662 peer check (peer_skill_policy.enforce) reuses the approval gate's match-anywhere matcher. So "the tree was left dirty by /example-skill" from a peer is refused 403, and nothing is delivered. Since #4070 the refusal tells the caller to resend without the slash, but the first send is still lost. Incident and correction traffic is where this happens most: agents cite each other's playbooks with the slash.

A peer-only matcher would count only imperative positions (start of the message or of a line, optionally after a bullet marker) and leave find_gated_invocations untouched for the approval gate. Do not narrow the shared matcher; its tests hold it to "only widens".

This waits for abilityai/trinity-enterprise#925 (peer grants enforced in-container). Until then, nothing downstream catches a mid-text invocation of an ungated library skill:

  • the in-container hook checks gates only;
  • non-Claude runtimes have no hook.

So a narrower dispatch-time check would let "please run /x" through.

These shipped tests in tests/unit/test_ent662_peer_skill_surface.py change meaning under B, so B needs a security ruling:

  • "please run /quarter-close now" is refused;
  • "/pay-invoice then /refund" names refund;
  • a name in the context text is read;
  • the drift report counts "please /pay-invoice 2" as a use.

Acceptance criteria

  • A: A row refused by the skill gate (status SKIPPED with a gate refusal) is never counted as a use. The report and the per-edge "last used" both ignore it.
  • A: The drift report and enforce agree on what counts as an invocation. A pair enforce would not refuse is never offered Grant (pinned by a test over the real ledger read).
  • B (after abilityai/trinity-enterprise#925): A peer message that only mentions a library skill mid-text is delivered. Line-start invocations, including bulleted ones, are still refused. The approval-gate matcher and its tests are unchanged.
  • B: The ent#662 tests whose meaning changes are updated with the security ruling recorded on this issue. docs/user-docs/collaboration/agent-permissions.md and docs/memory/requirements/skills.md (PEER_SKILL_SURFACE) say what counts as an invocation.

Context

Activity

  1. added
    priority-p2
    type-bug
    theme-reliability
    complexity-medium
    on Oct 28, 2026
  2. added
    status-ready
    on Oct 30, 2026
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

    complexity-mediumpriority-p2status-readytheme-reliabilitytype-bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions