test(agents): add failing regression for the skill gate's OR-composed global safety (#189) #192
No reviewers
Labels
No labels
auto/blocked-by-deps
auto/ci-timeout
auto/claimed-implementer
auto/claimed-merge
auto/claimed-reviewer
auto/driver-down
auto/invariant-violation
auto/last-attempt-tier-0
auto/last-attempt-tier-1
auto/last-attempt-tier-2
auto/last-attempt-tier-min
Automation Tracking
auto/needs-conflict-resolution
auto/needs-implementer
auto/postmortem
auto/ready-to-merge
auto/restart-throttled
auto/revert
auto/sentinel
auto/stale-inactivity
auto/unstable
Blocked
Bounty
$100
Bounty
$1000
Bounty
$10000
Bounty
$20
Bounty
$2000
Bounty
$250
Bounty
$50
Bounty
$500
Bounty
$5000
Bounty
$750
MoSCoW
Could have
MoSCoW
Must have
MoSCoW
Should have
Needs Feedback
Points
1
Points
13
Points
2
Points
21
Points
3
Points
34
Points
5
Points
55
Points
8
Points
88
Priority
Backlog
Priority
CI Blocker
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Signed-off: Owner
Signed-off: Scrum Master
Signed-off: Tech Lead
Spike
State
Completed
State
Duplicate
State
In Progress
State
In Review
State
Paused
State
Unverified
State
Verified
State
Wont Do
Type
Automation
Type
Bug
Type
Discussion
Type
Documentation
Type
Epic
Type
Feature
Type
Legendary
Type
Refactor
Type
Support
Type
Task
Type
Testing
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
Reference
cleveragents/cleveractors-core!192
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "tdd/m1-skill-gate-global-safety-and"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Adds the mandatory TDD issue-capture test for #189 ("
ToolAgent._is_global_unsafecomposes host-unsafe-mode and the agent's ownsafe_modewith OR instead of AND, weakening the skill double-safety gate (ADR-2034 D-9)").ToolAgent._is_global_unsafe(src/cleveractors/agents/tool.py, ~line 1622) currently returns(not self.safe_mode) or bool(context.get("_unsafe_mode", False)). Because this is an OR, either the agent's ownsafe_mode: falsealone, or the invocation context's_unsafe_mode: truealone, opens the "global safety" half of the ADR-2034 D-9 double-safety gate — even though the corrected D-9 text (amended 2026-11-25; seedocs/adr/ADR-2034-skill-package-support.mdanddocs/index.md§4.4.8) requires both to hold at once, mirroring the AND composition §13 already uses for shell execution.This PR adds a new Behave scenario to
features/agent_skills.feature, alongside the existing double-safety-gate coverage, tagged@tdd_issue @tdd_issue_189 @tdd_expected_fail:ToolAgent's own"safe_mode"at its defaulttrue.safe_mode: falsepdf-processingskill bundling the existing "every D-8 class" fixture (fixtures/sample.pdf, a non-standard resource)._unsafe_mode: true).No new step definitions were added — every step already existed in
features/steps/agent_skills_steps.pyand is reused as-is.Verified locally that removing
@tdd_expected_failmakes the scenario's assertion genuinely fail against currentdevelop(the gate currently opens and the read succeeds instead of being refused), proving the bug. The failing step raises onlyAssertionError, so the TDD CI hook inverts it correctly and the scenario passes CI with the tag in place.The actual fix (switching
_is_global_unsafeto AND) lands separately onbugfix/m1-skill-gate-global-safety-andfor issue #189, once this TDD PR is merged.Note: this repository's PRs target
develop(notmaster); issue #190's Definition of Done has been amended accordingly.Closes #190
Test plan
nox -s lint— greennox -s format -- --check— greennox -s typecheck— green (0 errors)nox -s security_scan— green (bandit + semgrep, 0 findings)nox -s dead_code— green (vulture, 0 findings)nox -s complexity— green (informational)nox -s unit_tests— green (3362/3362 scenarios, including the new TDD scenario passing via@tdd_expected_failinversion)nox -s integration_tests— green (382/382 Robot Framework tests)nox -s coverage_report— 97.3% (≥ 97% threshold)nox -s build— green@tdd_expected_failis removed locally (proving the bug is genuinely reproduced)🤖 Generated with Claude Code
PR Review: !192 (Ticket #190)
Verdict: Request Changes
The TDD scenario itself is correct, minimal, and verified end-to-end locally: it is a single atomic commit on
developtouching onlyfeatures/agent_skills.feature, all steps reuse existing definitions, the tag trio matches CONTRIBUTING's TDD rules (@tdd_issue_189correctly references the bug issue), and the failure path raises onlyAssertionError. Local verification: with the tag removed the scenario fails at theThenstep withASSERT FAILED: Expected an ExecutionError but none was raised(bug genuinely reproduced — under the current OR composition the read succeeds), and with the tag in place it passes via inversion (nox -s coverage_report: 97.3%, full behave suite green;nox -s lintandnox -s typecheckgreen). The post-fix refusal message (...global safety is true, skill safety is false.) matches the asserted substring, so the scenario will pass once the fix lands.The one blocking problem is that the spec correction this entire PR is premised on does not exist in the repository. Per the reviewer instruction to drop items already decided out-of-scope or deferred: there are no PR comments or responses on !192 (0 comments, 0 reviews, 0 inline threads), and neither #189 nor #190 records any deferral — both tickets affirmatively claim the D-9 text was "amended 2026-11-25", which is factually not the case in the repo, so the item stays in scope.
Critical Issues
None.
Major Issues
docs/adr/ADR-2034-skill-package-support.md(D-9, "Global safety is false", ~line 405) anddocs/index.md§4.4.8 (~line 607) still normatively specify the OR composition ("either this agent's ownsafe_mode… or the invocation context already carries_unsafe_mode: true"). Verified: no branch (this PR branch,develop,master, all remote branches) contains a 2026-11-25 revision of either file, no commit since 2026-11-24 touched them, the ADR revision history's latest entry is 2026-11-09, and no open PR or tracked issue commits the amendment (only open PRs: !192 and the fix !193). PR !193's description states the doc updates are "uncommitted, pre-existing … not part of this PR's commit" — i.e., the correction lives only in an uncommitted working tree and is at risk of never landing. If !192 and !193 merge as-is,developwill have committed tests and code enforcing AND while the authoritative spec mandates OR — a direct spec/implementation contradiction under the project rule that the specification is the source of truth. The tickets also cite a nonexistent "A-14" alternative (the ADR ends at A-13).Recommendation: commit the D-9 + §4.4.8 +
docs/tools/safe-mode.mdamendment — most naturally as a docs commit in this PR (its entire premise is the corrected D-9 text) or in a dedicated docs PR merged before or with !193 — and correct the "amended 2026-11-25" citations in #189/#190 (and the A-14 reference in #189) once it lands.Minor Issues
features/agent_skills.feature:764. The sibling refusal scenarios assert both halves ("global safety is true" and "skill safety is false", plus the resource path); this scenario asserts only"global safety is true". After the fix, the refusal message will read"...global safety is true, skill safety is false.", so addingAnd the skill tool should fail with message containing "skill safety is false"would prove the gate closed for the exact D-9 reason (skill opted in, global half closed) and would catch an implementation that refuses all non-standard reads unconditionally. This changes nothing about today's inversion behavior (the first assert fails identically), so it can also be folded into !193 when the tag is removed — but it is cheap to do here.Nits
CHANGELOG.mdentry (CONTRIBUTING PR rule 6). !193's changelog entry covers the overall #189 item, so this is procedural only and not blocking per this review's scope.Summary
A well-executed TDD capture: exactly the missing quadrant (agent's own
safe_modestilltrue+ context_unsafe_mode: true), reusing all existing steps, correctly tagged, and proven both ways locally (fails withAssertionErrorwithout the tag; passes via inversion with it; full suite + coverage 97.3%, lint, and typecheck all green on this commit). The single blocker is traceability: the corrected D-9 / §4.4.8 text that the PR (and tickets #189/#190) cite as "amended 2026-11-25" has never been committed to the repository and is tracked nowhere, which would leave the committed spec contradicting the committed tests and code once !193 merges. Land the spec amendment (here or alongside !193) and this is good to merge. Note: no gism0 MCP tools were available, so no ticket memory journal was consulted.@ -751,0 +761,4 @@And the invocation context is globally unsafeWhen I create the ToolAgentAnd I read resource "fixtures/sample.pdf" via the skill tool for skill "pdf-processing"Then the skill tool should fail with message containing "global safety is true"Minor: the sibling refusal scenarios assert both halves of the gate (e.g.
And the skill tool should fail with message containing "skill safety is false"plus the resource path). Suggest adding the same here so the assertion pins the exact D-9 refusal signature ("...global safety is true, skill safety is false.") rather than just the global half — this would also catch an implementation that refuses all non-standard reads unconditionally. No effect on today's inversion (the first assert fails identically); fine to fold into !193 when the tag is removed if preferred.PR Review: !192 (Ticket #190)
Verdict: Request Changes
The TDD scenario itself is correct, minimal, and verified end-to-end locally: it is a single atomic commit on
developtouching onlyfeatures/agent_skills.feature, all steps reuse existing definitions, the tag trio matches CONTRIBUTING's TDD rules (@tdd_issue_189correctly references the bug issue), and the failure path raises onlyAssertionError. Local verification: with the tag removed the scenario fails at theThenstep withASSERT FAILED: Expected an ExecutionError but none was raised(bug genuinely reproduced — under the current OR composition the read succeeds), and with the tag in place it passes via inversion (nox -s coverage_report: 97.3%, full behave suite green;nox -s lintandnox -s typecheckgreen). The post-fix refusal message (...global safety is true, skill safety is false.) matches the asserted substring, so the scenario will pass once the fix lands.The one blocking problem is that the spec correction this entire PR is premised on does not exist in the repository. Per the reviewer instruction to drop items already decided out-of-scope or deferred: there are no PR comments or responses on !192 (0 comments, 0 reviews, 0 inline threads), and neither #189 nor #190 records any deferral — both tickets affirmatively claim the D-9 text was "amended 2026-11-25", which is factually not the case in the repo, so the item stays in scope.
Critical Issues
None.
Major Issues
docs/adr/ADR-2034-skill-package-support.md(D-9, "Global safety is false", ~line 405) anddocs/index.md§4.4.8 (~line 607) still normatively specify the OR composition ("either this agent's ownsafe_mode… or the invocation context already carries_unsafe_mode: true"). Verified: no branch (this PR branch,develop,master, all remote branches) contains a 2026-11-25 revision of either file, no commit since 2026-11-24 touched them, the ADR revision history's latest entry is 2026-11-09, and no open PR or tracked issue commits the amendment (only open PRs: !192 and the fix !193). PR !193's description states the doc updates are "uncommitted, pre-existing … not part of this PR's commit" — i.e., the correction lives only in an uncommitted working tree and is at risk of never landing. If !192 and !193 merge as-is,developwill have committed tests and code enforcing AND while the authoritative spec mandates OR — a direct spec/implementation contradiction under the project rule that the specification is the source of truth. The tickets also cite a nonexistent "A-14" alternative (the ADR ends at A-13).Recommendation: commit the D-9 + §4.4.8 +
docs/tools/safe-mode.mdamendment — most naturally as a docs commit in this PR (its entire premise is the corrected D-9 text) or in a dedicated docs PR merged before or with !193 — and correct the "amended 2026-11-25" citations in #189/#190 (and the A-14 reference in #189) once it lands.Minor Issues
features/agent_skills.feature:764. The sibling refusal scenarios assert both halves ("global safety is true" and "skill safety is false", plus the resource path); this scenario asserts only"global safety is true". After the fix, the refusal message will read"...global safety is true, skill safety is false.", so addingAnd the skill tool should fail with message containing "skill safety is false"would prove the gate closed for the exact D-9 reason (skill opted in, global half closed) and would catch an implementation that refuses all non-standard reads unconditionally. This changes nothing about today's inversion behavior (the first assert fails identically), so it can also be folded into !193 when the tag is removed — but it is cheap to do here.Nits
CHANGELOG.mdentry (CONTRIBUTING PR rule 6). !193's changelog entry covers the overall #189 item, so this is procedural only and not blocking per this review's scope.Summary
A well-executed TDD capture: exactly the missing quadrant (agent's own
safe_modestilltrue+ context_unsafe_mode: true), reusing all existing steps, correctly tagged, and proven both ways locally (fails withAssertionErrorwithout the tag; passes via inversion with it; full suite + coverage 97.3%, lint, and typecheck all green on this commit). The single blocker is traceability: the corrected D-9 / §4.4.8 text that the PR (and tickets #189/#190) cite as "amended 2026-11-25" has never been committed to the repository and is tracked nowhere, which would leave the committed spec contradicting the committed tests and code once !193 merges. Land the spec amendment (here or alongside !193) and this is good to merge. Note: no gism0 MCP tools were available, so no ticket memory journal was consulted.@ -751,0 +761,4 @@And the invocation context is globally unsafeWhen I create the ToolAgentAnd I read resource "fixtures/sample.pdf" via the skill tool for skill "pdf-processing"Then the skill tool should fail with message containing "global safety is true"Minor: the sibling refusal scenarios assert both halves of the gate (e.g.
And the skill tool should fail with message containing "skill safety is false"plus the resource path). Suggest adding the same here so the assertion pins the exact D-9 refusal signature ("...global safety is true, skill safety is false.") rather than just the global half — this would also catch an implementation that refuses all non-standard reads unconditionally. No effect on today's inversion (the first assert fails identically); fine to fold into !193 when the tag is removed if preferred.f95e162697d186c6e146Addressed in commit
d186c6e(amended — this is a single-commit TDD issue, #190, so the fix was folded into the same commit rather than added as a new one, per CONTRIBUTING's single-commit-per-issue rule):docs/adr/ADR-2034-skill-package-support.mdD-9,docs/index.md§4.4.8,docs/actor-registry-standard.md§16.1, anddocs/tools/safe-mode.mdwere indeed uncommitted anywhere. Landed the full D-9 correction (OR→AND) and D-11 addition in this commit, alongside the regression test it motivates. This also resolves the "A-14 doesn't exist" sub-point — the ADR draft already defines A-14/A-15 as part of this same amendment, so once committed the citation is correct.And the skill tool should fail with message containing "skill safety is false"to the scenario, matching the sibling refusal scenarios.Verified locally:
nox -s lint,nox -s format -- --check,nox -s typecheck,nox -s unit_tests(full suite, 3362/3362; scopedfeatures/agent_skills.feature, 152/152),nox -s docsall green. Confirmed via a coverage-delta check that this feature's own scenarios fully exerciseToolAgent._is_global_unsafeand bothgate_opencall sites (no missing lines in that region) — no src/ changed in this commit, so the full-suite coverage/security/dead-code/complexity/build/integration gates are unaffected and weren't re-run.Re-requesting review.
PR Review: !192 (Ticket #190)
Verdict: Approve
All three items from the previous review round are addressed in the amended commit
d186c6eand verified against the latest code. Everything claimed in the author's response checks out locally.Re-verification of previously reported items:
d186c6eand is internally consistent across all four files:docs/adr/ADR-2034-skill-package-support.md(D-9 "Global safety" corrected OR→AND with the correction note, new D-11, rejected alternatives A-14/A-15 — which resolves the former "A-14 doesn't exist" sub-point — consequences, risks, and a 2026-11-25 Revision History entry),docs/index.md§4.4.8 (AND wording + "Either alone is insufficient", patch bump to 1.10.1 with matching revision-history entry, D-11 referenced under "Resolution and validation"),docs/actor-registry-standard.md(§16.1 safe-mode/resource consistency rule, §16.3 example clarified, §15 version line + history bumped to 1.3.0), anddocs/tools/safe-mode.md(gate composition corrected + D-11 load-time audit note). A repo-wide grep finds no remaining doc text still describing the OR composition. The D-11 spec/code gap is intentionally staged: its implementation is tracked in open issue #191, and the D-9 code fix is PR !193, whose branch is already stacked directly ond186c6e(verified:origin/bugfix/m1-skill-gate-global-safety-and=d186c6e+d1ee3c0), so merge order is conflict-free and the spec and its enforcing code land together ondevelop.And the skill tool should fail with message containing "skill safety is false", matching the sibling refusal scenarios. Verified from code that the post-fix path reaches the gate refusal branch (not a "resource not found" error):_require_skill_resourcelooks up the validated catalogue regardless of gate state, and_read_skill_resourceraises the gateExecutionErrorfor a non-standard class when closed — producing exactly"global safety is true, skill safety is false.". So the scenario will genuinely pass once !193 removes the tag (it does), and the second assertion guards against a blanket refusal of all non-standard reads.### Changed, describing the end state of the unreleased changes.Local verification (authoritative, on
d186c6e):nox -s unit_tests -- features/agent_skills.feature: 152/152 scenarios pass (the new TDD scenario passes via@tdd_expected_failinversion).ThenwithASSERT FAILED: Expected an ExecutionError but none was raised— a pureAssertionError, so the inversion policy handles it correctly, and the bug is genuinely reproduced against currentdevelop(working tree restored afterwards).nox -s lint,nox -s typecheck(0 errors),nox -s docs: all green.src/changes, so coverage/other gates are structurally unaffected (author reports 97.3% ≥ 97% threshold; full suite 3362/3362).@tdd_issue @tdd_issue_189 @tdd_expected_fail, referencing the bug issue #189), agent's ownsafe_modeleft at defaulttrue(config omits it;ToolAgentdefaults toTrue),every D-8 classfixture reused withfixtures/sample.pdf,AssertionError-only failure, all steps reused from the shared steps file with no new definitions, single amended commit whose first line matches the Metadata Commit Message exactly, branchtdd/m1-skill-gate-global-safety-andmatches Metadata, based ondevelop, with !193 properly stacked behind it.(Note: no gism0 MCP tools available in this environment, so no ticket memory journal was consulted; tickets #189/#190 and prior PR discussion were read directly from Forgejo.)
Critical Issues
None.
Major Issues
None.
Minor Issues
None.
Nits
CHANGELOG.md:12— the trailing(issue #189)scopes the whole bullet, but its second sentence ("a skill left in safe mode can no longer bundle a script or non-standard resource") corresponds to ADR-2034 D-11, whose implementation is tracked as #191, not #189. Purely a reference-precision point in a permanent record; harmless and safe to leave as-is (or amend opportunistically in !193's changelog touch). Non-blocking.Summary
A well-executed TDD capture, now complete: the missing gate quadrant (agent's own
safe_modestilltrue+ context_unsafe_mode: true) is pinned exactly, every step is reused, tags are correct, and the failure is proven both ways locally (fails withAssertionErrorwithout the tag; passes via inversion with it; 152/152 in the touched feature, lint/typecheck/docs green). The previous traceability blocker is fully resolved — the corrected D-9/D-11 spec text is committed in the same commit as the regression it motivates, D-11's implementation has its own tracked issue (#191), and the fix PR !193 is stacked on this commit with the tag removal and sibling-scenario updates already in place. Good to merge; merge !192 before !193.