agent run_bash: persist oversized output to temp file

t-823·WorkTask·
·
·
Created8 hours ago·Updated8 hours ago·pipeline runs →

Dependencies

Description

Edit

Long run_bash output in omni-agent is truncated before actionable error lines, causing persistent agents to miss the important tail of build/log output.

Observed symptom:

  • agentd logs omni-coder --mode persistent --last ... shows tool_result output payload cut mid-stream for large commands like bild --loud ....
  • Agent then reports it cannot see full error details.

Goal:

  • Keep token usage bounded while making full command output recoverable.
  • Return enough metadata so the agent can follow up with tail, rg, or sed against a saved file.

Proposed behavior:

  • For run_bash (and run-as wrapper), when combined stdout/stderr exceeds threshold:
  • Write full output to a temp file under _/tmp/.
  • Return a concise output snippet plus explicit notice including file path and omitted-char count.
  • Include both head and tail snippets so terminal errors near the end remain visible.
  • Keep existing small-output behavior unchanged.

Acceptance:

  • A long-output command produces a tool result that references an on-disk file.
  • The notice is explicit enough that the model can immediately run tail -n or rg on that file.
  • typecheck.sh Omni/Agent.hs and bild --test Omni/Agent.hs pass.

Git Commits

ab9c64d0fix(agent): surface saved-output path at top of truncated bash output
Coder Agent8 hours ago1 files
16738f22fix(agent): persist oversized run_bash output to temp files
Coder Agent8 hours ago1 files

Timeline (6)

🔄[human]Open → InProgress8 hours ago
💬[human]8 hours ago

Implemented in commit 16738f22.

What changed

  • Omni/Agent/Tools.hs (run_bash):
  • Added oversized-output handling that writes full stdout/stderr to a temp file (omni-agent-run-bash-*.log).
  • Returned bounded inline output with:
  • explicit truncation notice
  • Full output saved to: <path> line
  • follow-up hint (tail / rg)
  • head + tail preview blocks
  • Updated tool description to mention temp-file behavior for large output.
  • Added test runBashTool persists oversized output to temp file.

Verification

  • lint Omni/Agent/Tools.hs
  • typecheck.sh Omni/Agent.hs
  • bild --test Omni/Agent.hs
  • Live probe via persistent omni-coder:
  • sent command producing 5000 lines
  • agent replied with Full output saved to: ...
  • verified file exists and has 5000 lines.

Rollout

  • Rebuilt Omni/Agentd.hs so bundled runtime resolves to updated agent store path.
  • Restarted all persistent agents (intent-coder, tax-prep-2025, skills-cli, sd-coder, cfg-coder, omni-coder, paracoder).
  • Confirmed wrapper now points at updated agent binary:
  • /nix/store/gg0nsavpndahrdqzvidb1wqs582jrlgx-agent/bin/agent
🔄[human]InProgress → Review8 hours ago
💬[human]8 hours ago

Follow-up commit ab9c64d0: moved truncation metadata + 'Full output saved to:' to the top of run_bash truncated output so short tool_result snippets still include the actionable file path.