Skip to content

debug logger: render bash non-zero exits as compact exit-code lines - #51

Open
hello-pollux wants to merge 2 commits into
frolic:mainfrom
hello-pollux:pollux/bash-exit-debug-log
Open

hello-pollux wants to merge 2 commits into
frolic:mainfrom
hello-pollux:pollux/bash-exit-debug-log

Conversation

@hello-pollux

Copy link
Copy Markdown
Contributor

Problem

In the debug channel, every bash command that exits non-zero (grep no-match, diff on differing files, gh pr checks while pending) is rendered as a full ❌ bash failed: <error text> line. For an agent that often runs diagnostic commands where non-zero is the expected result, this floods the log with false alarms.

Solution

New renderToolFailure.ts classifies failed tool results:

  • If the error text matches pi's Command exited with code N suffix, render a compact line: -# bash → exit 1 · <bounded preview of output>.
  • Genuine errors (exceptions, tracebacks, invalid args) keep the existing ❌ <tool> failed: … shape.

Removes extractToolErrorText.ts (logic folded into the new module). The agent's own turn view of the errored result is unchanged — this only affects debug-channel rendering.

Tests

  • New renderToolFailure.test.ts: exit-code extraction, multi-line preview collapsing, output preview capping, genuine-error fallback, compact vs ❌ line formatting.
  • bun run typecheck clean; bun test 109 pass.

Sign up for free to 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