singularity-forge/packages/pi-agent-core
frizynn cd14a4c765 fix(agent-loop): schema overload cap ignores bash execution errors (#3618)
The schema overload detector counted ALL isError tool results toward the
consecutive-failure cap, including bash commands that returned non-zero exit
codes (e.g. rg/grep exit 1 = 'no matches'). Three consecutive exploratory
searches with no matches would trigger the cap and abort the session.

Root cause: the allToolsFailed check used toolResults.every(r => r.isError)
which conflates preparation-phase errors (schema validation, tool-not-found,
tool-blocked) with execution-phase errors (the tool ran successfully but
returned a non-zero exit code).

Fix: track preparationErrorCount alongside tool results. Only preparation
errors (schema/validation failures) increment the consecutive failure
counter. Tool execution errors — like bash exit code 1 — are valid usage
and do not count toward the cap.

Also fixes pre-existing StopReason type mismatches in agent-loop tests
(end_turn → stop, tool_use → toolUse).
2026-04-06 11:35:41 -03:00
..
src fix(agent-loop): schema overload cap ignores bash execution errors (#3618) 2026-04-06 11:35:41 -03:00
package.json fix: add exports fields to pi-tui and pi-agent-core packages (#991) 2026-03-17 17:05:47 -06:00
tsconfig.json fix(footer): display active inference model during execution (#1982) 2026-03-22 17:06:49 -06:00