Repository navigation
fix(ai): investigations finish inside their clock and close out inside the context limit - #2719
Merged
Merged
Maple Review Bot / Maple / review
succeeded
Nov 16, 2026 in 2m 34s
Confidence 10/10 · No issues found
🟢 Confidence 10/10 · safe to merge. No test covers a first attempt that fails with a typed error past the cap; every other path the change adds is pinned.
1 note · tests covered · risk medium
Past its attempt cap the first model call is no longer cut: the low-effort retry races it and the first answer wins, while investigation passes move to 15 minutes and the close-out runs on its own 5-minute clock with 120k characters of evidence. Safe to merge; the one earlier note on PhaseTurn.agent still stands.
retriedPastCapkeeps the first attempt streaming and races the retry beside it- A first attempt answering with
finish.reason: errorpast the cap waits for the retry INVESTIGATION_BUDGETmoves to 15 minutes;CLOSE_OUT_MAX_DURATIONcaps the close-out at 5CLOSE_OUT_EVIDENCE_CHARSdrops to 120k, leaving the round after submission room
Still open from earlier reviews
- 🔵 Note · F1 ·
PhaseTurn.agentdoc no longer matches its close-out use ·apps/ai/src/chat/autonomous-phases.ts:141
What was checked
budgets.test.tsnow bounds pass pluscloseOutAgentclock plus margin underTURN_STALE_MS, whichChatSession.ts:357only trips past- Both forked attempts are interrupted by
Effect.ensuringfinalizers, so no fiber outlives the call - The race and the close-out clock are asserted as behavior (
model-call-span.test.ts:840,autonomous-phases.test.ts:61)
a7978bb · Reply "won't fix" to dismiss a finding, or mention @maple-review-bot to ask about one.
Loading