Skip to content

fix(review): retain Model object to avoid registry re-lookup race#70

Closed
vegardx wants to merge 2 commits intomainfrom
fix/load-cached-models-on-startup
Closed

fix(review): retain Model object to avoid registry re-lookup race#70
vegardx wants to merge 2 commits intomainfrom
fix/load-cached-models-on-startup

Conversation

@vegardx
Copy link
Copy Markdown
Owner

@vegardx vegardx commented May 7, 2026

The orchestrator phase in auto-review.ts called ctx.modelRegistry.find() a second time after resolveTierModel had 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 on ResolvedTierModel from initial resolution and pass it directly to the orchestrator session — no second registry lookup needed.

Also includes npm audit fix for transitive dependency vulnerabilities (basic-ftp, fast-xml-parser, ip-address).

vegardx added 2 commits May 7, 2026 22:37
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.
Copilot AI review requested due to automatic review settings May 7, 2026 20:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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> on ResolvedTierModel and pass it directly to createAgentSession (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,
@vegardx
Copy link
Copy Markdown
Owner Author

vegardx commented May 8, 2026

Superseded by #71 (squash-merged).

@vegardx vegardx closed this May 8, 2026
@vegardx vegardx deleted the fix/load-cached-models-on-startup branch May 8, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants