Skip to content

fix(openai): prevent onboarding from offering unavailable account models - #114356

Merged
steipete merged 2 commits into
mainfrom
codex/openai-onboarding-extended-stress
Jul 27, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/openai-onboarding-extended-stress

Conversation

@steipete

@steipete steipete commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Related: #114288

What Problem This Solves

Fixes an issue where users onboarding with an OpenAI account could be shown and select models that their account cannot actually access, even after successful account-specific model discovery. Also closes a release-acceptance gap that allowed a candidate package to pass without exercising fresh installed onboarding.

Why This Change Was Made

Use the existing model-catalog planner's supplemental selection at the prepared-catalog boundary, keeping the public manifest API and its identity-preserving cache unchanged. Runtime-discovered models now stay account-authoritative while explicitly configured models, account-visible synthetic metadata, distinct provider routes, static providers, and refreshable providers remain available. Strengthen real Gateway onboarding proof through the canonical persisted session accessor and add existing typed installed onboarding to the immutable release artifact's acceptance lanes.

User Impact

Users see and select OpenAI models their account can actually use. Configured models and provider-specific routing continue to work. Release acceptance now checks fresh installed onboarding against the same prepared package artifact, and live onboarding verifies that both the user and assistant messages are durably persisted.

Evidence

  • Started by updating main and froze the initial live baseline at 16d2b7e46784c75eb5d57329269e9fd47222d2ef; subsequently fetched and rebased onto df5d85a5b2ff5249d1bbfbe95579251edfe8adb1.
  • Independently audited onboarding, provider discovery, Gateway, session persistence, package acceptance, and upstream model contracts.
  • Reproduced three deterministic failures before the fix: account-denied runtime declarations, restricted account model lists, and invented synthetic provider models.
  • Exact final commit a4069dc9667f5a93855ee491c75f991ae9cd0d16: 274 passing account-catalog, OpenAI provider, SDK, Gateway transcript, release-planner, and package assertions across six Vitest shards; the exact changed immutable-artifact release-workflow regression also passes independently.
  • Full node scripts/check-changed.mjs fallback: production lint, core/core-test/root-test typecheck, SDK compatibility, dependency/secret/boundary, database/schema, formatting, and runtime-cycle guards all pass.
  • Full pnpm build including the production runtime, all 142 public SDK exports, and production Control UI succeeds.
  • On the pulled baseline, real API calls passed for gpt-5.6, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna, gpt-5.4-mini, gpt-5.4-nano, and chat-latest; real environment-reference onboarding, repeated onboarding, authenticated Gateway readiness, and actual Gateway agent turns also passed.
  • Exact-head real-key onboarding and Gateway proof completed on a separately isolated, normally hydrated Blacksmith Testbox: both live test files passed, 8/8 tests succeeded, all seven requested OpenAI models produced real Responses API completions, repeated onboarding and authenticated Gateway turns passed, and both persisted user and assistant transcript assertions passed. The lease was stopped successfully; no credentials or transcripts were exposed.
  • Personally verified Codex upstream picker and model visibility contracts in ../codex/codex-rs/app-server/src/models.rs and ../codex/codex-rs/protocol/src/openai_models.rs.
  • Two clean independent autoreview passes; TruffleHog clean.
  • AI-assisted.

Inspectable after-fix behavior

Run on reviewed commit a4069dc9667f5a93855ee491c75f991ae9cd0d16:

$ CI=1 OPENCLAW_VITEST_MAX_WORKERS=1 \
  node scripts/run-vitest.mjs src/agents/model-catalog.test.ts --reporter verbose

PASS keeps account-denied runtime models out of the prepared catalog
PASS keeps an account's runtime-discovered model list authoritative
PASS does not augment an account with undiscovered runtime-provider models
PASS preserves explicitly configured runtime-provider models
PASS keeps static manifest models available without runtime account discovery
PASS keeps refreshable manifest models available without runtime account discovery
PASS preserves augmentation for providers without runtime account discovery
PASS overlays configured metadata onto discovered rows
PASS keeps compat from the catalog route selected by config
PASS keeps configured models absent from registry discovery

Test Files  2 passed (2)
     Tests  30 passed (30)

