fix: address Copilot review feedback from PRs #2 and #3#13
Merged
Conversation
PR #3 (suppressed comment): errorText only walked `cause` for Error instances; plain-object wrappers fell through to JSON.stringify, which serializes a nested Error to {} and drops retryable text. Walk `cause` explicitly for records too, with the same depth cap. PR #2 (inline comment): the prune test only proved an expired cooldown made the model selectable again — pruning itself was unobservable. Expose active cooldowns as `cooling` in model_fallback_control status and assert the expired entries are gone. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Follow-up on the two actionable Copilot review comments left on earlier PRs (the rest of the PRs got no review — Copilot quota ran out from #4 onward).
PR #3 — suppressed low-confidence comment (valid bug)
errorTextonly walked thecausechain when the value was anErrorinstance. Plain-object wrappers fell through toJSON.stringify, andJSON.stringify(new Error("x"))yields"{}"— so retryable text buried in{ message: "request failed", cause: new Error("model is overloaded") }was silently dropped and the pattern path never matched. Now records with acauseare walked explicitly with the sameMAX_CAUSE_DEPTHcap (cycle-safe).PR #2 — inline comment on the prune test
The test claimed pruning coverage but only asserted that an expired cooldown made the model selectable again (already true via the
nextModeltime check, even without pruning). Pruning is now observable:model_fallback_control statusreportscooling(model → cooldown-expiry timestamp), and the test asserts expired entries are actually removed while the fresh one remains.Testing
bun run typecheck— cleanbun test test/index.test.ts— 61 pass (2 new: plain-object cause text; circular plain-object cause chain)bun test test/e2e-server.test.ts— 4 pass🤖 Generated with Claude Code