Skip to content

fix(models): retain native model choices during full refresh - #150806

Merged
steipete merged 1 commit into
mainfrom
upd/flake-catalog-worker-account-scoped
Sep 17, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/flake-catalog-worker-account-scoped

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #150427

What Problem This Solves

Full catalog refreshes could expose provider results before native discovery and its auth facts finished, temporarily dropping native model choices and making the account-scoped worker test timing-dependent. This addresses the failure in run 35194807758.

User Impact

Bounded reads retain the previous complete catalog while a full native refresh is in flight. The five-second foreground bound stays unchanged; scoped provider refreshes and recorded discovery failures retain their existing behavior.

Why This Change Was Made

The existing catalog-access owner now stages the catalog, runtime models, and retained inventory, then publishes them together after native discovery and auth settle. Failed acquisition restores the prior publication. The regression holds the native source at the worker boundary, checks that readers retain the previous generation, and awaits the existing standalone explicit-refresh promise before asserting the complete merged result.

The race predates the shared fleet pool: bounded reads arrived in #145190, after the original assertion. This fixture supplies an explicit environment and uses a direct worker.

Evidence

  • Unmodified ordinary test: 0/1 failures on each platform. Forced ordering against pre-fix production: 1/1 failure on macOS and 1/1 on loaded Linux.
  • Fixed production: 20/20 serial regression runs passed on macOS and 20/20 on Linux with three CPU-load workers on four available CPUs. Each loop stopped on any failure.
  • Catalog/model-selection suites: 41 files and 641 tests passed across five Vitest groups; the required build also passed.
  • A final fixture-only method-binding correction passed the regression again on both platforms.
  • Changed checks passed through node scripts/check-changed.mjs, including type-aware lint, core/test types, and all selected guards.
  • Codex autoreview with --mode branch --base origin/main --max-priority P1: scoped clean, no accepted actionable findings.
  • The owned Testbox was stopped after preserving proof. A portal-sync warning after the successful suite run did not affect the command result or saved artifacts.

Production: +67/-20 lines. Tests and test support: +62/-4 lines.

Publish full provider and native catalog results with their paired runtime and auth facts only after acquisition settles. Keep the previous complete view available to bounded reads, preserve scoped refreshes and failure recovery, and exercise a held native source through the worker boundary.
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 17, 2026
@steipete
steipete marked this pull request as ready for review September 17, 2026 10:17
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 17, 2026, 6:25 AM ET / 10:25 UTC.

ClawSweeper review

What this changes

The PR keeps the previous model catalog, executable model choices, and inventory available until a full native refresh finishes, with regression coverage for concurrent reads.

Merge readiness

✅ Ready for maintainer review

This remains a useful fix: pinned main still exposes intermediate refresh results, and neither related PR supersedes it. No actionable introduced defect was found.

Priority: P2
Reviewed head: deef8cd04ff81687305c8195451bb6c1ac1e9296

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression coverage and no supported blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied repository state identifies a member-authored PR, so the external-contributor proof gate does not apply. Reported macOS/Linux worker-boundary regressions exercise catalog publication with a held synthetic native source; they are supplemental validation, not live-provider proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository state identifies a member-authored PR, so the external-contributor proof gate does not apply. Reported macOS/Linux worker-boundary regressions exercise catalog publication with a held synthetic native source; they are supplemental validation, not live-provider proof.
Evidence reviewed 8 items Current main still needs the repair: Pinned main writes catalogInventory, replaces fullCatalog, and reports publication after provider discovery, before native acquisition settles. The affected production files are identical between the merge base and pinned main.
Publication and recovery boundary: The reviewed owner stages full-refresh results, serves published values to readers, restores the previous publication on acquisition failure, and checks current ownership before publishing. Scoped provider refreshes retain their incremental publication path.
Regression exercises the existing worker composition: The added helper holds a synthetic native harness during refresh and checks catalog, runtime-model, and inventory retention before releasing it. The enclosing test then checks native availability through model-list and chat-metadata projections. This tests OpenClaw’s generic publication contract; it does not claim Codex protocol compatibility.
Findings None None.
Security None None.

How this fits together

OpenClaw’s prepared model catalog combines provider discovery, native runtime choices, and authentication facts. CLI listings, model pickers, and new agent runs consume its published snapshots.

flowchart TD
  A[Provider discovery] --> C[Catalog owner]
  B[Native discovery and auth] --> C
  C --> D{Full refresh complete?}
  D -->|No| E[Previous published snapshot]
  D -->|Yes| F[New combined snapshot]
  E --> G[Model listings and agent runs]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +47, Tests +58. Total +105 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 67 20 +47
Tests 2 62 4 +58
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 129 24 +105

Review metrics

None.

Technical review

Best possible solution:

Keep full native refresh publication atomic within the catalog owner while preserving paired authentication, scoped renewal, and the existing foreground deadline.

Do we have a high-confidence way to reproduce the issue?

Yes, source establishes a focused path: hold native discovery after provider completion and read the published catalog and runtime models. The PR reports before/after failures and passes; this review did not execute tests.

Is this the best way to solve the issue?

Yes. Staging results in the existing publication owner addresses the race without adding another cache, configuration option, or discovery path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d08c80a12609.

Labels

Label changes:

  • add P2: This repairs a bounded refresh race that can temporarily omit native model choices without changing configuration or public APIs.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a member-authored PR, so the external-contributor proof gate does not apply. Reported macOS/Linux worker-boundary regressions exercise catalog publication with a held synthetic native source; they are supplemental validation, not live-provider proof.

