Skip to content

fix: session observer rejects models with discovered chat support - #184996

Merged
hannesrudolph merged 1 commit into
mainfrom
fix/luna-observer-admitted-capability
Oct 26, 2026
Merged

hannesrudolph merged 1 commit into
mainfrom
fix/luna-observer-admitted-capability

Conversation

@hannesrudolph

@hannesrudolph hannesrudolph commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes session observer assessments stopping when discovery grants a model chat support but its static catalog entry is typed-only.

User Impact

Utility calls can use the chat capability accepted for their current run without changing the selected model or adding a fallback. Existing runs retain their original capability facts; unsupported models and unrelated routes remain rejected.

Why This Change Was Made

The shared model resolver checked only static declarations, even though admission had captured newer discovery facts. Use that captured declaration for the same model and physical route, retaining static behavior when the captured chat capability is absent. Transport and credential selection are unchanged.

Evidence

  • Regression fails on the original code and passes with the fix. Seven capture/resolution tests cover newly granted chat, older denied admissions, different endpoints/APIs, missing inference metadata, and generation isolation.
  • Existing credential- and route-scoped utility integration passes.
  • Production and changed-test typechecks, targeted type-aware lint, formatting, and runtime build pass.
  • A real-provider check through the built production observer preparation/completion functions produced a schema-valid assessment with the selected utility model and no fallback.
  • Required local review completed on the exact candidate with no actionable correctness or security findings.

Post-merge verification on the running Gateway at 28bad336 confirmed fresh, persisted model-generated observer assessments, including a repeat check at 2026-10-26 21:58:50 UTC. The utility model remained unchanged with no fallback. No observer failures appeared in the checked post-restart logs.

Sanitized persisted observer digest from the repeat check:

{
  "revision": 43,
  "updatedAt": 1793051930578,
  "headline": "Rechecking live observer status",
  "assessment": "The agent has completed the browser checks and is verifying the current observer run and post-restart logs without making changes.",
  "health": "on-track"
}

Runtime validation now covers both standalone completion and the actual running Gateway. No schema migration or configuration change is required by this code fix.

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review ended

ClawSweeper stopped reviewing this revision because the pull request closed.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Oct 26, 2026
@hannesrudolph
hannesrudolph marked this pull request as ready for review October 26, 2026 20:34
@hannesrudolph
hannesrudolph enabled auto-merge (squash) October 26, 2026 20:39
@hannesrudolph
hannesrudolph merged commit 28bad33 into main Oct 26, 2026
193 checks passed
@hannesrudolph
hannesrudolph deleted the fix/luna-observer-admitted-capability branch October 26, 2026 20:47
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 27, 2026
obviyus added a commit that referenced this pull request Nov 16, 2026
… of being refused (#200102)

## What Problem This Solves

Fixes: listed models are refused before any request when OpenClaw only *guesses* they are not chat models. Examples are an ID that names a non-text family, an OpenAI live/cyber/exp/alpha ID, or an unfamiliar kind value. Other guesses show a model that fails for the listing key, such as `gpt-5.6-cyber`.

## User Impact

- Rows that **declare** non-chat support (native kind, output modality, catalog) are unchanged: hidden and refused before any request.
- Rows that are only **unlikely** chat leave the default picker and setup choices but appear in "all" views. Typed and configured refs to them still run.
- OpenAI default picker on a real listing: wrongly shown 1 → 0, wrongly hidden 3 → 3. Typed `openai/o3` replies while it is absent from the default list.
- Tencent TokenHub: an uncatalogued, unlabeled listed ID (the #198288 TTS case) stays out of the default picker without hiding new chat models from typed refs.

## Why This Change Was Made

#199998 made "no evidence" unknown, but kept an interim rule: an ID that names a non-text family got `chat: false`. This PR separates guesses from declarations:

| state | encoding | default picker / setup | "all", typed, configured | pre-run guard |
|---|---|---|---|---|
| yes / unknown | no `inference`, or `chat: true` | shown | shown, runs | passes |
| unlikely | `inference: { chat: true, chatEvidence: "unlikely" }` | hidden | shown, runs | passes |
| declared no | `inference: { chat: false }` | hidden | hidden | refused (#184996) |

- **Marker:** an optional `chatEvidence` key inside `inference`; `chat` is not widened. Old readers drop it and see plain chat:
  - the 2026.11.5 beta inference schema is a non-strict `z.object`;
  - released stable readers have no `inference` at all (v1/v2 bundles only);
  - the v3 hosted reader drops unknown `inference` keys.
  - The registry runtime model and the v3 row schema accept the key.
  - No wire, protocol, config or cache-scope change. `ModelChoice` is a closed protocol object, so there is no "unverified" badge.
- **Weak evidence** applies only to uncatalogued rows without capability fields:
  - the ID-family pattern;
  - an unfamiliar value in a kind field the same listing uses for chat;
  - a provider prior, set with the new discovery option `unknownModelChatEvidence: "unlikely"`.
- **Surfaces:**
  - The visibility owner (default picker, `models.list`, `/models`) treats unlikely like `deprecated`: listed only in `all`, configured and retained views.
  - The setup picker, oMLX and Bifrost offer likely chat only.
  - The guard still refuses only `chat === false`.
- **OpenAI:**
  - `live|cyber|exp|alpha` IDs are demoted instead of dropped, and the `gpt-5.6-cyber` exception is removed.
  - `search` IDs stay dropped: Responses rejects them with a 400, dated snapshots too.
  - The pre-GPT-5 rule stays (#167462).
- **Tencent:** opts into the prior. Its list has IDs and status only and includes speech models (#198288).
- **Docs:** `model-catalogs.md` and `src/plugins/AGENTS.md` each state the rule once, citing #198288 and #199998. The OpenAI and Tencent provider pages are updated to match.
- **Supersedes #199545:** the name-matched OpenAI IDs are demoted, not revealed, so their 404/500 IDs stay out of the default picker.

## Evidence

**Replay of saved real listings, main `84a378cf` vs this head.** Same truth labels as #199998.

| provider | listed | proven | default picker main / branch | wrongly shown / hidden, main | wrongly shown / hidden, branch |
|---|---|---|---|---|---|
| OpenAI (after account projection) | 125 | 31 | 37 / 36 | 1 / 3 | **0 / 3** |
| HF router + OpenRouter | 600 | 600 | 600 / 600 | 0 / 0 | 0 / 0 |
| Vercel AI Gateway | 508 | 508 | 323 / 323 | 0 / 0 | 0 / 0 |
| DeepInfra | 178 | 178 | 92 / 92 | 0 / 0 | 0 / 0 |
| Venice | 414 | 414 | 142 / 142 | 0 / 0 | 0 / 0 |
| NVIDIA (no proof) | 39 | 0 | 29 / 29 | – | – |
| Ollama library | 24 | 24 | 23 / 23 | 0 / 0 | 0 / 0 |
| models.dev | 9,878 | 9,545 | 9,414 / 9,414 | 0 / 0 | 0 / 0 |

- **OpenAI wrongly hidden (3):** `gpt-4o-mini` and `o3` fall under the pre-GPT-5 rule and run by typed ref. `gpt-5-search-api` is Chat-Completions-only.
- **OpenAI rows refused pre-run:** 46 on main, 0 on this branch. 38 of the 46 are now unlikely; 8 hit the pre-GPT-5 drop.
- **TokenHub:** its authenticated listing is uncaptured, so a fixture of that shape is tested instead.

**Real Gateway (built dist, real OpenAI key).**
- **Setup:** each side ran under `env -i` with only PATH, a temp HOME, TMPDIR, `OPENCLAW_STATE_DIR` and `OPENCLAW_CONFIG_PATH`. The key came through stdin only.
- **Isolation:** loopback, its own port and token, no channels (the harness refuses one). Reads waited for a `ready` live listing.

| | main | branch |
|---|---|---|
| OpenAI rows: default `models list` / `--all --provider openai` | 39 / 39 | 36 / 102 |
| `gpt-5.6-cyber` default / all | shown / shown | absent / shown |
| `gpt-image-2` default / all | absent / absent | absent / shown |
| typed `openai/o3` turn (absent from default on both) | reply `ok` | reply `ok` |
| typed `openai/gpt-image-2` turn | refused pre-run `model_chat_unsupported` | sent; provider 404 |

- **Cleanup:** 0 key hits in outputs and state, both Gateways exited and ports closed. The host Gateway was untouched.
- `models list --provider X` already uses the `all` view (#142063).

**Tests and gates.**
- **New cases** are red on `84a378cf` and green here:
  - the gate table (shown / unlikely / declared no) and the provider prior;
  - visibility: default, `all` and configured views;
  - discovery → prepared snapshot → visibility → `resolveModelAsync`: the bare ID-pattern row passes the pre-run check, and the declared-no pin test still rejects;
  - the setup picker;
  - the OpenAI API-key catalog;
  - a Tencent ID-only listing;
  - an old-reader schema fixture;
  - the v3 reader keeping the marker.
- **Consumer suites updated and green:** live-runtime, OpenCode Zen/Go, oMLX, Bifrost, LiteLLM, Anthropic discovery, Codex cyber-failover, utility model.
- **Typecheck and lint:** `tsgo:core`, `tsgo:extensions`, `check:test-types`, oxlint and oxfmt are clean.
- **Prefix stability:** `agent-tools.prefix-stability.test.ts` passes (14/14).
- **Ratchets:** test lines +178 (allowance 400); line-cap passes.
- **Builds:** `ocx build --dts` and `build:plugin-sdk:strict-smoke` pass on this head.
- **`plugin-sdk:api:diff`:** one changed signature, `ModelInferenceCapabilitiesSchema` (optional `chatEvidence`), digest `47bba3f8`.
- **Size:** production +96 / −40 in 10 files; no new module, state, cache or config.

**Accepted edges (no code)**
- The existing route-change overlay replaces a route-moved row's `inference` with `chat: false`, as it already does for any such row.
- A future `chatEvidence` value would fail this build's schema, so a later state should use a new key.
- Main or nightly state saved under #199998 keeps an ID-pattern row as `chat: false` until rediscovery.

## Merge danger

- **Two-way door:** a revert restores #199998's behavior, and older builds read the marker as plain chat. No migration, config or protocol change.
- **Blast radius if wrong:** listed non-chat models appear in `all` views. A typed ref to one gets the provider error instead of the pre-run refusal.

<!-- openclaw-publication:8af8ed4a-ce4e-471b-9465-c401900ac501 -->

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 17, 2026
… of being refused (openclaw#200102)

## What Problem This Solves

Fixes: listed models are refused before any request when OpenClaw only *guesses* they are not chat models. Examples are an ID that names a non-text family, an OpenAI live/cyber/exp/alpha ID, or an unfamiliar kind value. Other guesses show a model that fails for the listing key, such as `gpt-5.6-cyber`.

## User Impact

- Rows that **declare** non-chat support (native kind, output modality, catalog) are unchanged: hidden and refused before any request.
- Rows that are only **unlikely** chat leave the default picker and setup choices but appear in "all" views. Typed and configured refs to them still run.
- OpenAI default picker on a real listing: wrongly shown 1 → 0, wrongly hidden 3 → 3. Typed `openai/o3` replies while it is absent from the default list.
- Tencent TokenHub: an uncatalogued, unlabeled listed ID (the openclaw#198288 TTS case) stays out of the default picker without hiding new chat models from typed refs.

## Why This Change Was Made

openclaw#199998 made "no evidence" unknown, but kept an interim rule: an ID that names a non-text family got `chat: false`. This PR separates guesses from declarations:

| state | encoding | default picker / setup | "all", typed, configured | pre-run guard |
|---|---|---|---|---|
| yes / unknown | no `inference`, or `chat: true` | shown | shown, runs | passes |
| unlikely | `inference: { chat: true, chatEvidence: "unlikely" }` | hidden | shown, runs | passes |
| declared no | `inference: { chat: false }` | hidden | hidden | refused (openclaw#184996) |

- **Marker:** an optional `chatEvidence` key inside `inference`; `chat` is not widened. Old readers drop it and see plain chat:
  - the 2026.11.5 beta inference schema is a non-strict `z.object`;
  - released stable readers have no `inference` at all (v1/v2 bundles only);
  - the v3 hosted reader drops unknown `inference` keys.
  - The registry runtime model and the v3 row schema accept the key.
  - No wire, protocol, config or cache-scope change. `ModelChoice` is a closed protocol object, so there is no "unverified" badge.
- **Weak evidence** applies only to uncatalogued rows without capability fields:
  - the ID-family pattern;
  - an unfamiliar value in a kind field the same listing uses for chat;
  - a provider prior, set with the new discovery option `unknownModelChatEvidence: "unlikely"`.
- **Surfaces:**
  - The visibility owner (default picker, `models.list`, `/models`) treats unlikely like `deprecated`: listed only in `all`, configured and retained views.
  - The setup picker, oMLX and Bifrost offer likely chat only.
  - The guard still refuses only `chat === false`.
- **OpenAI:**
  - `live|cyber|exp|alpha` IDs are demoted instead of dropped, and the `gpt-5.6-cyber` exception is removed.
  - `search` IDs stay dropped: Responses rejects them with a 400, dated snapshots too.
  - The pre-GPT-5 rule stays (openclaw#167462).
- **Tencent:** opts into the prior. Its list has IDs and status only and includes speech models (openclaw#198288).
- **Docs:** `model-catalogs.md` and `src/plugins/AGENTS.md` each state the rule once, citing openclaw#198288 and openclaw#199998. The OpenAI and Tencent provider pages are updated to match.
- **Supersedes openclaw#199545:** the name-matched OpenAI IDs are demoted, not revealed, so their 404/500 IDs stay out of the default picker.

## Evidence

**Replay of saved real listings, main `6851ad05` vs this head.** Same truth labels as openclaw#199998.

| provider | listed | proven | default picker main / branch | wrongly shown / hidden, main | wrongly shown / hidden, branch |
|---|---|---|---|---|---|
| OpenAI (after account projection) | 125 | 31 | 37 / 36 | 1 / 3 | **0 / 3** |
| HF router + OpenRouter | 600 | 600 | 600 / 600 | 0 / 0 | 0 / 0 |
| Vercel AI Gateway | 508 | 508 | 323 / 323 | 0 / 0 | 0 / 0 |
| DeepInfra | 178 | 178 | 92 / 92 | 0 / 0 | 0 / 0 |
| Venice | 414 | 414 | 142 / 142 | 0 / 0 | 0 / 0 |
| NVIDIA (no proof) | 39 | 0 | 29 / 29 | – | – |
| Ollama library | 24 | 24 | 23 / 23 | 0 / 0 | 0 / 0 |
| models.dev | 9,878 | 9,545 | 9,414 / 9,414 | 0 / 0 | 0 / 0 |

- **OpenAI wrongly hidden (3):** `gpt-4o-mini` and `o3` fall under the pre-GPT-5 rule and run by typed ref. `gpt-5-search-api` is Chat-Completions-only.
- **OpenAI rows refused pre-run:** 46 on main, 0 on this branch. 38 of the 46 are now unlikely; 8 hit the pre-GPT-5 drop.
- **TokenHub:** its authenticated listing is uncaptured, so a fixture of that shape is tested instead.

**Real Gateway (built dist, real OpenAI key).**
- **Setup:** each side ran under `env -i` with only PATH, a temp HOME, TMPDIR, `OPENCLAW_STATE_DIR` and `OPENCLAW_CONFIG_PATH`. The key came through stdin only.
- **Isolation:** loopback, its own port and token, no channels (the harness refuses one). Reads waited for a `ready` live listing.

| | main | branch |
|---|---|---|
| OpenAI rows: default `models list` / `--all --provider openai` | 39 / 39 | 36 / 102 |
| `gpt-5.6-cyber` default / all | shown / shown | absent / shown |
| `gpt-image-2` default / all | absent / absent | absent / shown |
| typed `openai/o3` turn (absent from default on both) | reply `ok` | reply `ok` |
| typed `openai/gpt-image-2` turn | refused pre-run `model_chat_unsupported` | sent; provider 404 |

- **Cleanup:** 0 key hits in outputs and state, both Gateways exited and ports closed. The host Gateway was untouched.
- `models list --provider X` already uses the `all` view (openclaw#142063).

**Tests and gates.**
- **New cases** are red on `6851ad05` and green here:
  - the gate table (shown / unlikely / declared no) and the provider prior;
  - visibility: default, `all` and configured views;
  - discovery → prepared snapshot → visibility → `resolveModelAsync`: the bare ID-pattern row passes the pre-run check, and the declared-no pin test still rejects;
  - the setup picker;
  - the OpenAI API-key catalog;
  - a Tencent ID-only listing;
  - an old-reader schema fixture;
  - the v3 reader keeping the marker.
- **Consumer suites updated and green:** live-runtime, OpenCode Zen/Go, oMLX, Bifrost, LiteLLM, Anthropic discovery, Codex cyber-failover, utility model.
- **Typecheck and lint:** `tsgo:core`, `tsgo:extensions`, `check:test-types`, oxlint and oxfmt are clean.
- **Prefix stability:** `agent-tools.prefix-stability.test.ts` passes (14/14).
- **Ratchets:** test lines +178 (allowance 400); line-cap passes.
- **Builds:** `ocx build --dts` and `build:plugin-sdk:strict-smoke` pass on this head.
- **`plugin-sdk:api:diff`:** one changed signature, `ModelInferenceCapabilitiesSchema` (optional `chatEvidence`), digest `47bba3f8`.
- **Size:** production +96 / −40 in 10 files; no new module, state, cache or config.

**Accepted edges (no code)**
- The existing route-change overlay replaces a route-moved row's `inference` with `chat: false`, as it already does for any such row.
- A future `chatEvidence` value would fail this build's schema, so a later state should use a new key.
- Main or nightly state saved under openclaw#199998 keeps an ID-pattern row as `chat: false` until rediscovery.

## Merge danger

- **Two-way door:** a revert restores openclaw#199998's behavior, and older builds read the marker as plain chat. No migration, config or protocol change.
- **Blast radius if wrong:** listed non-chat models appear in `all` views. A typed ref to one gets the provider error instead of the pre-run refusal.

<!-- openclaw-publication:8af8ed4a-ce4e-471b-9465-c401900ac501 -->

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 size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant