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) #189
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
#160 Epic: Agent Skills — Full Resource Support and Safe Execution
cleveragents/cleveractors-core
#190 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)
cleveragents/cleveractors-core
#193 fix(agents): require both host unsafe mode and the agent's own safe_mode:false to open the skill gate's global safety
cleveragents/cleveractors-core
Reference
cleveragents/cleveractors-core#189
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:
fix(agents): require both host unsafe mode and the agent's own safe_mode:false to open the skill gate's global safetyBranch:
bugfix/m1-skill-gate-global-safety-andNote (amended 2026-11-25): This repository's PRs are submitted against
develop, notmaster. The reference tomasterbelow describing the PR target is corrected todevelopaccordingly; nothing else about the acceptance criteria changes.Background and context
ADR-2034 D-9 defines the skill double-safety gate as two independent switches that must both be false before a privileged skill operation (script execution, or reading/listing/executing a non-standard-folder resource) is permitted: "global safety" and "skill safety". The ADR's 2026-11-25 revision corrects the "global safety" half, which was originally specified (and implemented) as an OR of host/actor unsafe mode and the parent
type: llmagent's ownsafe_modeconfiguration field. Composed with OR, either switch alone opens that half of the gate — exactly the two failure modes D-9's own "Trust model" paragraph and Alternatives A-7/A-8 say the gate exists to prevent: an agent author's ownsafe_mode: falseopening the gate while the host/actor remains safely configured, and a host/actor placed in unsafe mode for an unrelated reason silently authorizing every skill loaded on every agent running on it. The corrected text requires both conditions to hold at once, matching the AND composition already used elsewhere in the standard for an equivalent decision (§13's shell execution:allow_shell: trueand host unsafe mode, never either alone).ToolAgent._is_global_unsafe(src/cleveractors/agents/tool.py) implements the original, now-corrected OR composition.Current behavior
gate_open = global_unsafe and not skill_safe(both call sites,src/cleveractors/agents/tool.pyaround lines 1357 and 1444) therefore opens the gate whenever eitherself.safe_mode is Falseor the invocation context carries_unsafe_mode: true, as long as the skill declaressafe_mode: false. Atype: llmagent that never sets its ownsafe_mode: falsestill has every loaded skill's privileged resources become executable/readable the moment anything propagates_unsafe_mode: trueinto its invocation context — and conversely, an agent author can setsafe_mode: falseon their own agent config and unlock everysafe_mode: falseskill's privileged resources even while the host/actor stays in its default safe mode.This is also encoded as currently-passing test expectations:
features/agent_skills.feature("Activation lists non-standard resources only when the double-safety gate is open", "A missing resource listing includes non-standard paths when the gate is open", "A non-standard read succeeds when both safety switches are false", and roughly a dozen sibling scenarios) set onlythe invocation context is globally unsafe(which injects_unsafe_mode: trueinto the tool-call context) together withthe skill "pdf-processing" declares safe_mode false, without configuring theToolAgent's own"safe_mode": false— and assert the gate is open / the operation succeeds.Expected behavior
_is_global_unsafereturnsTrueonly when both hold:self.safe_mode is Falseand the invocation context carries_unsafe_mode: true. Either alone must leave the global half of the gate closed, sogate_open(and every execution/read/listing path gated by it) staysFalseunless the skill and both independent global conditions are satisfied.Acceptance criteria
_is_global_unsafereturnsFalsewhenself.safe_mode is Trueand the invocation context carries_unsafe_mode: true(host unsafe alone is insufficient)._is_global_unsafereturnsFalsewhenself.safe_mode is Falseand the invocation context does not carry_unsafe_mode: true(agent config alone is insufficient)._is_global_unsafereturnsTrueonly whenself.safe_mode is Falseand the invocation context carries_unsafe_mode: true.gate_open(src/cleveractors/agents/tool.py: skill-tool activation/read/execute, non-standard-resource listing) reflects the corrected composition — no separate OR path remains anywhere in the gate's evaluation.not skill_safe) or to any check unrelated to this gate (e.g.allow_shell, the safe-mode shell blocklist).Supporting information
docs/adr/ADR-2034-skill-package-support.mdD-9 (corrected 2026-11-25), A-14.docs/index.md§4.4.8 "The double-safety gate".docs/tools/safe-mode.md"Bundled skill script execution".ToolAgent._is_global_unsafe(src/cleveractors/agents/tool.py, ~line 1622), consumed at the twogate_open = global_unsafe and not skill_safesites (~lines 1357, 1444)."safe_mode": falsewherever gate-open is expected:features/agent_skills.feature— "Activation lists non-standard resources only when the double-safety gate is open" (~line 574), "A missing resource listing includes non-standard paths when the gate is open" (~line 655), "A non-standard read succeeds when both safety switches are false" (~line 735), and the remaining sibling scenarios that use thethe invocation context is globally unsafestep together withthe skill "pdf-processing" declares safe_mode falsewithout also setting"safe_mode": falseon theToolAgentconfig.Subtasks
_is_global_unsafe(src/cleveractors/agents/tool.py) from(not self.safe_mode) or bool(context._unsafe_mode)to(not self.safe_mode) and bool(context._unsafe_mode).gate_open = global_unsafe and not skill_safecall sites and any other D-9 gate evaluation insrc/cleveractors/agents/tool.pyfor the same composition, correcting any found.features/agent_skills.featurescenario that currently expects the gate open viathe invocation context is globally unsafealone (without the agent's own"safe_mode": false) to also configure"safe_mode": falseon theToolAgent, so each continues to exercise a genuinely-open gate under the corrected composition.safe_mode: falsealone), in addition to the existing both-closed/both-open coverage.robot/integration coverage for skill script execution if it exercises this gate end-to-end with real process execution.nox -s coverage_report.nox(all default sessions), fix any errors.Definition of Done
This issue is complete when:
develop, reviewed, and merged.Type/TestingTDD issue exists, its scenario (tagged@tdd_expected_fail) is merged first, and this issue's Forgejo dependency correctly shows it depends on that TDD issue.