Label justifications:

  • P2: This repairs a bounded refresh race that can temporarily omit native model choices without changing configuration or public APIs.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository state identifies a member-authored PR, so the external-contributor proof gate does not apply. Reported macOS/Linux worker-boundary regressions exercise catalog publication with a held synthetic native source; they are supplemental validation, not live-provider proof.

Evidence

What I checked:

  • Current main still needs the repair: Pinned main writes catalogInventory, replaces fullCatalog, and reports publication after provider discovery, before native acquisition settles. The affected production files are identical between the merge base and pinned main. (src/agents/prepared-model-runtime.catalog-access.ts:461, d08c80a12609)
  • Publication and recovery boundary: The reviewed owner stages full-refresh results, serves published values to readers, restores the previous publication on acquisition failure, and checks current ownership before publishing. Scoped provider refreshes retain their incremental publication path. (src/agents/prepared-model-runtime.catalog-access.ts:253, deef8cd04ff8)
  • Regression exercises the existing worker composition: The added helper holds a synthetic native harness during refresh and checks catalog, runtime-model, and inventory retention before releasing it. The enclosing test then checks native availability through model-list and chat-metadata projections. This tests OpenClaw’s generic publication contract; it does not claim Codex protocol compatibility. (src/agents/test-helpers/prepared-model-catalog-worker-fixture.ts:146, deef8cd04ff8)
  • Failure and lifecycle controls: Existing tests cover partial native success, retained failure status across provider renewal, explicit recovery, total native failure, and rejection after owner supersession. These paths were inspected; no tests were executed during this read-only review. (src/agents/prepared-model-runtime.native-picker-failures.test.ts:119, deef8cd04ff8)
  • Established published-inventory contract: The CLI documentation says readers retain saved rows during background renewal and failed refreshes preserve available inventory. Catalog materialization consumes authentication facts paired with that published catalog. Public docs: docs/cli/models.md. (docs/cli/models.md:149, deef8cd04ff8)
  • Merge ownership and release context: Raw test-merge parents match pinned main followed by the exact PR head; its main-relative result contains only the four introduced files. The supplied latest release commit is dated September 10, before this patch; no shipped fixing PR was established. (e54ee0de3e4b)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete
steipete merged commit 448b774 into main Sep 17, 2026
280 checks passed
@steipete
steipete deleted the upd/flake-catalog-worker-account-scoped branch September 17, 2026 11:05
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 17, 2026
Wait for published catalog facts under the existing test signal while preserving exact inventory, request-count, pool, and nonblocking RPC assertions. Remove the worker-only completion shortcut.

Controlled provider responses reproduce the old readiness deadlines. Both catalog test files passed 20/20 on main and before #150806 in the attribution comparison; #150806 is not implicated by that comparison.
steipete added a commit that referenced this pull request Sep 17, 2026
…51018)

Fix intermittent Gateway catalog integration failures when background discovery publishes after foreground refresh returns.

Use the existing catalog publication events to wait for observable readiness within each test's lifetime. Preserve exact model, account, request-count, worker-pool, and nonblocking RPC assertions, plus the existing overall deadlines. Controlled provider responses exercise delayed initial discovery and renewal. This changes tests and test support only; production code is unchanged.

Validation: controlled pre-fix failures, repaired Linux runs passing 20/20 per complete file, and the post-rebase macOS run passing both files and all four cases without retries. Changed-file checks passed. The exact-head native CI watcher reported GREEN for run 35254235321 with zero pending checks. Codex review was scoped-clean at P1; ClawSweeper's exact-head revision 2 had no findings or Rank-up moves.

The attribution comparison passed both complete files 20/20 on main and before #150806; that comparison does not implicate #150806.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…w#150806)

Full catalog refreshes could expose provider results before native discovery and its paired auth facts settled, temporarily dropping native model choices. Keep the previous complete catalog, runtime models, and inventory published until the new generation is complete, and restore the previous publication on acquisition failure.

Preserve the five-second foreground bound, scoped provider refreshes, and recorded discovery failures. The worker-boundary regression holds native acquisition to exercise concurrent readers and verifies the final merged catalog.

Related: openclaw#150427

Validation: forced-ordering regressions reproduced the defect on macOS and Linux, then passed 20/20 serial runs per platform with the fix. Catalog/model-selection suites passed 641 tests across 41 files; build and changed checks passed. Exact-head CI: https://github.com/openclaw/openclaw/actions/runs/35209693054.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…enclaw#151018)

Fix intermittent Gateway catalog integration failures when background discovery publishes after foreground refresh returns.

Use the existing catalog publication events to wait for observable readiness within each test's lifetime. Preserve exact model, account, request-count, worker-pool, and nonblocking RPC assertions, plus the existing overall deadlines. Controlled provider responses exercise delayed initial discovery and renewal. This changes tests and test support only; production code is unchanged.

Validation: controlled pre-fix failures, repaired Linux runs passing 20/20 per complete file, and the post-rebase macOS run passing both files and all four cases without retries. Changed-file checks passed. The exact-head native CI watcher reported GREEN for run 35254235321 with zero pending checks. Codex review was scoped-clean at P1; ClawSweeper's exact-head revision 2 had no findings or Rank-up moves.

The attribution comparison passed both complete files 20/20 on main and before openclaw#150806; that comparison does not implicate openclaw#150806.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant