Code review findings:
- factory._wrap_exec_command: add post-compression backstop that calls
truncate_exec_result when compress_exec_result returns an oversized
result (happens when _split produces 1 chunk, e.g. a single very
large JSON record — compress_large_output correctly returns it
unchanged, but the result was never guarded against threshold after).
- tests/agents/test_factory_helpers.py (new): unit tests for
_resolve_model (run_config vs settings fallback, None/whitespace
error cases, non-string Model object guard) and _extract_task_hint
(valid cmd, missing cmd, non-string cmd, invalid JSON, non-dict JSON).
Replaces plain truncation with a parallel summarisation pipeline when
exec_command output exceeds STRIX_MAX_TOOL_OUTPUT_CHARS (default 65536).
Output is split at JSON record or line boundaries; each chunk is
summarised via litellm.acompletion; summaries are consolidated into a
single result that fits the context window.
Falls back to truncate_exec_result on any compression error.
Closes#579
exec_command output is now capped at STRIX_MAX_TOOL_OUTPUT_CHARS (default
65536). JSON arrays are parsed and trimmed to the first 50 records (valid
JSON preserved); plain text keeps the first 300 lines. Both include a
header showing the total size and record/line count so the agent retains
full awareness of what was produced.
A secondary character cap prevents single very long lines from bypassing
the line limit. Set STRIX_MAX_TOOL_OUTPUT_CHARS=0 to disable.
ContextWindowExceededError carries status_code=400, which matched the
_INPUT_REJECTION_CODES guard and triggered image-strip retry logic.
Image stripping cannot reduce token count, so the agent wasted up to
3 retry cycles before parking as failed.
Add an explicit isinstance check before the status-code guard to detect
context-window overflow and park the agent as 'failed' immediately.