TDD: shell tool crashes with a raw ValueError instead of a descriptive ExecutionError when the command contains an embedded NUL byte #183
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 milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Depends on
#199 test(agents): capture shell tool raw ValueError crash on NUL-byte command bug (#181)
cleveragents/cleveractors-core
Reference
cleveragents/cleveractors-core#183
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): capture shell tool raw ValueError crash on NUL-byte command bug (#181)Branch: tdd/m1-shell-nul-byte-command
Background and context
Companion TDD issue for bug #181 (
ToolAgent._execute_shell_commandlets acommandstring containing an embedded NUL byte reach the unguardedasyncio.create_subprocess_shell()call, which raises a rawValueErrorinstead of the tool's ownExecutionError). Per the project's mandatory Bug Fix TDD Workflow, a failing test proving the bug exists must be written and merged to master BEFORE the fix is implemented. See #181 for the full root-cause analysis and the directly-confirmed reproduction.Current behavior
No automated test exists that proves
ToolAgent._execute_shell_command/_shell_toollets acommandargument containing an embedded NUL byte (\x00) through unrejected, and that it then crashes with a rawValueError("embedded null byte") that escapesToolAgent.invoke(), instead of a clear, earlyExecutionErrorraised before any subprocess is spawned.Expected behavior
A Behave scenario demonstrates the bug: calling the
shelltool (on an agent configured withallow_shell: true) with acommandargument containing an embedded NUL byte, viaToolAgent.invoke(), results in an uncaughtValueErrorpropagating out of the call instead of the tool raising a descriptiveExecutionErrorbeforeasyncio.create_subprocess_shellis reached. The assertion fails while the bug is present, and the scenario is tagged@tdd_expected_failso it passes CI via inversion until the real fix (#181) lands.Acceptance criteria
@tdd_issue @tdd_issue_181 @tdd_expected_failexists infeatures/(new or extended step file).assert/raise AssertionErroronly (per project TDD rules) — it must catch whateverToolAgent.invoke()actually raises for the NUL-bytecommandargument and assert that it is anExecutionError(the fixed behavior), not a rawValueError; while the bug is present, that assertion fails, which@tdd_expected_failinverts into a CI pass.invoke()raises a bareValueError, notExecutionError), which the suite reports as passing only because of the@tdd_expected_failinversion.nox -s unit_testsis green; coverage unaffected or improved.features/mocks/; theshellcall uses a realToolAgentinstance withallow_shell: true— no real network/LLM calls, and no reliance on the NUL byte actually reaching a real shell process (it must never get that far).Supporting information
ValueError: embedded null byte).Subtasks
@tdd_issue @tdd_issue_181 @tdd_expected_fail.ToolAgent.invoke("shell", {"command": ...})directly with acommandvalue containing an embedded NUL byte, on an agent withallow_shell: trueandsafe_modeat its default.ExecutionErrorrather than aValueError(i.e. that validation — not the OS-level subprocess call — is what rejects the input); this assertion fails on unfixed code because today's exception is a bareValueError.@tdd_expected_failinversion.nox -s unit_tests,nox -s lint, andnox -s typecheckon the new files, fix any errors.Definition of Done
This issue is complete when: