Skip to content

emrg: add missing error=True flags in tool error returns and add edit_tool tests - #9

Merged
argszero merged 1 commit into
masterfrom
fix/missing-error-flags-in-tools
Jul 18, 2026
Merged

emrg: add missing error=True flags in tool error returns and add edit_tool tests#9
argszero merged 1 commit into
masterfrom
fix/missing-error-flags-in-tools

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Fix 5 instances across 4 tools where error returns lacked error=True, and add 8 new tests for the previously-untested edit_tool.

Changes

Bug Fix: Missing error=True in error returns

ToolLocationFix
read_tool.pyline 82Error: no file_path provided -> + error=True
edit_tool.pyline 69Error: no file_path provided -> + error=True
edit_tool.pyline 71Error: old_string is empty -> + error=True
write_tool.pyline 49Error: no file_path provided -> + error=True
bash_tool.pyline 58Error: no command provided -> + error=True

Previously these returned error=False (the default), making error-checking code unable to distinguish user-facing errors from successful responses. All other error paths in these tools already correctly set error=True.

New Tests: test_edit_tool.py

8 tests covering all major code paths:

  • Basic replacement
  • replace_all=true
  • old_string not found
  • Multiple occurrences without replace_all
  • Non-existent file
  • Directory target
  • Empty old_string
  • Missing file_path

Verification

  • uv run pytest tests/ -v -> 58 passed (8 new, 50 existing)
  • uv run python -c "from emrg.client.app import run_client" -> OK
  • uv run python -m emrg --help -> OK

…_tool tests
Four tools (read, edit, write, bash) had early-return error paths that
returned ToolResult with error=False (the default), making error-checking
code unable to distinguish user-facing errors from successful responses.
Fixed: read_tool, edit_tool (x2), write_tool, and bash_tool now correctly
set error=True on all error returns.
Also adds test_edit_tool.py with 8 tests covering basic replacement,
replace_all, not-found, multiple-without-flag, directory, and edge cases.

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle #9

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle #10

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle #11

@argszero
argszero merged commit 1da6ae0 into masterJul 18, 2026
@argszero
argszero deleted the fix/missing-error-flags-in-tools branch July 18, 2026 03:25
argszero added a commit that referenced this pull request Jul 18, 2026
…tests (#25)
Co-authored-by: argszero <argszero@users.noreply.github.com>
argszero added a commit that referenced this pull request Jul 21, 2026
…ed compact (rants #7,#8,#9)
Merge after 3 consecutive ✅ from evolution cycles #6000, #7000, #8000.
argszero added a commit that referenced this pull request Jul 22, 2026
… (rant #9) (#131)
- Add last_payload and last_response_headers tracking to LlmClient
- Log request payload and response headers in compact and chat paths
- All 389 tests pass
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@argszero