Skip to content

fix: show chat model menus without waiting for discovery - #157899

Merged
obviyus merged 2 commits into
mainfrom
fix/models-ready-at-startup
Sep 25, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix/models-ready-at-startup

Conversation

@obviyus

@obviyus obviyus commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: opening /models or a channel model picker can wait up to five seconds for inventory discovery even when usable models are already known.

Related: #153796.

User Impact

Chat model menus return the current known choices while discovery continues in the background. Pending providers retain the existing checking models… text, and the next open includes newly discovered models. Discovery does not edit an already-sent reply.

Why This Change Was Made

The shared menu loader requested a writable catalog read, which waits for full inventory acquisition. It now reads the published catalog and lets the existing owner acquire the full inventory in the background. Native readiness and authentication facts still come from the same owner. Typed model selection and explicit refresh retain their existing paths; no configuration, startup, persistence, or protocol changes are required.

Owner approval:

“chat pickers answer immediately from known rows, fetch in background”

— Ayaan, 2026-09-25, model-picker invariants program

This decision includes the existing SDK menu builders. The previous implementation
already permitted partial results after its five-second acquisition race; awaiting
a builder was not a complete-inventory guarantee. The SDK compatibility guide now
states the published-row and pendingProviders contract explicitly.

Evidence

Built baseline and candidate Gateways used isolated state and a local vLLM endpoint that delayed its model listing by four seconds. Real chat.send commands exercised /models; models.list was sampled alongside them.

Observation Baseline Candidate
First cold /models reply after acceptance 7.493 s 1.942 s
Replies while provider discovery was pending 5.2–7.5 s 185–625 ms after the initial replies
Later reply lists the newly discovered model Yes Yes
Catalog-not-ready errors in 80 models.list samples 0 0

The first end-to-end candidate reply still includes cold session/admission work; this change removes the catalog acquisition wait, not every source of first-reply latency.

Before, this reply excerpt arrived after the acquisition wait; after, it arrived while the HTTP listing was still pending:

- vllm/known-fixture

vllm: checking models…

A later candidate reply contained:

- vllm/discovered-fixture
- vllm/known-fixture

Typed selection also completed through the Gateway:

Model set to vllm/discovered-fixture for this session only; configured default unchanged.
  • The held-acquisition regression fails on the original loader because no reply is produced; it passes with the fix and verifies that the next reply includes newly published rows.
  • Focused command and recovery suites: 61 tests passed across the scoped runs. After constructing the immutable snapshot fixture correctly, the messaging typecheck and held-acquisition regression passed; the regression took 1.054 s. The full recovery-file single-worker run took 35.11 s including worker-artifact preparation.
  • Clean-clone build, targeted formatting, and git diff --check passed. No model inference or paid provider calls were used.

Telegram Test Server

The checkout's Telegram userbot runner exercised the built candidate with a
Convex-leased Test Server bot and user authorization. The first recorded menu was:

Select a provider:

vllm: checking models…

Its button showed vllm (1). The next provider menu offered the known model while
the HTTP listing was still pending. Reopening after discovery showed two model
buttons, including discovered-fixture.

The first menu arrived 3.951 s after the send receipt, including Telegram ingress
and cold-admission work; it was observed 17 ms after the four-second HTTP listing
started, well before that listing could complete. The later two-model menu
arrived 1.256 s after its send receipt. This proves nonblocking catalog
acquisition, not sub-second end-to-end Telegram startup.

TDLib recorded three new bot messages and zero edits or deletions: discovery did
not modify a previously sent list. Recording completed, the runner released its
credential state, and neither task port remained listening.

@clawsweeper

clawsweeper Bot commented Sep 25, 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.

@obviyus
obviyus marked this pull request as ready for review September 25, 2026 04:44
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Sep 25, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. 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 25, 2026
@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 25, 2026, 2:43 AM ET / 06:43 UTC (Revision 4).

ClawSweeper review

What this changes

Makes chat model menus show published choices while discovery continues, and adds a regression test and user and SDK documentation.

Merge readiness

✅ Ready for maintainer review

Current main still makes chat menu reads wait for catalog acquisition. The PR addresses that behavior, and the previously raised SDK compatibility decision is resolved by the recorded owner approval. I found no actionable correctness or security defect.

Priority: P2
Reviewed head: b2764d96ad5a84c4a31f802dde4d72063215f99f

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A narrow owner-level change has command-boundary regression coverage, detailed real Gateway and Telegram proof, documentation, and an accepted SDK compatibility decision.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The shared menu builder feeds the reported real Gateway /models and Telegram Test Server runs against a delayed local vLLM listing: known choices and checking status appeared before acquisition finished, and reopening showed the new model. No stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The shared menu builder feeds the reported real Gateway /models and Telegram Test Server runs against a delayed local vLLM listing: known choices and checking status appeared before acquisition finished, and reopening showed the new model. No stored-data contract changes.
Evidence reviewed 11 items Introduced menu change: The introduced hunk changes the shared loader to a read-only published-catalog read and starts full acquisition without awaiting it.
Catalog ownership: The catalog owner returns saved rows for a read-only request; a writable request awaits full catalog acquisition.
Current main remains affected: At the fetched current-main revision, the chat menu loader still passes readOnly: false.
Findings None None.
Security None None.

