[WRONG BRANCH] fix(kiro): bound non-streaming event collection - #235
[WRONG BRANCH] fix(kiro): bound non-streaming event collection#235luvs01 wants to merge 1 commit into
Conversation
|
✅ Deterministic PR hygiene checks passed. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughKiro non-streaming response parsing now accounts for retained translated events against the translator budget and releases all retained events when parsing fails. Tests cover budget rejection and cleanup. ChangesKiro translator-budget retention
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
⏳ DRAFT
What to do
Its title has been prefixed with |
Motivation
parseResponsepath that drained the AWS eventstream into an in-memoryAdapterEvent[]with no aggregate byte/event/time bound, creating a resource-exhaustion risk for large or malicious provider streams.parseResponse, so an unbounded Kiro stream could grow process memory before the request finishes.Description
retainTranslatedEvent(event, budget, first)tosrc/lib/translator-budget.tsto charge retained adapter events incrementally against the shared per-turnTranslatorBudget(first event charged with array brackets sizing, subsequent events charged with comma delimiter sizing).src/adapters/kiro.ts::parseResponseto callretainTranslatedEventfor each yieldedAdapterEventas it's collected and to callreleaseTranslatedEventfor all retained events if parsing aborts or throws, preventing leaks on error paths.tests/kiro-stream.test.tsthat exercises bounded non-streaming collection and expects atranslation_buffer_limiterror when the translator budget is exceeded.Testing
bun test tests/kiro-stream.test.ts, which passed the modified tests (targeted Kiro tests passed locally).bun run typecheckandbun run privacy:scan, both of which completed successfully.bun run testrun encountered an unrelated timeout in an outbound-proxy test (not related to these changes).Codex Task
Summary by CodeRabbit
Bug Fixes
Tests