TDD: LLMAgent's ephemeral ToolAgent dispatch derives both D-9 global-safety conditions from one shared signal, bypassing the AND composition #194
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
Reference
cleveragents/cleveractors-core#194
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
Background and context
PR #193 (issue #189) corrected
ToolAgent._is_global_unsafeto require, at once, both (a) the invocation context carrying_unsafe_mode: trueand (b) theToolAgent's ownsafe_modefield beingfalse(ADR-2034 D-9,docs/index.md§4.4.8: "rather than treating the agent's own config field and host mode as interchangeable"). That fix is correct for a directly constructedToolAgent-- the only construction path the Behave suite exercises.However, the dominant real-world path for invoking a skill is a
type: llmagent's tool-call loop, which constructs an ephemeralToolAgentper call viaLLMAgent._build_ephemeral_tool_config/_build_tool_context(src/cleveractors/agents/llm.py). Both of those builders are fed from a single boolean,parent_unsafe, returned byLLMAgent._resolve_parent_unsafe:_build_ephemeral_tool_config(tool_name, parent_unsafe)sets the ephemeral agent's ownsafe_mode = not parent_unsafe, and_build_tool_context(parent_unsafe)sets the ephemeral context's_unsafe_mode = parent_unsafe-- the sameparent_unsafevalue feeds both. This pattern repeats at all three tool-dispatch call sites in_execute_tool_loop(agents/llm.py~lines 1221-1230, ~1376-1395, ~1544-1553).This was behavior-neutral before PR #193, when
_is_global_unsafewas itself an OR:OR(parent_unsafe, parent_unsafe) == parent_unsafe == OR(own_safe_mode, host_unsafe), so collapsing the two legs into one shared signal reproduced the intended OR exactly. After PR #193 changed_is_global_unsafeto AND, the same collapse now producesAND(parent_unsafe, parent_unsafe) == parent_unsafe == OR(own_safe_mode, host_unsafe)-- i.e. the ephemeral-ToolAgent path still evaluates to the pre-fix OR semantics, regardless of the corrected AND composition, because both of the AND's operands are forced identical before_is_global_unsafeever sees them.Raised and scoped out (correctly, as pre-existing and outside #189's atomic fix) in reviewer hurui200320's PR #193 reviews; tracked here as its own issue per that review's "Scope notes"/"Scope exclusions."
Current behavior
An LLM agent with
skills: [...]and its ownsafe_mode: false-- with no host ever placed in unsafe mode, and no actorcontext.global.unsafedeclaration in effect -- can still execute asafe_mode: falseskill's bundledscripts/resource or read its non-standard-folder resources through the real tool-call loop._resolve_parent_unsafereturnsTruefrom the agent's ownsafe_mode: falsealone, and that singleTrueis handed to both builders, so the ephemeralToolAgentends up withsafe_mode: falseand_unsafe_mode: truein its context simultaneously -- satisfying_is_global_unsafe's AND even though only one real authority (the agent author) ever opted in.Expected behavior
The ephemeral
ToolAgent's ownsafe_modemust be derived solely from thisLLMAgent's ownsafe_modeconfig field, and the ephemeral context's_unsafe_modemust be derived solely from whether the invocation context already carries a genuine host-propagated_unsafe_mode: true(§9.4/§10.3) -- the two conditions resolved independently, exactly asdocs/index.md§4.4.8 requires ("rather than treating the agent's own config field and host mode as interchangeable"). An LLM agent with only its ownsafe_mode: falseset, on a host never placed in unsafe mode, must have privileged skill operations refused -- matching the behavior a directToolAgentconstruction already exhibits post-#193.Acceptance criteria
type: llmagent withsafe_mode: falseand a loadedsafe_mode: falseskill, with no host-level unsafe signal anywhere in the invocation context, drives a model-issued tool call that attempts a privileged skill operation (script execution or non-standard-folder read), and asserts the call is refused.ToolAgentcurrently receives_unsafe_mode: truepurely from the agent's ownsafe_mode: false.@tdd_issue,@tdd_issue_195, and@tdd_expected_fail, with the failing step usingassert/raise AssertionErroronly.Supporting information
docs/index.md§4.4.8 ("The double-safety gate", "Global safety").docs/adr/ADR-2034-skill-package-support.md(D-9, corrected 2026-11-25).src/cleveractors/agents/llm.py(_resolve_parent_unsafe,_build_ephemeral_tool_config,_build_tool_context, and their three call sites in_execute_tool_loop).parent_unsafesignal, correct under the then-OR'd D-9; not revisited when D-9 was corrected to AND).Subtasks
features/llm_agent_tool_loop.feature(or the agent-skills feature covering LLM-agent-driven skill dispatch) proving the bug (#195): agent-onlysafe_mode: false, no host-level unsafe signal, privileged skill operation is wrongly permitted.@tdd_issue,@tdd_issue_195,@tdd_expected_fail.nox -s unit_teststo confirm the suite passes overall (the new scenario passes via@tdd_expected_failinversion).nox -s coverage_report.nox(all default sessions), fix any errors.Definition of Done
This issue is complete when: