fix(kb): scale kb-ingest timeout default with input size - #177
Conversation
The flat 600s default ETIMEDOUT on two independent agents' MEMORY.md files (analyst 476 chunks, adoption 323 chunks), both confirmed fixed by manually raising KB_INGEST_TIMEOUT_MS to 30 min. Since MEMORY.md only grows over an agent's lifetime, every long-lived agent eventually hits this wall at the flat default — several are already 400-550KB. Scale the default with total input byte size (1.5ms/byte) instead of picking one bigger flat number, floored at the existing 600s minimum and capped at 1h so a huge input still fails loud rather than hanging indefinitely. KB_INGEST_TIMEOUT_MS still wins outright when set. Closes task_1787849190389_13577787. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughKnowledge-base ingestion now sizes its default timeout from readable input bytes. The timeout remains bounded by a 60-second floor and one-hour cap. ChangesKnowledge-base ingest timeout
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to Knowledge-base ingestion timeouts now scale with readable input size while preserving bounded defaults and explicit overrides. The change is covered for its intended sizing and failure-handling behavior, with no current merge-blocking risk identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Summary
KB_INGEST_TIMEOUT_DEFAULT_MS) default iningestKnowledgeBaseETIMEDOUT on two independent agents' MEMORY.md files (analyst: 476 chunks/97k tokens; adoption: 323 chunks) — both confirmed fixed only by manually settingKB_INGEST_TIMEOUT_MS=1800000. Since MEMORY.md only grows over an agent's lifetime (several fleet agents are already 400-550KB), every long-lived agent eventually hits this wall.KB_INGEST_TIMEOUT_MSstill wins outright when explicitly set — this only changes what "default" resolves to.Closes task_1787849190389_13577787 (
cortextos bus list-tasks).Test plan
npx tsc --noEmitcleannpm run buildcleannpx vitest run tests/unit/bus/knowledge-base.test.ts— 14/14 pass (8 existing + 6 new: floor-unchanged-for-small-input, scales-up-for-large-input, capped-at-1h, env-override-still-wins, unreadable-path-skipped-not-fatal, multi-path-sizes-sum)npx vitest run— only pre-existing unrelated failures (dashboardnext/serverimport errors in this worktree, one known-flaky chokidar watcher test perCLAUDE.md's 2026-07-28 flaky-test note), none touching this file🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit