Repository navigation
fix(agents): keep model resolution on one plugin generation - #125569
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 18, 2026, 12:21 AM ET / 04:21 UTC. ClawSweeper reviewWhat this changesPins model resolution, provider auth and streaming, and image-policy lookup to the plugin generation prepared for each in-flight agent request. Merge readinessKeep open for protected maintainer review: static inspection found no discrete patch defect, but the branch is behind and the supplied exact-head check matrix is still incomplete. Priority: P2 Review scores
Verification
How this fits togetherAgent requests prepare a model runtime containing plugin metadata and registry state before provider routing. That state feeds model lookup, authentication, stream selection, and image preprocessing, which must remain consistent across a plugin reload. flowchart LR
A[Admitted agent request] --> B[Prepared model runtime]
B --> C[Scoped plugin generation]
C --> D[Model resolution]
D --> E[Provider auth]
E --> F[Streaming response]
D --> G[Image compression policy]
Decision needed
Why: The maintainer label requires explicit handling, and local current-main merge inspection was unavailable in this partial checkout. Before merge
Agent review detailsSecurityNone. PR surfaceSource +172, Tests +321, Other 0. Total +493 across 16 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one prepared-generation scope as the canonical model-routing boundary, then rebase it onto current main and land only after the resulting exact head is green. Do we have a high-confidence way to reproduce the issue? No high-confidence current-main reproduction was run. The A/B generation fixtures clearly model the reload overlap, but this read-only partial checkout could not execute tests or resolve current main. Is this the best way to solve the issue? Yes, subject to rebase validation: carrying the prepared metadata and registry through the canonical resolver, BTW continuation, and image lookup removes the mixed-generation reads without adding configuration surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7e7b860bca54. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Land-ready verification for current head
The +19 production-line delta is the shared generation-owner boundary: public resolver scoping, one lazy static-catalog fact, and complete |
|
Merged via squash.
|
…#125569) * fix(agents): pin model resolution to prepared generation * test(agents): complete prepared runtime fixture
Related: #125090, #125182
What Problem This Solves
Fixes an issue where an in-flight agent request could combine model metadata and runtime behavior from different plugin generations when a plugin reload completed mid-request. Alias normalization, suppression, static catalog metadata, runtime hooks, provider auth, stream selection, and image compression policy could otherwise disagree about which generation owned the model route.
Why This Change Was Made
Model resolution now enters one prepared plugin-generation scope at the public resolver boundary and carries one lazy static-catalog fact through its leaf resolvers instead of rediscovering it. The same owner boundary now covers the complete
/btwcontinuation through provider auth and stream selection; suppression caching uses scoped metadata identity; and image compression delegates static policy composition to the canonical model resolver.This is AI-assisted work. The final diff was inspected directly, validated locally and in an isolated Testbox, and passed the repository autoreview gate.
User Impact
Requests admitted before a plugin reload remain internally consistent through completion instead of borrowing aliases, model metadata, credentials, hooks, or stream factories from the replacement generation. No configuration or public API changes are required.
Production code changes are +19 net lines. Test and test-support coverage is +474 net lines. The assertion-safety baseline shrinks by three existing assertions.
Evidence
node scripts/run-vitest.mjs src/agents/embedded-agent-runner/model.generation-scope.test.ts src/agents/embedded-agent-runner/model.test.ts src/agents/embedded-agent-runner/model.static-catalog.snapshot-cache.test.ts src/agents/embedded-agent-runner/model.static-catalog.prepared.test.ts src/agents/btw.test.ts src/agents/model-suppression.test.ts src/agents/tools/image-tool.test.ts/btwruntime auth and stream selection, and complete image policy composition.pnpm check:changedpassed on the rebased head.pnpm buildpassed.tbx_01m09fw1gp8mp3yf742096594tpassed both real QA Lab scenarios usingqa-channelwithmock-openai: