TDD: file_read tool crashes with a raw ValueError instead of a descriptive ExecutionError when the path contains an embedded NUL byte #182
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
Reference
cleveragents/cleveractors-core#182
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 file_read raw ValueError crash on NUL-byte path bug (#180)Branch: tdd/m1-file-read-nul-byte-path
Background and context
Companion TDD issue for bug #180 (
ToolAgent._file_read_toollets afileargument containing an embedded NUL byte reach the unguardedos.path.realpath()call used by itssafe_modesymlink-escape check, 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 #180 for the full root-cause analysis and the directly-confirmed reproduction.Current behavior
No automated test exists that proves
ToolAgent._file_read_toollets afileargument containing an embedded NUL byte (\x00) through its validation unrejected, and that it then crashes with a rawValueError("embedded null character in path") that escapes bothToolAgent.invoke()and (unwrapped in message quality, if not in type)ToolAgent.process_message(), instead of a clear, earlyExecutionError.Expected behavior
A Behave scenario demonstrates the bug: calling the
file_readtool with afileargument containing an embedded NUL byte, viaToolAgent.invoke(), results in an uncaughtValueErrorpropagating out of the call instead of the tool raising a descriptiveExecutionErrorbefore any filesystem call occurs. 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 (#180) lands.Acceptance criteria
@tdd_issue @tdd_issue_180 @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-bytefileargument 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/; thefile_readcall uses a realToolAgentinstance and a real (but isolated, temp-directory-rooted) filesystem — no real network/LLM calls.Supporting information
ValueError: lstat: embedded null character in path).Subtasks
@tdd_issue @tdd_issue_180 @tdd_expected_fail.ToolAgent.invoke("file_read", {"file": ...})directly with afilevalue containing an embedded NUL byte, in an isolated temp directory so no real production files are touched.ExecutionErrorrather than aValueError(i.e. that validation — not the raw OS/stdlib 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:
CoreRasurae referenced this issue2026-11-30 12:18:16 +00:00
The commit was merged but the commits message got overwritten due to wrong Forgejo merge option click
It was PR #200