GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — (5/9) Dream, /btw and memory extraction retry a busy provider by Obed0101 · Pull Request #132 · MendCode/MendCode Conversation
|
|
MendCode: @Obed0101's MendCode worked on this pull request on one of its devices; released 2026-11-10 19:25 UTC. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No findings · nothing in this change was confirmed as a problem
head 43a091792e83
Merge risk: 🟡 Medium · This changes failure timing and request repetition in a shared provider-completion path, including interactive and background consumers. Regressions would appear as delayed failures, unwanted retries, or cancellation problems; the implementation bounds attempts and prevents replay after text output.
Change: Bug fix · Review effort: 2/5, about 15 minutes
The change adds bounded, abort-aware retries for transient provider failures in shared tool-less completions, without retrying after text has streamed. No introduced defects were verified in this stack-local diff; risk is medium because the shared integration also affects other auxiliary callers. Review was read-only, so tests were inspected but not run; the supplied performance measurements show no increase beyond measured noise.
Readers: 4 code files no reader could read went to the review pass whole (the diff is small: one reader call costs more than the readers' share of this review's cap, so the review pass reads it).
Stacked on #131: only this pull request's own commits since #131's head 0201e4d.
A new async-generator wrapper retries a completion up to six times when the provider throws RetryableProviderError before emitting text. It uses the existing backoff schedule, honors longer provider retry-after delays, and stops waiting when cancelled. The daemon applies this wrapper in completeWithUsage, leaving provider routing, model guards, ordinary engine-turn retries, and response parsing unchanged.
Changes
| Layer / files | Summary |
|---|---|
Completion retry and integration packages/daemon/src/completion-retry.ts, packages/daemon/src/main.ts |
Adds cancellable retry handling and integrates it into the shared completion path used by Dream, memory extraction, /btw, and other auxiliary callers. |
Regression coverage packages/daemon/test/completion-retry.test.ts |
Adds six tests covering recovery, retry-after precedence, retry exhaustion, permanent failures, failure after streamed text, and cancellation. |
Release notes CHANGELOG.md |
Documents automatic recovery from busy or rate-limited providers for Dream, /btw, and memory extraction. |
Sequence diagram
sequenceDiagram
participant Caller as Auxiliary caller
participant Complete as completeWithUsage
participant Retry as retryingCompletion
participant Provider as Routed provider
Caller->>Complete: Request completion with AbortSignal
Complete->>Retry: Supply provider.stream attempt
loop Initial attempt and up to six retries
Retry->>Provider: stream(request)
alt Retryable failure before text, retries remain
Provider-->>Retry: RetryableProviderError
Retry->>Retry: Abort-aware backoff / retry-after wait
else Successful stream
Provider-->>Retry: Model events
Retry-->>Complete: Forward events
else Non-retryable failure, text already emitted, or cancelled
Retry-->>Complete: Propagate error
end
end
Complete-->>Caller: Text and usage, or error
| Check | Status | Explanation |
|---|---|---|
| Title | ✅ Passed | The title accurately describes the retry behavior added for Dream, /btw, and memory extraction. |
| Description | ✅ Passed | The description explains the transient-failure problem, the retry module, and reported verification. It distinguishes typechecking at this head from full-suite testing at the top of the stack; neither result was independently executed during this review. |
| Out of scope | The shared completeWithUsage integration also changes retries for permission review, native advisor calls, and setup completions (packages/daemon/src/main.ts:796, :835, :1041). This broader effect is not mentioned in the title or description. |
Performance (perf-attrib, base 0201e4d against head 43a0917)
perf-attrib: igual: nothing above the measured noise
base 0201e4d5b29977b5ce181530f2cf9c2be5631efd (0201e4d5) vs cand 43a091792e8326c6f060a3272eaf65bad31d5590 (43a09179, cached build), median of 2 faux-engine session(s) per side; flagged = beyond the noise measured on 18 base-vs-base runs (x1.5).
| metric | base | cand | diff |
|---|---|---|---|
| tui.after.fp_mb | 57.2 | 56.8 | -0.4 |
| tui.after.peak_mb | 73 | 73.4 | +0.4 |
| tui.ready.fp_mb | 54.7 | 54.9 | +0.2 |
| tui.ready.peak_mb | 73 | 73.4 | +0.4 |
| tui.rest.fp_mb | 56.8 | 56.4 | -0.4 |
| tui.rest.peak_mb | 73 | 73.4 | +0.4 |
| tui.after.rss_mb | 138.1 | 135.7 | -2.4 |
| tui.ready.rss_mb | 113.9 | 114.1 | +0.2 |
| tui.rest.rss_mb | 138.4 | 135.4 | -3 |
| tui.after.heap.extra_b | 6703971 | 7013780 | +309809 |
| tui.after.heap.objects | 240624 | 241489 | +865 |
| tui.after.heap.protected | 19 | 19 | 0 |
| tui.after.heap.size_b | 24350371 | 24737428 | +387057 |
| tui.ready.heap.extra_b | 2871847 | 2895010 | +23163 |
| tui.ready.heap.objects | 216406 | 216472 | +66 |
| tui.ready.heap.protected | 18 | 18 | 0 |
| tui.ready.heap.size_b | 19242551 | 19274430 | +31879 |
| tui.rest.heap.extra_b | 4628046 | 4617393 | -10653 |
| tui.rest.heap.objects | 237662 | 237640 | -22 |
| tui.rest.heap.protected | 18 | 18 | 0 |
| tui.rest.heap.size_b | 22022446 | 22012222 | -10224 |
| tui.rest.js_code_b | 5840000 | 5830816 | -9184 |
| tui.rest.js_live_b | 19237656 | 19238071 | +415 |
| tui.cpu_ms.after | 6020 | 6081 | +61 |
| tui.cpu_ms.ready | 358 | 358 | 0 |
| tui.cpu_ms.rest | 542 | 533 | -9 |
| binary.bytes | 72290528 | 72290528 | 0 |
| disk.bytes | 4111 | 4110 | -1 |
| disk.bytes_per_session | 2056 | 2055 | -1 |
JS object types that rose (count):
JS heap bytes by constructor that rose:
Modules loaded at start: 230 -> 230, 4630739 -> 4631287 bytes of chunks; chunk sizes only in cand: [1007138], only in base: [1006590] (chunk names are hashes: the list says which changed in size, not by what name)
Reference (skill, 2026-11-03, real model): footprint 64 ready / 66 after / peak 80 MB, 2.6 KB per session. This run (faux engine, whole process tree): 54.9 / 56.8 / peak 73.4 MB, 2055 B per session.
CHANGELOG.mdpackages/daemon/src/completion-retry.tspackages/daemon/src/main.tspackages/daemon/test/completion-retry.test.tsComment @mendcode review to review again · @mendcode pause / resume · reply to a finding with explain, fix or learn · settings in .mendcode/review.yaml
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.