TDD: ToolAgent._is_global_unsafe composes host-unsafe-mode and the agent's own safe_mode with OR instead of AND, weakening the skill double-safety gate (ADR-2034 D-9) #190
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
1 participant
Notifications
Due date
No due date set.
Blocks
Depends on
#192 test(agents): add failing regression for the skill gate's OR-composed global safety (#189)
cleveragents/cleveractors-core
Reference
cleveragents/cleveractors-core#190
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Metadata
Commit Message:
test(agents): add failing regression for the skill gate's OR-composed global safety (#189)Branch:
tdd/m1-skill-gate-global-safety-andNote (amended 2026-11-25): This repository's PRs are submitted against
develop, notmaster. Every reference tomasterbelow describing the PR target/workflow baseline is corrected todevelopaccordingly; nothing else about the acceptance criteria changes.Background and context
Companion TDD issue for #189 ("ToolAgent._is_global_unsafe composes host-unsafe-mode and the agent's own safe_mode with OR instead of AND, weakening the skill double-safety gate (ADR-2034 D-9)"). Per this project's mandatory Bug Fix TDD workflow, a failing Behave scenario proving the bug exists must be written and merged to
developbefore any fix is implemented on abugfix/branch for #189.The defect:
ToolAgent._is_global_unsafe(src/cleveractors/agents/tool.py, ~line 1622) 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 D-9 (corrected 2026-11-09 revision, amended 2026-11-25) requires both to hold at once before a privileged skill operation (script execution, or reading/listing/executing a non-standard-folder resource) is permitted.Current behavior
No Behave scenario asserts that the gate stays closed when only one of the two global conditions holds. The existing scenarios in
features/agent_skills.featurethat open the gate (e.g. "A non-standard read succeeds when both safety switches are false", ~line 735) set onlythe invocation context is globally unsafeplusthe skill "pdf-processing" declares safe_mode false— never also configuring theToolAgent's own"safe_mode": false— and currently pass, which is only possible because the implementation treats either global condition as sufficient.Expected behavior
A Behave scenario exists, tagged
@tdd_issue @tdd_issue_189 @tdd_expected_fail, that:ToolAgentwith its own config"safe_mode"left at the defaulttrue(not set tofalse).pdf-processing) that declaressafe_mode: falseand bundles a non-standard-folder resource (e.g.fixtures/sample.pdf), matching the existing "every D-8 class" skill fixture already used by sibling scenarios.the invocation context is globally unsafe, i.e._unsafe_mode: true) — the agent's ownsafe_moderemainstrue.safe_modestilltrue,context._unsafe_mode: truealone already satisfies the buggy OR composition, so the read currently succeeds instead of being refused — the scenario passes in CI only because the@tdd_expected_failtag inverts the result, per this project's TDD tag rules.AssertionErroronly — neverValueError,RuntimeError, or any other exception type — so the TDD CI hook inverts it correctly.Acceptance criteria
@tdd_issue,@tdd_issue_189,@tdd_expected_fail.AssertionErroronly.@tdd_expected_failremoved locally fails against currentdevelop, confirming the bug is genuinely reproduced (the gate opens with the agent's ownsafe_modestilltrue).nox -s unit_testsis green (CI passes via the@tdd_expected_failinversion).nox -s coverage_report).developvia its own PR before work begins on #189's fix.Supporting information
cleveractors.agents.tool.ToolAgent._is_global_unsafe, consumed by thegate_open = global_unsafe and not skill_safesites in the same module.a skills context with skill "pdf-processing" having resources of every D-8 classand thethe invocation context is globally unsafe/the skill "pdf-processing" declares safe_mode falsesteps already defined infeatures/steps/agent_skills_steps.py— reuse rather than duplicate.docs/adr/ADR-2034-skill-package-support.mdD-9 (corrected 2026-11-25);docs/index.md§4.4.8.Subtasks
features/agent_skills.feature, alongside the existing double-safety-gate coverage) that leaves theToolAgent's own"safe_mode"at its defaulttrue, sets the invocation context globally unsafe, loads asafe_mode: falseskill with a non-standard resource, and asserts the gated read/execute is refused.features/steps/agent_skills_steps.pyfile rather than creating a new one.@tdd_issue @tdd_issue_189 @tdd_expected_fail.@tdd_expected_failis removed locally (proving the bug), and passes CI with the tag in place.nox -s coverage_report.nox(all default sessions), fix any errors.Definition of Done
This issue is complete when:
develop, reviewed, and merged.