Repository navigation
Description
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_taskrow that the peer check itself refused. Such a row is closedSKIPPEDwithRefused 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
SKIPPEDwith 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
enforceagree on what counts as an invocation. A pairenforcewould 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.mdanddocs/memory/requirements/skills.md(PEER_SKILL_SURFACE) say what counts as an invocation.
Context
- A peer dispatch that only MENTIONS a library skill with a leading slash is refused 403 skill_not_granted — the match-anywhere rule is terminal on the ent#662 path #3949: the claim-time ruling chose a text-only fix (the issue's fix shape 3). Shape 1, a peer-only matcher, was held for abilityai/trinity-enterprise#925. Shape 2, an approval instead of a 403, is out of scope.
- PR fix(skills): a peer refusal says a mention trips it and how to send one, never to widen a grant (#3949) #4070: the refusal now says a mention trips it, says how to resend, and gives no grant advice.
Activity