fix(review): retain Model object to avoid registry re-lookup race#70
Closed
fix(review): retain Model object to avoid registry re-lookup race#70
Conversation
The orchestrator phase re-did ctx.modelRegistry.find() after resolveTierModel had already resolved the model. Custom providers that re-register their model list asynchronously (e.g. radicalai gateway refresh) could cause the second lookup to fail. Retain the Model<Api> reference from initial resolution instead.
There was a problem hiding this comment.
Pull request overview
This PR fixes a race in the review extension’s auto-review orchestrator phase by avoiding a second ctx.modelRegistry.find() lookup after the model has already been resolved. It also updates package-lock.json via npm audit fix to address transitive dependency vulnerabilities.
Changes:
- Retain the resolved
Model<Api>onResolvedTierModeland pass it directly tocreateAgentSession(no second registry lookup). - Remove the orchestrator-phase fallback path that warned/returned when the second registry lookup failed.
- Update transitive dependencies in
package-lock.json(e.g.,basic-ftp,fast-xml-parser,ip-address).
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/review/auto-review.ts | Stores the resolved Model reference and uses it directly in the orchestrator session to avoid registry re-lookup races. |
| package-lock.json | Transitive dependency updates from npm audit fix. |
Comment on lines
27
to
33
| import { readFileSync } from "node:fs"; | ||
| import { dirname, join } from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import type { Api, Model } from "@mariozechner/pi-ai"; | ||
| import { | ||
| createAgentSession, | ||
| DefaultResourceLoader, |
Owner
Author
|
Superseded by #71 (squash-merged). |
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.
The orchestrator phase in
auto-review.tscalledctx.modelRegistry.find()a second time afterresolveTierModelhad already resolved the model. Custom providers that re-register their model list asynchronously (e.g. radicalai gateway refresh replacing all models mid-session) could cause the second lookup to fail with "could not resolve model from registry".Fix: retain the
Model<Api>reference onResolvedTierModelfrom initial resolution and pass it directly to the orchestrator session — no second registry lookup needed.Also includes
npm audit fixfor transitive dependency vulnerabilities (basic-ftp, fast-xml-parser, ip-address).