Repository navigation
Conversation
The owner-by-snapshot map added in openclaw#134361 keys on snapshot identity, and publishPreparedModelRuntimeOwnerSnapshot is its only writer. advancePreparedModelRuntimeOwnerConfig assigned owner.snapshot directly, and the config stamp mints a new frozen snapshot, so the map kept pointing at the retired one. The catalogStale flag survived the advance while the lookup that consumes it no longer resolved its owner, and the next explicit browse served the pre-login catalog. Route that assignment through the writer so the index moves with the stamp, and say on the writer that it is the only permitted assignment site.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed September 1, 2026, 3:03 AM ET / 07:03 UTC. ClawSweeper reviewWhat this changesThe PR routes a config-stamped prepared runtime snapshot through the canonical publisher so an explicit model browse can refresh providers authenticated before a gateway config reload. Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 4 items remain The patch is a correct owner-boundary repair: it restores the snapshot-to-owner index after an in-place config stamp. Keep this PR open for a redacted real gateway run, because the supplied validation is focused mocked-test evidence rather than after-fix operator behavior. Priority: P1 Review scores
Verification
How this fits togetherPrepared model-runtime snapshots supply model catalogs to gateway, CLI, and channel browse requests. Authentication marks a catalog stale; an explicit browse resolves the snapshot owner and refreshes that catalog without making normal agent runs wait for provider discovery. flowchart LR
A[Provider authentication] --> B[Catalog marked stale]
B --> C[Prepared runtime owner]
C --> D[Config reload stamps snapshot]
D --> E[Snapshot owner lookup]
E --> F[Explicit model browse]
F --> G[Refreshed catalog]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +6, Tests +46. Total +52 across 2 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the canonical publisher call, then demonstrate on an isolated gateway that provider login followed by an ordinary config reload makes the provider appear on the next explicit model browse without exposing credentials. Do we have a high-confidence way to reproduce the issue? Yes, at the owner boundary: a profile-set auth mutation followed by a model-neutral config advance returns a new snapshot identity absent from the current-main WeakMap. The supplied focused regression transcript supports this path, though it was not independently executed in this read-only review. Is this the best way to solve the issue? Yes. Updating the existing sole snapshot publisher repairs the identity-index invariant at its owner rather than compensating in catalog readers or broadening discovery behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 32adfe7a8e12. LabelsLabel changes:
Label 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
|
|
Closing as superseded by #135063, which landed the same owner-boundary repair on main. Measured on
Thanks @steipete for picking the invariant up at the publisher instead of at the call site — moving the stamp inside the sole publication helper is the stronger placement, since every future publication path inherits the index update for free. |
Related: #134361
What Problem This Solves
Fixes an issue where an operator who runs
models auth loginand then triggers any ordinary gateway config reload is still shown the pre-login model catalog in/modelsandmodels.list. The catalog is marked stale by the auth change, but the refresh that is supposed to consume that flag on the next explicit browse silently does not run, so the newly authenticated provider's models never appear until the gateway restarts.This is the exact failure #134361 shipped to fix; it comes back whenever a model-neutral runtime-config commit lands between the login and the browse.
Why This Change Was Made
#134361 added
ownersBySnapshot, aWeakMapfrom a published snapshot to its owner, sorefreshStalePreparedModelRuntimeCatalogcan find the owner holdingcatalogStalewithout scanning every owner.publishPreparedModelRuntimeOwnerSnapshotis its only writer.advancePreparedModelRuntimeOwnerConfigassignsowner.snapshotdirectly, bypassing that writer:stampPreparedModelRuntimeSnapshotConfigreturnsObject.freeze({ ...snapshot, config }), a new object identity, in exactly the case that reaches this line. The map keeps pointing at the retired snapshot, the snapshot readers now receive is absent from it, and the lookup returnsundefined.catalogStaleis untouched by the advance, so the flag stays set while the code that consumes it can no longer resolve its owner.Both callers are live gateway paths:
advancePreparedModelRuntimeConfigruns fromgateway/server-reload-managed.tson every model-neutral runtime-config commit, andupdateOwnersForScopedRefreshadvances every owner outside a scoped refresh.The fix routes that assignment through the writer, and the writer now carries a comment stating it is the only permitted assignment site, so a future
owner.snapshot =elsewhere is visibly out of contract. It is behaviour-preserving for every path that does not take a config advance: the previous owner scan readowner.snapshotat call time, which is what the map now reflects.User Impact
After authenticating a new provider, an explicit model browse refreshes the catalog as intended even if a config reload happened in between. Nothing else changes: the refresh still runs only on an explicit read that opts in, and owners that never take a config advance behave exactly as before.
Evidence
Regression test added to
src/agents/prepared-model-runtime.reload-auth.test.ts: publish, apply aprofileSetChangedauth mutation, advance the config stamp in place, then refresh from the snapshot readers now hold.The measurement that motivated it, counting
runPreparedModelCatalogWorkerinvocations across two arms that differ only by theadvancePreparedModelRuntimeConfig({})call:main["authenticated-model"]undefined["authenticated-model"]["authenticated-model"]End to end through
loadPreparedModelCatalogOwnerSnapshot({ readOnly: true, refreshFullCatalog: true })the same split shows up as reachingmaterializeRequestedModelCatalogversus returningentries: []without ever attempting the refresh.The new test is load-bearing. Reverting only the
prepared-model-runtime.owner.tschange and rerunning the file:With the change applied, all 16 pass:
Local gates, all clean against
origin/main: