Repository navigation
fix(skills): a peer refusal says a mention trips it and how to send one, never to widen a grant (#3949) - #4070
Conversation
…ne, never to widen a grant (#3949) The ent#662 peer check reads a library skill's `/name` anywhere in the message, so a peer that only MENTIONS the skill is refused 403 skill_not_granted. The refusal then told the calling model, which the delegation contract instructs to "do what it says" on retryable:false, that an instance admin can grant it in the caller's Permissions panel: the remedy for a string match in prose was to widen a standing permission. The refusal now says nothing was delivered, names the skills, caller and agent, says how to send a mere mention (drop the leading slash) and that the skill's steps must not be carried out another way. The grant sentence is removed. Names stay slash-free, since the text lands in rows and replies. Text only: the matcher, the 403 skill_not_granted decision, retryable:false, the context-text scan and the audit row are unchanged. A narrower peer matcher waits for Abilityai/trinity-enterprise#925. Refs #3949 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a mention is refused too (#3949) With several names the refusal now reads "write their names without the leading slashes". The user doc for agent permissions adds one sentence: a message that only mentions a library skill with a leading slash is refused too, and writing the name without the slash delivers it. Refs #3949 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…model (#3949) Review fragment for PR #4070: when a heuristic can trigger a refusal, its remedy must cover the false-positive case and never point at widening authority, because MCP callers are told to do what a retryable:false refusal says. Refs #3949 Co-Authored-By: Claude Opus 5.5 <[email protected]>
dolho
left a comment
There was a problem hiding this comment.
/review: no critical issues, approving
The tests run the changed text: 43/43 pass, and with the old f-string restored 6 of the 8 new tests fail, as the PR says. The execute_task backstop test covers the fan-out SKIPPED row too. CI is green.
Two informational notes, both text-only, so both fit the #3949 ruling:
I1. The refusal now explains how to get around the gate, including when the request was real.
The same text goes to a peer that really asks for the skill, for example please run /pay-invoice. The matcher only fires on a slash (_BEFORE = r"(?<![a-z./])/" in utils/skill_invocation.py), and its docstring says plain prose is not a boundary (that is the in-container hook, trinity-enterprise#752). So "write its name without the leading slash and send again" tells the refused model that run pay-invoice gets through. "Do not carry out its steps another way" stops the caller from doing the work itself, but not from asking the callee by bare name. Suggest one more sentence, e.g. "Asking for it by name without the slash is the same request and is not permitted."
I2. "This message names…" is wrong when the match came from context_text.
enforce also scans context_text (peer_skill_policy.py:118, e.g. the MCP key name, which test_a_name_hidden_in_the_context_text_is_read_too covers). There, removing the slash from the message changes nothing, so the advice sends the model into pointless resends. Suggest different wording when the names come only from the context text, plus a test that pins the refusal text on that path.
🤖 Generated with Claude Code
…is the same request (#3949) Review note I1 on PR #4070: "write its name without the leading slash and send again" also tells a peer that really meant to run the skill how to get past the dispatch-time check, which only fires on a slash. "Do not carry out its steps another way" stopped the caller doing the work itself, not asking the callee by bare name. The refusal now adds "Asking for it by name without the slash is the same request and is not permitted." (plural: them / slashes). Text only, like the rest of #3949. Refs #3949 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks @dolho. Both notes are addressed below. I1: fixed in 12f2a4b. The refusal now ends with "Asking for it by name without the slash is the same request and is not permitted." The plural form is "Asking for them by name without the slashes …". The exact-text tests (singular, plural, and the I2: no change, because a real peer cannot reach this path. For a peer, the context text holds only two values (
Only the synthetic The ent#662 and neighbouring gate suites pass (133). CI is re-running on the new head. |
Summary
The abilityai/trinity-enterprise#662 peer check finds a library skill's
/nameanywhere in a message, so a peer that only mentions the skill is refused403 skill_not_granted. The refusal used to end "An instance admin can grant it in 's Permissions panel". The delegation contract tells the calling model to do what aretryable: falserefusal says, so the remedy it offered for a string match in prose was to widen a standing permission.The refusal now says:
The grant sentence is removed. Names stay slash-free, because the text lands in execution rows and replies.
Text only. These are unchanged:
find_gated_invocations);skill_not_granteddecision andretryable: false;A message that only mentions a library skill is still refused. A narrower peer matcher waits for abilityai/trinity-enterprise#925. That matcher, and the drift report counting mentions as uses, are tracked in Peer skill check: a slashed mention is still refused, and the drift report offers Grant for mentions (follow-up to #3949) #4071 (ruling recorded on 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).
New text, one skill:
Several skills: "names the skills a, b, which … (they were assigned … and need a grant). If you only meant to mention them, write their names without the leading slashes … their steps … Asking for them by name without the slashes …"
Changes
src/backend/services/peer_skill_policy.py: the refusal f-string inenforce.tests/unit/test_ent662_peer_skill_surface.py: section 10 adds 8 tests:execute_taskbackstop (fan-out SKIPPED row) carries the same text.docs/memory/learnings/2026-10-28-refusal-text-is-a-model-instruction.md: the review's learnings fragment.docs/user-docs/collaboration/agent-permissions.md: one sentence saying a message that only mentions a library skill with a leading slash is refused too, and writing the name without the slash delivers it.No DB migrations and no frontend change. No other doc or MCP description quotes the refusal.
Test Plan
cd tests && pytest unit/test_ent662_peer_skill_surface.py -p no:randomlypasses 43. Before the fix, 6 of the new tests were red on the old wording. The 2 no-slash tests were already green, as a regression guard.test_ent751_*,test_3274_gate_context,test_ent753_gate_storage, the bug(gates): a held gated message is replayed to the agent in later history — it can act on a never-approved request #3402 held-row suites) are green too: 262 tests in total./verify-local --skip-agent:import mainsmoke test passed.TRINITY_DEFAULT_SYSTEM_MANIFEST=disabledexport artifact intest_3262_admin_username_owner.py. That file passes 10/10 without the variable and fails the same 3 with it.agent_permissionsedge A → B and a library skill assigned to B with no grant:/<skill>→403 skill_not_grantedwith the exact new text: no grant line and no slash before the name.accepted.Fixes #3949
🤖 Generated with Claude Code