feat(skills): execute skill scripts behind the double-safety gate #168
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
#163 feat(skills): execute skill scripts behind the double-safety gate
cleveragents/cleveractors-core
Reference
cleveragents/cleveractors-core!168
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/m1-skill-script-execution"
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
Implements ADR-2034 D-10: bundled skill scripts can now be executed through the synthesized
skilltool, behind the D-9 double-safety gate.execute,args, andtimeoutto the synthesizedskilltool schema.execute: truerequiresresource; onlyscripts/and non-standard entries may run.references/,assets/, and root-level files are never executable.false, the skill'ssafe_mode: false, and the agent's existingallow_shell: true; the skill gate never bypasses the command-execution capability.[SKILL_SCRIPT_EXECUTED]envelope; denial, missing interpreter, non-zero exit, and timeout raise actionableExecutionErrors. Script output joins the tool-call loop and remains subject to ADR-2031 budget/pruning.Tests
features/agent_skills.feature; internal selector/materializer/executor scenarios infeatures/skill_script_execution.feature.references//assets/reads inrobot/agent_skills.robot.nox -s unit_tests: 157 features, 3248 scenarios passed.nox -s coverage_report: COVERAGE OK 97.2% (threshold 96.5%).nox -s integration_tests: 380 tests passed.nox -s lint,nox -s format -- --check,nox -s typecheck,nox -s security_scan,nox -s dead_code,nox -s complexity,nox -s docs,nox -s build, andnox -s benchmarkall pass.Docs
Updated
docs/guides/skill-packages.md,docs/tools/built-in-tools.md,docs/tools/safe-mode.md, andCHANGELOG.md.Closes #163
PR Review: !168 (Ticket #163)
Verdict: Request Changes
The implementation itself is faithful to ADR-2034 D-10 and the ticket: the D-9 double-safety gate is correctly composed and fails closed,
allow_shellis never bypassed, the workspace is verifiably contained and cleaned up on every path, and the read-path refactor into_SkillToolRequest/_read_skill_resourceis behavior-preserving (verified line-by-line against the base commit, plus runtime probes of containment, interpreter selection, and end-to-end execution). However, the requiredintegration_testsCI job fails on the PR head commit, contradicting the PR description's claim thatnox -s integration_testspasses (380 tests). The merge gate (status-check) was cancelled as a result, so the PR cannot merge until this is resolved.Per reviewer instructions, the following were excluded from this review: red-tape items (commit footer/label conventions — verified anyway: commit message matches the issue Metadata exactly, single atomic commit, rebase-clean, branch matches Metadata), and the
benchmarkCI failure, which is pre-existing ondevelop(run 540, commit1aa02bd4) and is a non-required job instatus-check. No prior review comments or author responses exist on this PR or ticket, so no items were dropped as out-of-scope/deferred.Critical Issues
None.
Major Issues
integration_testsfails on the PR head — merge blocked (CI run 541, jobintegration_tests#394333, commita1ead0b).integration_testsjob failed after ~19m (vs. the ~3–4.5m baseline of successful runs;developpasses the same job on run 540). Thestatus-checkgate job was consequently cancelled, so the PR is not mergeable. This contradicts the PR description's "nox -s integration_tests: 380 tests passed". The failure duration pattern suggests a hang/retry loop rather than a clean assertion failure; the new Robot scenarioBundled Script Executes End To End Behind The Double Safety Gate(robot/agent_skills.robot:116) is the most likely new code involved, though run 539 shows the suite has a pre-existing flaky mode (failed once at 235s, passed on rerun).nox -s integration_testsin a CI-like environment, fetch theci-logs-integration-testsartifact, and fix the root cause — or, if it is the pre-existing flakiness, re-run the job until green and note that in the PR. Do not merge with a red required check.Minor Issues
Skill script timed out after N seconds...omits the skill name and resource path, while every other execution error (denial, missing interpreter, non-zero exit) names them, theshelltool's equivalent message names the command, and the ticket requires "an actionable message naming the states and path".Skill '<skill>' script '<resource>' timed out after N seconds.... Note the Behave assertion only checks "timed out" and the duration, so this can be strengthened without breaking tests.Nits
envassignments in shebangs are silently dropped — src/cleveractors/agents/skill_execution.py:145-165.#!/usr/bin/env -S MODE=test python3 -uresolves topython3 -ubutMODE=testis never applied to the subprocess environment (verified by probe). Either apply the assignment to the child env or document the limitation in the selector docstring.[argv[0], *argv[2:]] if len(argv) > 1 else list(argv)—argvalways contains the interpreter and script path, so theelsebranch is dead; an assertion would state the invariant.content.splitlines()is evaluated twice; bind it once.Summary
A high-quality, well-tested implementation of ADR-2034 D-10. Spec compliance is exact: execute/args/timeout schema additions, scripts/non-standard-only executability, the D-9 gate checked before any I/O with both states named in errors,
allow_shellcomposition, full-tree materialization into a fresh 0700 workspace under the sandbox root with skill-root cwd, extension/shebang interpreter selection with actionable missing-interpreter errors, shell timeout-policy reuse,create_subprocess_exec(no shell injection surface), workspace cleanup on every path (verified: success, non-zero exit, timeout, selection failure, and tampered-catalogue rejection of../absolute escapes), and the[SKILL_SCRIPT_EXECUTED]envelope feeding ADR-2031 budget/pruning. Tests cover the gate matrix, all execution outcomes, cleanup assertions, and a real end-to-end Robot scenario; docs, ADR, and CHANGELOG are consistent; commit hygiene is correct. The single blocker is the red requiredintegration_testsCI job on the head commit, which must be reproduced/fixed or shown flaky and re-run to green before merge.Review complete — see the full report in the review body. Verdict: Request Changes. One major blocker: the required CI integration_tests job fails on the head commit (run 541), so the PR cannot merge until it is reproduced/fixed or shown flaky and re-run to green.
a1ead0b0e68bb4c7c830Review body (submitted separately).
PR Review: !168 (Ticket #163)
Verdict: Approve
Re-review of head
8bb4c7c8(single atomic commit, clean fast-forward on top ofdevelop, no merge commits). The one major blocker from the previous review (required CIintegration_testsjob failing on run 541) is resolved: run 542 passesintegration_testsplus every other required job (lint, typecheck, security, quality, unit_tests, coverage, build, status-check). Coverage passed at 97.2% (repo threshold 96.5%, project standard ≥ 97%). No unresolved discussion threads exist and nothing was declared out-of-scope or deferred, so no prior items were carried forward or struck.All ADR-2034 D-10 execute-behaviour requirements and every ticket #163 acceptance criterion are implemented and covered by passing scenarios:
execute: truewithoutresourcefails before any lookup; non-booleanexecuteand non-stringargsare rejected.scripts/and non-standard entries are executable;references/,assets/, and root files are refused (Scenario Outline covers all three).allow_shell: falserefusal confirms the skill gate never bypasses the command-execution capability.args, relativereferences/andassets/reads resolve from the materialized skill root;.shextension and non-standard shebang paths covered; non-zero exit, missing interpreter, and timeout each raise actionableExecutionErrorwith workspace cleanup asserted (no skill script workspaces should remain).envhandling), materializer containment (../base64/encoding/missing-root failures), and executor request validation all have focused Behave scenarios; the Robot scenario proves the end-to-end path against a real on-disk skill package.Security posture is sound: spawning uses
create_subprocess_exec(no shell, soargsare never shell-interpreted), workspace writes go throughSandboxRootPolicy(repels../~and containment escapes), base64 is validated, malformed catalogues fail closed, the success envelope never leaks the workspace path, and the shared safe-mode blocklist/timeout-ceiling behaviour of theshelltool is preserved by the refactor to_enforce_safe_mode_blocklist. Docs (skill-packages.md,built-in-tools.md,safe-mode.md) and the CHANGELOG entry accurately describe the implemented behaviour.Critical Issues
None.
Major Issues
None. (The previous major blocker — failing required
integration_testson run 541 — now passes on run 542 for head8bb4c7c8.)Minor Issues
None.
Nits
src/cleveractors/agents/tool.py(_run_skill_script_command, ~line 1463): the safe-mode blocklist check dropsargv[1](the workspace script path) to avoid false positives from the randommkdtempsuffix. Deliberate and documented in code anddocs/tools/safe-mode.md; the residual gap (a skill-bundled file whose name contains a blocklisted substring escapes the substring filter) is skill-author-controlled rather than model-controlled and already requires the double gate, so no action needed — noted for the record.src/cleveractors/agents/tool.py(_run_skill_script_command, timeout path ~line 1483): on timeout only the direct child is killed (process.kill()), not the process group, so grandchildren spawned by a script may outlive the deadline. This is strictly better than theshelltool (which kills nothing on timeout) and not a regression — consider astart_new_session=True+ group kill in a future hardening pass for both paths.features/agent_skills.feature: no skill-tool-specific scenario for a per-invocationtimeoutexceeding theshell_max_timeout/tools_max_timeoutceiling, nor a success-path execution with an explicittimeoutoverride. The sharedTimeoutPolicymechanism is already tested via theshelltool, so this is optional coverage polish.CI / benchmarkjob is red on run 542, but it is also red ondevelopitself (run 540) and on PR !167 (runs 538/539) — pre-existing and excluded fromstatus-check's required jobs, so it does not gate this merge. Suggest tracking the ASV baseline regression separately.Summary
A well-scoped, atomic implementation of ADR-2034 D-10. The design keeps a single controlled execution path (timeout policy, blocklist, and spawning stay in
ToolAgent) while delegating interpreter selection, workspace materialization, and orchestration to a new, cleanly separatedskill_executionmodule with dependency injection that keeps the code independently testable. The gate matrix, failure paths, and cleanup guarantees are thoroughly tested at both the unit (Behave) and integration (Robot) levels, and documentation and changelog were updated in the same commit. The previous CI blocker is fixed and all required checks are green on the current head. Approving; the nits above are optional follow-ups and none block the merge.8bb4c7c83083d62347fd83d62347fd7532768dd8