feat(progress): add timeout protection and strip withGadgets from callProgressModel#506
Merged
zbigniewsobiecki merged 1 commit intodevfrom Feb 23, 2026
Merged
Conversation
Collaborator
Author
|
🤔 Just a sec, looking into that timeout protection |
nhopeatall
approved these changes
Feb 23, 2026
Collaborator
nhopeatall
left a comment
There was a problem hiding this comment.
Summary
LGTM — clean implementation of timeout protection for callProgressModel, with proper cleanup and a sensible extraction of the inner LLM call.
Notes
The timeout implementation is actually an improvement over the existing ackMessageGenerator.ts pattern — it correctly clears the timer in a finally block and suppresses the unhandled rejection on the timeout promise (the ack generator does neither). Nice.
Minor observations (non-blocking)
- tests/unit/backends/progressModel.test.ts:38-41 —
getMockRun()helper is defined but never called in any test. Dead code that can be removed. - tests/unit/backends/progressModel.test.ts:140-177 — The timeout test doesn't exercise the actual
setTimeouttimeout path. It makes the LLM async generator throw the same error message by manually callingrejectFn. This is effectively a second "LLM throws" test. Usingvi.useFakeTimers()+vi.advanceTimersByTime(10_000)would properly verify the real timeout branch wins the race. The comments acknowledge this limitation — just noting it could be strengthened if desired.
| function getMockRun(): ReturnType<typeof vi.fn> { | ||
| const instance = MockAgentBuilder.mock.results[MockAgentBuilder.mock.results.length - 1]?.value; | ||
| return instance?.ask.mock.results[0]?.value?.run; | ||
| } |
Collaborator
There was a problem hiding this comment.
Nitpick: getMockRun is defined but never called — leftover from an earlier draft? Safe to remove.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PROGRESS_TIMEOUT_MS = 10_000constant and wrapcallProgressModelin aPromise.racewith a 10s timeout — matching the pattern used bygenerateAckMessageinackMessageGenerator.ts.withGadgets()from theAgentBuilderchain incallProgressModelOnce(empty gadgets still initialises the subsystem with no benefit for a one-shot call)callProgressModelOnceso the timeout wrapper stays cleancallProgressModelcovering: success, multi-event concatenation, non-text event filtering, empty-output error, no-events error, timeout, and LLM throwTest plan
tests/unit/backends/progressModel.test.ts— 9 new unit tests forcallProgressModel(all pass)tests/unit/backends/progress.test.ts— 43 existingProgressMonitortests pass unchanged (mock signature unchanged)Card
https://trello.com/c/7TYShDQg/91-lets-change-how-progress-is-monitored-from-an-agentic-loop-into-one-shot-llm-call-like-we-do-acknowledgements-in-the-router-that
🤖 Generated with Claude Code