How this fits together

Chat commands and channel picker buttons use a shared model-menu builder. It reads the Gateway’s prepared catalog, applies visibility and readiness decisions, and returns choices to the chat transport.

flowchart LR
A[Chat model request] --> B[Published catalog read]
B --> C[Visibility and readiness]
C --> D[Menu reply]
B --> E[Background discovery]
E --> F[Updated catalog]
F --> G[Next menu request]
G --> B
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +2, Tests +71, Docs +12. Total +85 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 3 1 +2
Tests 1 71 0 +71
Docs 2 12 0 +12
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 86 1 +85

Review metrics

Metric Value Why it matters
Public SDK behavior 2 menu builders return published rows immediately Third-party pickers may see partial inventory until they reopen the menu; the SDK owner explicitly accepted and documented this behavior.

Technical review

Best possible solution:

Keep one catalog owner serving immediate known choices and later discoveries, while model selection continues to revalidate current readiness and authority.

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

Yes. Current-main source shows that chat menus request a writable catalog read that awaits acquisition; the contributor also reports baseline and candidate Gateway timings. I did not execute a current-main reproduction in this read-only review.

Is this the best way to solve the issue?

Yes. The shared menu loader uses the existing published-catalog owner and leaves explicit inventory refresh and selection validation with their existing owners.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: The fix improves chat model-menu responsiveness for affected providers without indicating a broader runtime outage.
  • merge-risk: 🚨 compatibility: Both public SDK menu builders can return partial rows sooner; the recorded SDK decision accepts that tradeoff and the documentation explains it.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The shared menu builder feeds the reported real Gateway /models and Telegram Test Server runs against a delayed local vLLM listing: known choices and checking status appeared before acquisition finished, and reopening showed the new model. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The shared menu builder feeds the reported real Gateway /models and Telegram Test Server runs against a delayed local vLLM listing: known choices and checking status appeared before acquisition finished, and reopening showed the new model. No stored-data contract changes.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The timing and contents of Telegram model-picker messages and buttons are user-visible; the PR body reports a Test Server run of those states.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit cf625a1 adds src/auto-reply/reply/commands-models-catalog.ts:134 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: cf625a134cee; files: src/auto-reply/reply/commands-models-catalog.ts)

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 (3 earlier review cycles)
  • reviewed 2026-09-25T04:51:22.024Z sha 1012f51 :: blocked before merge. :: none
  • reviewed 2026-09-25T05:16:10.262Z sha b2764d9 :: blocked before merge. :: none
  • reviewed 2026-09-25T05:37:50.675Z sha b2764d9 :: blocked before merge. :: none

@obviyus

obviyus commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

SDK owner decision (Ayaan): buildModelsProviderData and buildPreparedModelsProviderData return the currently published model rows immediately, which may be partial while catalog acquisition continues in the background; pending providers stay flagged. They no longer wait for full inventory. This is intentional under the model-picker invariant that pickers never block on network. Existing behavior already returned partial rows after the 5 s acquisition race.

@obviyus

obviyus commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper please clarify and re-evaluate the remaining SDK owner-decision gate for head b2764d9.

The standalone SDK decision is #157899 (comment). Its author, @obviyus, is Ayaan Zaidi (https://github.com/obviyus), and the repository collaborator-permission API reports role_name: maintain. The comment directly approves the published/partial-result behavior for both named SDK builders. This is Ayaan's own recorded decision, not a contributor quoting a different person's private approval.

Please distinguish the product-owner decision from code review, which has reported no code or security findings. If policy requires a different SDK maintainer to approve despite this direct decision, please cite that ownership/independence requirement and the required role. Do not waive CI or any substantive finding; the question is whether the recorded approval has been attributed correctly.

@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper assist is taking a look at your question.

I queued a lightweight read-only assist pass. It will post a separate answer comment and will not edit the durable ClawSweeper review comment or trigger close, merge, repair, label, or branch changes.

Request: please clarify and re-evaluate the remaining SDK owner-decision gate for head b2764d9. The standalone SDK decision is #157899 (comment). Its author, @obviyus, is Ayaan Zaidi (https://github.com/obviyus), and the repository collaborator-permission API reports role_name: maintain. The comment directly approves the published/partial-result behavior for both named SDK builders. This is Ayaan's own recorded deci...

@clawsweeper

clawsweeper Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper assist: The SDK decision is correctly attributed to Ayaan’s own comment, rather than to a quotation in the PR body. It explicitly approves partial published results for both named builders. The supplied context cites no rule requiring approval from a different SDK maintainer. The reported maintain permission supports his authority, though that API result is not independently included here. This resolves the attribution concern; it does not assess CI or code correctness.

Evidence:

Suggested next action: Request @clawsweeper review to reassess the recorded decision for head b2764d96ad5a84c4a31f802dde4d72063215f99f, alongside the usual CI and review evidence.


Source: #157899 (comment)
Assist reasoning: medium.

@obviyus

obviyus commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

ClawSweeper assist has resolved the SDK-decision attribution concern: #157899 (comment). It confirms that #157899 (comment) is Ayaan’s own standalone decision approving partial published results for both SDK builders, and cites no requirement for a different SDK maintainer. The production fix and head b2764d9 are unchanged; CI run 36097493602 is green. This records the resolved product decision without waiving code review or CI.

@obviyus

obviyus commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 25, 2026
@obviyus
obviyus merged commit d3decdc into main Sep 25, 2026
206 of 209 checks passed
@obviyus
obviyus deleted the fix/models-ready-at-startup branch September 25, 2026 06:55
@obviyus

obviyus commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as d3decdc. Chat model menus now return published choices without waiting for cold inventory discovery; reopening includes newly discovered rows. Retained Gateway and Telegram Test Server proof showed known choices while discovery was pending and discovered choices afterward. Exact-head CI passed (run 36097493602), and ClawSweeper Revision 4 is ready with the SDK-owner decision resolved. Thanks for reporting the delay and clarifying the SDK contract.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 26, 2026
…7899)

## What Problem This Solves

Fixes: opening `/models` or a channel model picker can wait up to five seconds for inventory discovery even when usable models are already known.

Related: openclaw#153796.

## User Impact

Chat model menus return the current known choices while discovery continues in the background. Pending providers retain the existing `checking models…` text, and the next open includes newly discovered models. Discovery does not edit an already-sent reply.

## Why This Change Was Made

The shared menu loader requested a writable catalog read, which waits for full inventory acquisition. It now reads the published catalog and lets the existing owner acquire the full inventory in the background. Native readiness and authentication facts still come from the same owner. Typed model selection and explicit refresh retain their existing paths; no configuration, startup, persistence, or protocol changes are required.

Owner approval:

> “chat pickers answer immediately from known rows, fetch in background”
>
> — Ayaan, 2026-09-25, model-picker invariants program

This decision includes the existing SDK menu builders. The previous implementation
already permitted partial results after its five-second acquisition race; awaiting
a builder was not a complete-inventory guarantee. The SDK compatibility guide now
states the published-row and `pendingProviders` contract explicitly.

## Evidence

Built baseline and candidate Gateways used isolated state and a local vLLM endpoint that delayed its model listing by four seconds. Real `chat.send` commands exercised `/models`; `models.list` was sampled alongside them.

| Observation | Baseline | Candidate |
| --- | --- | --- |
| First cold `/models` reply after acceptance | 7.493 s | 1.942 s |
| Replies while provider discovery was pending | 5.2–7.5 s | 185–625 ms after the initial replies |
| Later reply lists the newly discovered model | Yes | Yes |
| Catalog-not-ready errors in 80 `models.list` samples | 0 | 0 |

The first end-to-end candidate reply still includes cold session/admission work; this change removes the catalog acquisition wait, not every source of first-reply latency.

Before, this reply excerpt arrived after the acquisition wait; after, it arrived while the HTTP listing was still pending:

```text
- vllm/known-fixture

vllm: checking models…
```

A later candidate reply contained:

```text
- vllm/discovered-fixture
- vllm/known-fixture
```

Typed selection also completed through the Gateway:

```text
Model set to vllm/discovered-fixture for this session only; configured default unchanged.
```

- The held-acquisition regression fails on the original loader because no reply is produced; it passes with the fix and verifies that the next reply includes newly published rows.
- Focused command and recovery suites: 61 tests passed across the scoped runs. After constructing the immutable snapshot fixture correctly, the messaging typecheck and held-acquisition regression passed; the regression took 1.054 s. The full recovery-file single-worker run took 35.11 s including worker-artifact preparation.
- Clean-clone build, targeted formatting, and `git diff --check` passed. No model inference or paid provider calls were used.

### Telegram Test Server

The checkout's Telegram userbot runner exercised the built candidate with a
Convex-leased Test Server bot and user authorization. The first recorded menu was:

```text
Select a provider:

vllm: checking models…
```

Its button showed `vllm (1)`. The next provider menu offered the known model while
the HTTP listing was still pending. Reopening after discovery showed two model
buttons, including `discovered-fixture`.

The first menu arrived 3.951 s after the send receipt, including Telegram ingress
and cold-admission work; it was observed 17 ms after the four-second HTTP listing
started, well before that listing could complete. The later two-model menu
arrived 1.256 s after its send receipt. This proves nonblocking catalog
acquisition, not sub-second end-to-end Telegram startup.

TDLib recorded three new bot messages and zero edits or deletions: discovery did
not modify a previously sent list. Recording completed, the runner released its
credential state, and neither task port remained listening.

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

docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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