[BUG] Running strix on a large repo crashed with a ContextWindowExceededError
Describe the bug
Running strix a large repo crashed with a ContextWindowExceededError (1,023,797 tokens > 1,000,000 max). The agent ran semgrep on the mounted repo and received back more than a million lines of JSON as a tool result. That blob was stored verbatim in the SQLite session by the Agents SDK, then serialized into the next API request — blowing the context window.
Two compounding problems made this worse than it needed to be:
- Wrong recovery path:
ContextWindowExceededErrorhasstatus_code=400, which matched_INPUT_REJECTION_CODESin_run_cycle. The image-stripping recovery path was tried (and failed, since there are no images to strip), burning retries before falling through to the correct "failed" handling. - Silent TUI failure: The exception was caught by
except Exception as einscan_targetand stored inself._scan_error— the TUI kept running silently with no in-app indication. The traceback only appeared after the user exited.
To Reproduce Steps to reproduce the behavior:
- run strix on a large mono repo with more than a million lines of code
Expected behavior Strix should not just crash silently in TUI mode and should try to remedy the context window size problem by processing the result in chunks across multiple agents.
System Information:
- OS: MacOS Tahoe 26.5.1
- Strix Version or Commit: 11e5d1c2b3dde00740e26c6ef2bc336cb6912a2e
- Python Version: 3.12.13
- LLM Used: Claude Sonnet 4.6
I have a fix for this. Should I submit it as three self-contained, stacked PRs or as a single PR?
Thanks @mhspektr! Looking into this issue now. Would be great if you open it as a single PR
@0xallam The new PR is a continuation of the https://github.com/usestrix/strix/pull/577 PR, so only these commits are "new":
- c91e4ca - fix: bypass image-strip recovery for ContextWindowExceededError
- 4bc1430 - fix: show scan error as TUI toast before exit
- 2f1bb90 - fix: remove timeout=0 from scan error toast — was causing instant dismissal
- 5aa61c5 - feat: truncate oversized exec_command output to prevent context overflow
- eac81f8 - feat(core): MapReduce LLM compression for large exec_command outputs
- 0640e5c - fix(core): backstop single-chunk overflow; add helper tests
@0xallam hi. can you accept the current proposed PR?
Should be fixed now in https://github.com/usestrix/strix/pull/882