The configured-model regression also checks both the configured OpenAI endpoint and the distinct provider-supplied route, including context-window and tool-compatibility metadata. This directly covers account-denied, restricted-account, upgrade/config compatibility, and synthetic route preservation.

$ CI=1 OPENCLAW_VITEST_MAX_WORKERS=1 \
  node scripts/run-vitest.mjs test/scripts/package-acceptance-workflow.test.ts \
  --testNamePattern 'includes package acceptance in release checks'

Test Files  1 passed (1)
     Tests  1 passed | 90 skipped (91)

That passing assertion parses the workflow and verifies the existing release-typed-onboarding lane is first and consumes the same immutable package artifact digest, artifact ID/name, producer run/attempt, package SHA, source SHA, and version.

The exact persisted Gateway live proof is visible in test/openai-onboarding.live.test.ts:325: the existing real-agent run resolves the canonical session key and independently asserts both hasPersistedTranscriptMessage(persistedEvents, "user", gatewayPrompt) and hasPersistedTranscriptMessage(persistedEvents, "assistant", replyMarker). The final-head key-bearing rerun now genuinely passed on the normally hydrated isolated Blacksmith runner; its exact verified commit, seven actual model completions, real authenticated Gateway response, and durable user/assistant transcript assertions are recorded below.

Linux exact-head checks and build artifacts: https://github.com/openclaw/openclaw/actions/runs/30240758949

Maintainer compatibility review: configured runtime models, provider route variants, manifest cache identity, successful account-discovered rows, and both static and refreshable providers are explicitly covered by the passing after-fix matrix; no new config, auth profile, provider alias, database migration, or shipped compatibility shim was introduced.

Exact-head real OpenAI and Gateway proof

verified remote HEAD: a4069dc9667f5a93855ee491c75f991ae9cd0d16

$ OPENCLAW_LIVE_TEST=1 \
  OPENCLAW_LIVE_OPENAI_MODELS=gpt-5.6,gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-luna,gpt-5.4-mini,gpt-5.4-nano,chat-latest \
  pnpm test:live -- \
    extensions/openai/openai-provider.live.test.ts \
    test/openai-onboarding.live.test.ts

OpenAI Responses API: 7/7 requested live models passed
Actual repeated onboarding: passed
Authenticated real Gateway agent turn: passed
Persisted user transcript assertion: passed
Persisted assistant transcript assertion: passed

Test Files  2 passed (2)
     Tests  8 passed (8)
  Duration  91.86s

All exact-head hosted Linux checks, required Blacksmith Testbox, and the protected CI gate also pass: https://github.com/openclaw/openclaw/actions/runs/30241522309. This proof uses only the native hydrated provider helper; no API key, raw environment, private message, or transcript contents were emitted.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M maintainer Maintainer-authored PR labels Jul 27, 2026
@steipete
steipete marked this pull request as ready for review July 27, 2026 05:47
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 2:08 AM ET / 06:08 UTC.

ClawSweeper review

What this changes

This PR keeps a successfully discovered OpenAI account model list authoritative during onboarding while preserving eligible configured and static provider routes, and adds the installed-onboarding release lane plus related regression coverage.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 5 items remain

Keep this PR open for maintainer handling. The patch targets a real P1 OpenAI onboarding failure and uses a narrow prepared-catalog change rather than changing the public manifest cache API, but it remains compatibility-sensitive and the added PR-body evidence is focused test output rather than inspectable exact-head live onboarding proof. Current main still unconditionally merges eligible manifest models into discovered entries, so the central behavior is not already implemented. (raw.githubusercontent.com)

**Likely related people**

  • steipete — high-confidence recent feature owner, based on the merged related OpenAI onboarding fix and this follow-up’s model-catalog/release-acceptance work.

Priority: P1
Reviewed head: a4069dc9667f5a93855ee491c75f991ae9cd0d16
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch and regression matrix are well-targeted, but real after-fix behavior proof remains a merge gate.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The updated body includes inspectable focused Vitest output, but the claimed real API/onboarding/Gateway runs have no redacted current-head terminal output, logs, recording, or linked runtime artifact for independent review; add that evidence and redact private endpoints, IPs, keys, and account details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The updated body includes inspectable focused Vitest output, but the claimed real API/onboarding/Gateway runs have no redacted current-head terminal output, logs, recording, or linked runtime artifact for independent review; add that evidence and redact private endpoints, IPs, keys, and account details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current-main behavior: Current model-catalog.ts loads eligible manifest rows and merges them into the discovered catalog; that is the behavior this PR narrows for successful runtime account discovery.
Proposed runtime boundary: The PR adds supplemental manifest planning at the prepared-catalog boundary and filters runtime-discovery providers so a discovered account catalog remains authoritative while configured/static routes can still be retained.
Regression matrix: The PR expands model-catalog.test.ts with cases for denied and restricted account models, configured route preservation, and static/refreshable provider behavior.
Findings None None.
Security None None.

How this fits together

OpenAI onboarding builds a prepared model catalog from account discovery, plugin manifests, and explicit configuration before presenting selectable models to the user. The release workflow then runs package-acceptance lanes against the immutable release artifact before shipment.

flowchart LR
  A[OpenAI account discovery] --> C[Prepared model catalog]
  B[Plugin manifests and configured models] --> C
  C --> D[Onboarding model picker]
  D --> E[Selected provider route]
  F[Release package artifact] --> G[Installed onboarding acceptance]
  G --> H[Release decision]
Loading

Decision needed

Question Recommendation
Should OpenClaw adopt this account-authoritative prepared-catalog precedence and require the added installed-onboarding release lane before release acceptance passes? Approve after live proof: Confirm the precedence policy after a redacted exact-head onboarding and persisted Gateway transcript run demonstrates the account-visible catalog and configured-route preservation.

Why: The change intentionally alters provider/auth-derived model availability and release coverage; the maintainer label requires explicit human confirmation of that compatibility policy.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The updated body includes inspectable focused Vitest output, but the claimed real API/onboarding/Gateway runs have no redacted current-head terminal output, logs, recording, or linked runtime artifact for independent review; add that evidence and redact private endpoints, IPs, keys, and account details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - Merging changes the precedence between authenticated account discovery and manifest catalog rows; configured routes, static providers, refreshable providers, and provider-specific endpoints must remain available for upgraded setups.
  • Resolve merge risk (P1) - The PR body now shows focused Vitest output, but it does not provide inspectable after-fix output from a real restricted-account onboarding and Gateway transcript run at the current head.
  • Resolve merge risk (P1) - The PR is marked maintainer, so conservative cleanup must leave the merge decision to a human even if the technical review remains favorable.
Agent review details

Security

None.

PR surface

Source +49, Tests +274, Config 0. Total +323 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 1 63 14 +49
Tests 3 280 6 +274
Docs 0 0 0 0
Config 1 1 1 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 344 21 +323

Review metrics

Metric Value Why it matters
Release acceptance lane 1 existing installed-onboarding lane added The release workflow will exercise fresh typed onboarding against the immutable package artifact before accepting a release.

Stored data model

Persistent data-model change detected: migration/backfill/repair: .github/workflows/openclaw-release-checks.yml, migration/backfill/repair: test/scripts/package-acceptance-workflow.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Add exact-head live onboarding proof (recommended)
    Before merge, attach redacted terminal output or a linked artifact from a restricted-account onboarding run that shows only account-visible choices and a persisted Gateway user/assistant transcript.
  2. Accept the compatibility decision explicitly
    A maintainer may accept the account-authoritative precedence without further live proof only after confirming configured, static, refreshable, and alternate-route behavior is the intended upgrade contract.
  3. Pause for catalog-policy clarification
    Pause this PR if the repository wants a different permanent rule for reconciling successful account discovery with manifest-declared runtime models.

Technical review

Best possible solution:

Keep account-discovered models authoritative only after successful runtime discovery, retain explicitly configured and non-runtime manifest routes through the existing planner, and land after a maintainer confirms the precedence policy with redacted current-head live proof.

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

Yes, source-reproducible: current main merges eligible manifest entries into the discovered catalog, while the PR’s expanded model-catalog cases encode restricted and account-denied discovery states. I did not execute the live provider scenario in this read-only review. (raw.githubusercontent.com)

Is this the best way to solve the issue?

Yes, likely: using the existing catalog planner’s supplemental selection at the prepared-catalog boundary is narrower and safer than altering discovery or the manifest-cache contract, subject to maintainer confirmation of the intended precedence policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against ffec7731a4ac.

Labels

Label justifications:

  • P1: Users can complete onboarding with a model that their authenticated OpenAI account cannot actually access, breaking the first provider run.
  • merge-risk: 🚨 compatibility: The change intentionally alters precedence between discovered account models, manifest rows, and configured provider routes for existing setups.
  • merge-risk: 🚨 auth-provider: The affected catalog is derived from authenticated OpenAI account visibility and governs which provider models onboarding presents.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The updated body includes inspectable focused Vitest output, but the claimed real API/onboarding/Gateway runs have no redacted current-head terminal output, logs, recording, or linked runtime artifact for independent review; add that evidence and redact private endpoints, IPs, keys, and account details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current-main behavior: Current model-catalog.ts loads eligible manifest rows and merges them into the discovered catalog; that is the behavior this PR narrows for successful runtime account discovery. (src/agents/model-catalog.ts:10, ffec7731a4ac)
  • Proposed runtime boundary: The PR adds supplemental manifest planning at the prepared-catalog boundary and filters runtime-discovery providers so a discovered account catalog remains authoritative while configured/static routes can still be retained. (src/agents/model-catalog.ts:510, a4069dc9667f)
  • Regression matrix: The PR expands model-catalog.test.ts with cases for denied and restricted account models, configured route preservation, and static/refreshable provider behavior. (src/agents/model-catalog.test.ts:105, a4069dc9667f)
  • Release-acceptance coverage: The workflow adds the existing release-typed-onboarding Docker lane, and its workflow test asserts immutable package-artifact inputs for that acceptance job. (.github/workflows/openclaw-release-checks.yml:911, a4069dc9667f)
  • Related merged provenance: The related merged PR at fix(openai): correct live model and packaged onboarding failures #114288 introduced the earlier OpenAI onboarding and packaged-onboarding repair; this PR appears to address the remaining prepared-catalog authority and release-lane gap. (src/agents/model-catalog.ts:510, 60aac7467284)
  • Upstream Codex contract: Codex asks the thread manager for online account models and filters picker visibility from those returned presets, supporting account-scoped model selection as the appropriate authority for onboarding. (../codex/codex-rs/app-server/src/models.rs:400)

Likely related people:

  • steipete: Authored the related merged OpenAI onboarding repair and both commits in this follow-up, including the catalog-authority and release-acceptance changes. (role: recent feature owner; confidence: high; commits: 60aac7467284, 681ff3f59d02, a4069dc9667f; files: src/agents/model-catalog.ts, src/agents/model-catalog.test.ts, .github/workflows/openclaw-release-checks.yml)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted current-head output from a real restricted-account onboarding run showing that unavailable models are absent.
  • Include the persisted Gateway transcript assertion or equivalent redacted live output from that same run.
  • Rebase or refresh review once the remaining hosted checks complete, then let a maintainer confirm the catalog-precedence contract.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-07-27T05:51:45.930Z sha 681ff3f :: needs real behavior proof before merge. :: none

@steipete
steipete merged commit fee6db7 into main Jul 27, 2026
196 of 199 checks passed
@steipete
steipete deleted the codex/openai-onboarding-extended-stress branch July 27, 2026 06:23
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 27, 2026
…els (openclaw#114356)

* fix(openai): keep account models and onboarding release proof authoritative

* fix(openai): document configured model catalog authority
obviyus added a commit that referenced this pull request Nov 18, 2026
…ker reads (#200988)

## What Problem This Solves

A model that a provider launches does not appear in the Gateway model picker until the Gateway restarts, its config or credentials change, the next 6-hourly hosted catalog revision is adopted, or the user presses **Refresh**. Example: OpenAI launched `gpt-6.2-astra` and `gpt-6.2-sol` on 2026-11-17. Typed `openai/gpt-6.2-sol` turns worked on every release, but the picker kept the OpenAI listing saved before the launch.

Cause: #167008 stopped ordinary `models.list` reads from renewing an expired provider listing, because that expiry was the provider's 60-second HTTP response-cache TTL and almost every picker open rebuilt the catalog. Nothing replaced it, so a saved live listing never ages on its own.

## Why This Change Was Made

- A successful live listing now expires at the later of its response-cache deadline and 15 minutes after acquisition (`discoveryDeadline`). The floor keeps short TTLs from renewing on almost every read (#167008). A longer TTL still wins (#168050, ClawRouter's one hour), so the expiry relist, which honors each feed's cache, always reaches the provider instead of re-stamping a cached response as fresh.
- `models.list` calls the catalog owner's existing `refreshExpiredModelCatalog`, which relists only expired providers in the background. The read returns the published rows at once; open pickers update through the existing catalog publication push.
- Expiry and failed-discovery retry relists no longer mark providers pending. They revalidate rows the user already sees, so pickers show no loading state and chat `/models` adds no `checking models…` line for them. First sign-in, changed credentials and explicit **Refresh** still report progress.
- The listing still decides which models a signed-in provider shows (#114356). This change only keeps that listing fresh.

Accepted cost: at most one background relist per live-listed provider per 15 minutes (or per its cache TTL, when longer), and only while someone opens a picker. Providers whose listing is not retained in the live response cache (`ttlMs: 0`, self-hosted discovery) keep the previous behavior.

## User Impact

A newly launched provider model appears in the picker within about 15 minutes of the provider listing it, on the first picker open, with no restart, no **Refresh**, no loading indicator and no OpenClaw release.

## Evidence

- **Regression (vitest-source):** `models-list.freshness.integration.test.ts` keeps the real live response cache (500 ms TTL, no cache clearing). It asserts that the listing ages out on the 15-minute floor rather than the short TTL, and that an ordinary `models.list` read on an aged listing serves saved rows with no `pendingProviders`, relists once in the background, then publishes the new model. Fails on merge base `e235b2b983b6` (3/3, deadline equals the cache TTL); the no-pending assertion also fails on this PR's previous head `41ee4d30` (3/3, provider listed as pending); passes on this head (3/3).
- **Renewal contract (vitest-source):** `server-chat-metadata-lifecycle.catalog-renewal.test.ts` now asserts that an expiry renewal never publishes a pending provider and that settling it sends only the real catalog change, with no refresh-status broadcast. An explicit refresh in the same file still reports refresh status.
- **E2E, CLI reads (fix: source tier; base: `e235b2b983b6` dist-nodts):** two isolated Gateways, each with a fake LiteLLM proxy as its live listing and hosted catalog refresh disabled. At 04:03:46Z each proxy starts listing `fake-2`; an ordinary `gateway call models.list` (no refresh) runs once a minute.

  | Time (UTC) | Fix Gateway picker | Base Gateway picker |
  |---|---|---|
  | 04:03:41 (before) | `fake-1` | `fake-1` |
  | 04:04 to 04:17 | `fake-1` | `fake-1` |
  | 04:18:58 | `fake-1`, `fake-2` | `fake-1` |
  | 04:23:58 | `fake-1`, `fake-2` | `fake-1` |

  Proxy request logs: the fix Gateway listed at startup and once more at 04:17:58, the first read after the listing aged; no other requests. The base Gateway never listed again.
- **E2E, Control UI (dist-nodts, real browser):** this head and the previous head `41ee4d30`, each with a fake LiteLLM listing whose `/models` response is held for 25 s after a new model is added. The picker is opened once the listing aged (proxy logs show the relist request at that moment), then again after release. During the relist both pickers render the saved models immediately with no loading state; the new model appears after the relist publishes. The visible difference from the previous head is the pending flag (`pendingProviders`, and chat `/models` `checking models…`), which the tests above pin as absent. Screenshots: #200988 (comment)
- **Affected suites (vitest-source, exact head):** freshness, renewal, worker recovery, publication events, auth-login catalog, prepared-runtime sources, native picker failures and configured catalog index: 52 tests across 5 shards pass.
- **Review and CI:** local ClawSweeper review (`gpt-6.1-sol`) on `3fd0cae6` found no issues; required CI is green on the same head.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 19, 2026
…ker reads (openclaw#200988)

## What Problem This Solves

A model that a provider launches does not appear in the Gateway model picker until the Gateway restarts, its config or credentials change, the next 6-hourly hosted catalog revision is adopted, or the user presses **Refresh**. Example: OpenAI launched `gpt-6.2-astra` and `gpt-6.2-sol` on 2026-11-17. Typed `openai/gpt-6.2-sol` turns worked on every release, but the picker kept the OpenAI listing saved before the launch.

Cause: openclaw#167008 stopped ordinary `models.list` reads from renewing an expired provider listing, because that expiry was the provider's 60-second HTTP response-cache TTL and almost every picker open rebuilt the catalog. Nothing replaced it, so a saved live listing never ages on its own.

## Why This Change Was Made

- A successful live listing now expires at the later of its response-cache deadline and 15 minutes after acquisition (`discoveryDeadline`). The floor keeps short TTLs from renewing on almost every read (openclaw#167008). A longer TTL still wins (openclaw#168050, ClawRouter's one hour), so the expiry relist, which honors each feed's cache, always reaches the provider instead of re-stamping a cached response as fresh.
- `models.list` calls the catalog owner's existing `refreshExpiredModelCatalog`, which relists only expired providers in the background. The read returns the published rows at once; open pickers update through the existing catalog publication push.
- Expiry and failed-discovery retry relists no longer mark providers pending. They revalidate rows the user already sees, so pickers show no loading state and chat `/models` adds no `checking models…` line for them. First sign-in, changed credentials and explicit **Refresh** still report progress.
- The listing still decides which models a signed-in provider shows (openclaw#114356). This change only keeps that listing fresh.

Accepted cost: at most one background relist per live-listed provider per 15 minutes (or per its cache TTL, when longer), and only while someone opens a picker. Providers whose listing is not retained in the live response cache (`ttlMs: 0`, self-hosted discovery) keep the previous behavior.

## User Impact

A newly launched provider model appears in the picker within about 15 minutes of the provider listing it, on the first picker open, with no restart, no **Refresh**, no loading indicator and no OpenClaw release.

## Evidence

- **Regression (vitest-source):** `models-list.freshness.integration.test.ts` keeps the real live response cache (500 ms TTL, no cache clearing). It asserts that the listing ages out on the 15-minute floor rather than the short TTL, and that an ordinary `models.list` read on an aged listing serves saved rows with no `pendingProviders`, relists once in the background, then publishes the new model. Fails on merge base `9decc8090873` (3/3, deadline equals the cache TTL); the no-pending assertion also fails on this PR's previous head `41ee4d30` (3/3, provider listed as pending); passes on this head (3/3).
- **Renewal contract (vitest-source):** `server-chat-metadata-lifecycle.catalog-renewal.test.ts` now asserts that an expiry renewal never publishes a pending provider and that settling it sends only the real catalog change, with no refresh-status broadcast. An explicit refresh in the same file still reports refresh status.
- **E2E, CLI reads (fix: source tier; base: `9decc8090873` dist-nodts):** two isolated Gateways, each with a fake LiteLLM proxy as its live listing and hosted catalog refresh disabled. At 04:03:46Z each proxy starts listing `fake-2`; an ordinary `gateway call models.list` (no refresh) runs once a minute.

  | Time (UTC) | Fix Gateway picker | Base Gateway picker |
  |---|---|---|
  | 04:03:41 (before) | `fake-1` | `fake-1` |
  | 04:04 to 04:17 | `fake-1` | `fake-1` |
  | 04:18:58 | `fake-1`, `fake-2` | `fake-1` |
  | 04:23:58 | `fake-1`, `fake-2` | `fake-1` |

  Proxy request logs: the fix Gateway listed at startup and once more at 04:17:58, the first read after the listing aged; no other requests. The base Gateway never listed again.
- **E2E, Control UI (dist-nodts, real browser):** this head and the previous head `41ee4d30`, each with a fake LiteLLM listing whose `/models` response is held for 25 s after a new model is added. The picker is opened once the listing aged (proxy logs show the relist request at that moment), then again after release. During the relist both pickers render the saved models immediately with no loading state; the new model appears after the relist publishes. The visible difference from the previous head is the pending flag (`pendingProviders`, and chat `/models` `checking models…`), which the tests above pin as absent. Screenshots: openclaw#200988 (comment)
- **Affected suites (vitest-source, exact head):** freshness, renewal, worker recovery, publication events, auth-login catalog, prepared-runtime sources, native picker failures and configured catalog index: 52 tests across 5 shards pass.
- **Review and CI:** local ClawSweeper review (`gpt-6.1-sol`) on `3fd0cae6` found no issues; required CI is green on the same head.

Co-authored-by: Ayaan Zaidi <[email protected]>
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 merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant