Skip to content

feat(decisions): preserve native catalog capabilities and accounting - #157492

Merged
vincentkoc merged 62 commits into
mainfrom
openclaw/decision-catalog-accounting-f8fa117b
Oct 16, 2026
Merged

vincentkoc merged 62 commits into
mainfrom
openclaw/decision-catalog-accounting-f8fa117b

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Decision models need discoverable capability and billing metadata, and completed decision calls need to appear in inference usage accounting.

User Impact

The V3 catalog carries decision capabilities and billing facts without replacing the V1/V2 feeds or their cached entries. Accepted decision usage is attributed to the selected provider/model and consuming plugin. An explicit zero-dollar charge stays zero; unknown route costs stay unknown.

The prepared-runtime stack and its shared credential-authority repair are integrated. This PR does not change default models.

Why This Change Was Made

The catalog publisher removes manifest-only auth ownership before validating the wire format. V3 has its own cache entry. Usage is recorded after the runtime accepts the result, with auth-profile suffixes removed from model accounting identity.

Stack base: #157225. Shared auth repair: #156799. Original PR ancestry is preserved.

Evidence

  • 32 publisher cases pass across both auth scopes and all three wire formats.
  • Five registered decision integration cases and 19 LLM-accounting sibling tests pass.
  • Catalog/cache proof covers preservation of V1/V2 entries. Scoped types, typed lint, SDK surface, formatting and independent review pass.
  • Prior head c99bc43bffb351d0e37d72b2f4aa89f7d4fd116b incorporates the final prepared-runtime parent. Twenty of the 21 feature paths remain byte-identical; the catalog schema combines the parent's parameter-count field with V3 inference metadata. All 11 catalog tests pass.
  • Signed head 26cbd409b9753a9318a6dc09f97b2f0b4b776a09 integrates qualified Runtime 2e8bfec53fc1cf06c9e438f42b027a82e04ace9a and repairs the two Accounting CI diagnostics: an obsolete assertion allowance and a missing test-mock isolation marker. Both failed ratchets and all seven usage tests pass; typed lint, formatting and hooks pass. The automatic Runtime forward preserves the accounting feature patch and both fixes.
  • The combined credential-authority/accounting integration passes all eight cases and remains unchanged by the final parent forward.
  • Full build passed at b227d1121da598b1036817e0e8106319d63e94bc, including SDK declarations/exports, runtime postbuild, CLI and Control UI checks. The prerequisites are now landed; final current-head CI is recorded below.

The parent forward includes the main duplicate-check coverage fix and CI fixture repair at a4c7361. Feature patch identity was verified across the forward; existing proof limits remain in effect.

Prior CI https://github.com/openclaw/openclaw/actions/runs/38932937355 also timed out before first agent acceptance in the Discord transcript-capture E2E. The same head passed a focused reproduction on Bun (50.2s) and Node (75.3s), with its 120s limit unchanged; the required E2E runtime build passed at 14e993fff3ecb84eb1d7c9724c4ceda235d797e4. CI setup had consumed 103.8s before the request. Cold setup is a hypothesis, not a proven root cause or inherited-failure exemption; that earlier timeout remains unexplained, while subsequent current-head CI passed.

Signed head 236ceb85e92ac8cb5bdc58a4a70bd79cbebd1094 integrates landed Runtime 3dd7f57 and now targets main. The complete Accounting feature patch remains byte-identical; the three squash-parent conflicts preserve Accounting additions, and all intervening main paths are retained. Prior exact-head CI at 26cbd409b9753a9318a6dc09f97b2f0b4b776a09 passed: https://github.com/openclaw/openclaw/actions/runs/38936834648. Main updated dependency inputs during this bridge. Final current-head CI passed with 59 successful and 26 skipped jobs: https://github.com/openclaw/openclaw/actions/runs/38939407496. This hosted run qualifies the final dependency inputs; the old local install was not used as current dependency proof.

Landed by native squash as cff3c30. The merge receipt and native checkout cleanup are complete.

roboclaw-bot and others added 7 commits September 23, 2026 13:54
Keep task, protocol, modalities, reasoning, grounding, probability semantics,
abstention and route billing distinct without changing chat Model types.

Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Preserve V1 while moving typed decision execution, both bundled engines, catalog projection and physical credential ownership onto the shared runtime.

Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Keep existing request/auth owners, first-class V1/V2 SDK contracts and actual provider USD precedence. Capture only legitimate effective-route prices; preserve missing usage and the established diagnostic scope.

Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: steipete <[email protected]>
Preserve v1/v2 chat projections and standalone pricing while adding explicit v3 publication and consumption. Carry the reviewed upstream v2 publisher/wire/pricing prerequisites without rebasing the published stack or changing state-store lifecycle. Preserve source-qualified zeros and qualified tariffs.

Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: steipete <[email protected]>
@clawsweeper

clawsweeper Bot commented Sep 24, 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 docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts agents Agent runtime and tooling size: XL labels Sep 24, 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

The branch preserves prepared headers and route-based accounting for native decisions and adds a v3 catalog feed that carries their task capabilities.

Example: A plugin runs a native decision reporting 100 input tokens.

  • Before: The result has no cost estimate despite the route declaring $0.042 per million input tokens and free output.
  • After: The V2 result reports costUsd of 0.0000042.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful runtime and publication evidence supports the contribution, while the unresolved cache defect and v3 product choice limit readiness.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (linked_artifact): The reported registered SDK-to-TypeSafe loopback run exercises prepared headers and accounting, and the inspected canonical publisher artifact demonstrates after-fix v3 task metadata and pricing output. These support the changed production paths; existing-cache upgrade and rollback compatibility remains independently insufficient.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Product

Kind: Feature · Worth it: Needs a maintainer decision
User problem: Native decision calls can lose configured request headers and known cost estimates, while hosted catalogs cannot safely carry their task metadata to compatible readers.
Reason: The runtime repairs address a concrete problem through existing owners. The additional hosted wire version needs catalog-owner direction beyond the recorded SDK allowance.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 4 items remain

This PR retains useful work absent from current main. The previously reported catalog-cache compatibility defect remains unresolved on the unchanged head.

Priority: P2
Reviewed head: 2ca2fe636d546f9509fb2570eba4224a2976f2e6
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should the hosted catalog gain a v3 typed-decision contract, or should this contribution remain limited to prepared native headers and accounting?
  • Recommendation: Support an isolated v3 feed: Accept typed catalog publication as a separate opt-in version, with older catalog state preserved.
  • Why: The existing v2 direction and SDK export allowance are recorded, but neither explicitly accepts the additional v3 wire and persistent-cache contract.

Before merge

  • Store v3 separately from older catalog readers (P1) - Selecting a v3 feed now passes schema 3 into the existing catalog writer. On this pinned branch that replaces modelCatalog.remote, destroying the older reader’s cached v1 catalog; current main’s writer instead uses modelCatalog.remote.v2, whose reader also rejects v3. A downgrade can fail stored-bundle parsing, and an offline URL rollback has no matching previous catalog left to activate. Give v3 version-isolated storage and preserve the older slots. This retains the prior finding, which was first discovered late; these files are unchanged from the earlier reviewed head.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.
  • Explain or restore the original intent of src/model-catalog/remote-refresh.ts - feat(models): dynamic model catalogs via hosted refresh overlay #113660: Sanitized catalogs persist through the existing SQLite owner with source, freshness, conditional-request, and concurrent-writer checks.

Findings

  • [P1] Store v3 separately from older catalog readers — src/model-catalog/remote-refresh.ts:162-164

Provenance

Tests

  • Missing end-to-end proof: Show an existing released-v1 and v2 cached catalog surviving v3 selection, URL rollback, and older-client recovery, including offline recovery; the supplied runs do not establish that compatibility.
Agent review details

How this fits together

Plugins use the Decision SDK to request typed answers through OpenClaw’s model selection and credential owners. The hosted catalog supplies model capabilities and prices, which the Gateway stores and prepares for execution.

flowchart LR
A[Plugin model declarations] --> B[Catalog publisher]
C[Provider pricing feeds] --> B
B --> D{Wire version}
D --> E[Legacy chat catalogs]
D --> F[Typed v3 catalog]
F --> G[Gateway catalog storage]
G --> H[Prepared decision execution and usage]
Loading

Technical review

Best possible solution:

Keep native execution on the existing preparation and usage owners, and introduce any accepted v3 feed through version-isolated catalog storage that preserves older cached catalogs.

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

Yes, source establishes the cache failure: select v3, refresh the shared slot, then return to an older reader or roll back the URL while offline. This review did not execute that transition.

Is this the best way to solve the issue?

Partly: reusing prepared request and usage owners is appropriate, but v3 consumption must preserve version-specific cached state rather than reuse an older reader’s slot.

Full review comments:

  • [P1] Store v3 separately from older catalog readers — src/model-catalog/remote-refresh.ts:162-164
    Selecting a v3 feed now passes schema 3 into the existing catalog writer. On this pinned branch that replaces modelCatalog.remote, destroying the older reader’s cached v1 catalog; current main’s writer instead uses modelCatalog.remote.v2, whose reader also rejects v3. A downgrade can fail stored-bundle parsing, and an offline URL rollback has no matching previous catalog left to activate. Give v3 version-isolated storage and preserve the older slots. This retains the prior finding, which was first discovered late; these files are unchanged from the earlier reviewed head.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +561, Tests +1950, Docs +77, Other +619. Total +3207 across 31 files. Added test files: 4.

View PR surface stats
Area Files Added Removed Net
Source 13 653 92 +561
Tests 12 2007 57 +1950
Docs 3 80 3 +77
Config 0 0 0 0
Generated 0 0 0 0
Other 3 933 314 +619
Total 31 3673 466 +3207

Review metrics

Metric Value Why it matters
New catalog interface 1 additional publisher flag; 1 additional wire version The new --out-v3 output requires agreement between publication, hosting, and compatible readers.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This improves optional native decision execution and catalog accounting without evidence of an urgent core-runtime outage.
  • merge-risk: 🚨 compatibility: Accepted v3 downloads currently replace a cache slot used by readers that reject schema 3.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-24T19:01:49.224Z sha c3bd84f :: blocked before merge. :: none
  • reviewed 2026-09-26T00:38:45.792Z sha 2ca2fe6 :: blocked before merge. :: [P1] Store v3 separately from older catalog readers

Reviewed October 8, 2026, 11:12 PM ET / October 9, 2026, 03:12 UTC (Revision 3).

roboclaw-bot and others added 3 commits September 26, 2026 00:25
Apply only the +14 exports / +6 callables for the existing decisions data contract. Peter Steinberger explicitly approved the complete +18/+6 stack allowance on 2026-09-26; the remaining four execution types belong to the dependent PR. No additional API or guard exception.

Co-authored-by: steipete <[email protected]>
Merge the updated data-layer prerequisite without rewriting its history, then allocate only the four approved execution/context types. Total allowance is exactly +18 exports / +6 callables, approved by Peter Steinberger on 2026-09-26. All implementation and generated SDK bytes remain unchanged.

Co-authored-by: steipete <[email protected]>
Carry the budget approval from the existing data and execution layers without new surface growth or rewritten public history. Catalog, header/accounting and all other source bytes are unchanged.

Co-authored-by: steipete <[email protected]>
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 26, 2026
@vincentkoc vincentkoc self-assigned this Oct 16, 2026
* commit 'a4c73619a5c': (29 commits)
  test: align model and Discord fixtures with runtime owners
  perf(sessions): reuse startup deletion discovery (#174408)
  fix(gateway): attribute ephemeral connections in normal logs (#174406)
  test(telegram): consolidate duplicate coverage (batch d117) (#173112)
  perf(doctor): avoid redundant backup and transcript reads (#174416)
  fix(update): avoid redundant reads for closed SQLite generations (#174426)
  fix(ui): Activity page tabs collapse to a few pixels on desktop (#173856)
  fix(decisions): skip prefilter for empty tool surfaces (#174269)
  perf(sqlite): retain unchanged database proofs across schema updates (#174409)
  refactor(test): remove duplicate export collision checks (#174391)
  fix: clear unused MCP and identity helper exports (#174421)
  fix(test): supply SQLite reliability fixture catalog
  refactor(mattermost): use the guarded transport directly (#174419)
  refactor(agents): trust prepared provider facts (#174388)
  fix(control-ui): open submenus immediately on click (#174292)
  test(anthropic): synchronize the late-send fixture with initialization
  refactor(ui): scope Plugins page state to Solid owners (#174281)
  perf(chat): pace board history refreshes and reuse cursors (#174407)
  perf(sqlite): bound session receipt scope publication (#174395)
  refactor(openrouter): share key budget test fixtures (#174340)
  ...
…ision-accounting-native

* commit '2e8bfec53fc1cf06c9e438f42b027a82e04ace9a': (29 commits)
  test: align model and Discord fixtures with runtime owners
  perf(sessions): reuse startup deletion discovery (#174408)
  fix(gateway): attribute ephemeral connections in normal logs (#174406)
  test(telegram): consolidate duplicate coverage (batch d117) (#173112)
  perf(doctor): avoid redundant backup and transcript reads (#174416)
  fix(update): avoid redundant reads for closed SQLite generations (#174426)
  fix(ui): Activity page tabs collapse to a few pixels on desktop (#173856)
  fix(decisions): skip prefilter for empty tool surfaces (#174269)
  perf(sqlite): retain unchanged database proofs across schema updates (#174409)
  refactor(test): remove duplicate export collision checks (#174391)
  fix: clear unused MCP and identity helper exports (#174421)
  fix(test): supply SQLite reliability fixture catalog
  refactor(mattermost): use the guarded transport directly (#174419)
  refactor(agents): trust prepared provider facts (#174388)
  fix(control-ui): open submenus immediately on click (#174292)
  test(anthropic): synchronize the late-send fixture with initialization
  refactor(ui): scope Plugins page state to Solid owners (#174281)
  perf(chat): pace board history refreshes and reuse cursors (#174407)
  perf(sqlite): bound session receipt scope publication (#174395)
  refactor(openrouter): share key budget test fixtures (#174340)
  ...
Base automatically changed from openclaw/prepared-decision-runtime-f8fa117b to main October 16, 2026 17:16
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Security-sensitive guard cleared

Current revision: 236ceb85e92ac8cb5bdc58a4a70bd79cbebd1094

This PR no longer changes files in the maintainer security-review tier.

Separate CODEOWNERS requirements still apply to security policy and enforcement files.

@vincentkoc
vincentkoc enabled auto-merge (squash) October 16, 2026 17:29
@vincentkoc
vincentkoc merged commit cff3c30 into main Oct 16, 2026
144 checks passed
@vincentkoc
vincentkoc deleted the openclaw/decision-catalog-accounting-f8fa117b branch October 16, 2026 17:33
vincentkoc added a commit that referenced this pull request Oct 16, 2026
…158510

* commit 'cff3c307ba6d0ce273abcdaf5cade848d9746d30':
  feat(decisions): preserve native catalog capabilities and accounting (#157492)
  fix(ui): avoid reactive read warnings in picker scrolling (#174436)
  refactor(test): remove unused Nextcloud fixture signing (#174470)
  refactor(browser): share managed tab eviction fixtures (#174474)
  fix(update): preserve Windows inspection path identities (#174471)
  perf: reduce large-session compaction and indexing allocations (#174433)
  perf(codex): reduce allocations while reading app-server output (#174468)
  fix(gateway): skip startup publication checks without a target (#174453)
  refactor: deslop agent harnesses, channel plugins and packages (wave-6 bundle A) (#173531)
  perf(state): reduce shared SQLite worker heap retention (#174420)
  refactor: remove routine channel callsite diagnostics (#174402)
vincentkoc added a commit that referenced this pull request Oct 16, 2026
…esafe-decision-native

* commit 'cff3c307ba6d0ce273abcdaf5cade848d9746d30':
  feat(decisions): preserve native catalog capabilities and accounting (#157492)
  fix(ui): avoid reactive read warnings in picker scrolling (#174436)
  refactor(test): remove unused Nextcloud fixture signing (#174470)
  refactor(browser): share managed tab eviction fixtures (#174474)
  fix(update): preserve Windows inspection path identities (#174471)
  perf: reduce large-session compaction and indexing allocations (#174433)
  perf(codex): reduce allocations while reading app-server output (#174468)
  fix(gateway): skip startup publication checks without a target (#174453)
  refactor: deslop agent harnesses, channel plugins and packages (wave-6 bundle A) (#173531)
  perf(state): reduce shared SQLite worker heap retention (#174420)
  refactor: remove routine channel callsite diagnostics (#174402)

# Conflicts:
#	src/agents/decision-inference.integration.test.ts
vincentkoc added a commit that referenced this pull request Oct 16, 2026
…/decision-tool-v2-proof-20261016

* commit 'cff3c307ba6d0ce273abcdaf5cade848d9746d30':
  feat(decisions): preserve native catalog capabilities and accounting (#157492)
  fix(ui): avoid reactive read warnings in picker scrolling (#174436)
  refactor(test): remove unused Nextcloud fixture signing (#174470)
  refactor(browser): share managed tab eviction fixtures (#174474)
  fix(update): preserve Windows inspection path identities (#174471)
  perf: reduce large-session compaction and indexing allocations (#174433)
  perf(codex): reduce allocations while reading app-server output (#174468)
  fix(gateway): skip startup publication checks without a target (#174453)
  refactor: deslop agent harnesses, channel plugins and packages (wave-6 bundle A) (#173531)
  perf(state): reduce shared SQLite worker heap retention (#174420)
  refactor: remove routine channel callsite diagnostics (#174402)

# Conflicts:
#	docs/plugins/sdk-overview/capabilities.md
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash auto-merge.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…penclaw#157492)

* feat: describe decision capabilities in model catalogs

Keep task, protocol, modalities, reasoning, grounding, probability semantics,
abstention and route billing distinct without changing chat Model types.

Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>

* fix: apply shared plugin model policy to decisions

Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>

* feat: support plugin-owned model credentials

Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>

* feat(decisions): preserve richer answers with versioned data codecs

Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>

* feat(decisions): run typed tasks with prepared model credentials

Preserve V1 while moving typed decision execution, both bundled engines, catalog projection and physical credential ownership onto the shared runtime.

Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>

* fix(decisions): preserve native headers and route-aware accounting

Keep existing request/auth owners, first-class V1/V2 SDK contracts and actual provider USD precedence. Capture only legitimate effective-route prices; preserve missing usage and the established diagnostic scope.

Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: steipete <[email protected]>

* feat(catalog): publish typed decisions on a versioned feed

Preserve v1/v2 chat projections and standalone pricing while adding explicit v3 publication and consumption. Carry the reviewed upstream v2 publisher/wire/pricing prerequisites without rebasing the published stack or changing state-store lifecycle. Preserve source-qualified zeros and qualified tariffs.

Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: steipete <[email protected]>

* chore(sdk): record approved Decision V2 data allowance

Apply only the +14 exports / +6 callables for the existing decisions data contract. Peter Steinberger explicitly approved the complete +18/+6 stack allowance on 2026-09-26; the remaining four execution types belong to the dependent PR. No additional API or guard exception.

Co-authored-by: steipete <[email protected]>

* fix(models): include inference metadata in extracted tooling

* fix(decisions): preserve explicit owner-agent selection

* fix(decisions): resolve V2 credentials for the operation agent

* test(decisions): align accounting fixtures with captured rates

Declare free output in estimable native fixtures, keep decimal precision assertions numeric, and mark the injected catalog fetch for the existing hermetic transport guard. Keep the publisher validator bound to its validated bundle type.

* fix(decisions): preserve prepared route and auth facts

* test(model-catalog): verify retained caches with released readers

* test(decisions): handle optional normalized catalog providers

* chore(decisions): satisfy scoped runtime lint

* fix(model-catalog): keep manifest auth ownership out of published feeds

* fix(decisions): authorize model identity independently of auth profile

* fix(auth): retain plugin credential authority through dispatch

* fix(decisions): retain credential authority through prepared dispatch

* refactor(decisions): assert resolved credential authority directly

* test(auth): preserve health probe exports in lifecycle fixture

* fix(decisions): distinguish plain record validation

* fix(decisions): repair v2 CI integration

* fix(decisions): align accounting ratchet evidence

---------

Co-authored-by: steipete <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: roboclaw-bot <[email protected]>
obviyus added a commit that referenced this pull request Oct 29, 2026
## What Problem This Solves

Catalog data reaches every released install within hours, with no release. Agents treat manifest rows as inert metadata, so per-model facts keep landing as exact-ID code (35 of 37 model launches since July needed code), and data edits can change released behavior without anyone checking.

## User Impact

There is no runtime change. Agents that work on models now follow 4 more rules in `src/plugins/AGENTS.md` "Model Listing":
- **New model in a known family:** add a manifest row with its thinking data and `input`, not new ID-list entries.
- **An exact-ID rule is allowed only** for a fact the catalog cannot express yet, with a comment citing its live probe or vendor source.
- **Catalog data is live behavior.** Before changing `thinkingLevelMap`, `compat` or `input` on a shipped row, compare the offered levels and request bodies on the stable, extended-stable and beta readers. Report the result in the PR, and change only what a dated live probe supports.
- **Hosted rows parse strictly.** On 2026.10.8 and earlier, one unknown row field rejects the whole refresh; current `main` skips only that row. New facts go inside `compat` or `thinkingLevelMap`. Any other field needs a schema decision first.

## Why This Change Was Made

- **Measured on `main`:** 364 exact-ID model matchers exist in code.
- **Moonshot's manifest disagrees with its code** for K3: the manifest lists `low`/`high`/`max`, but the code forces `max`. Publishing that row unchanged would change what released installs send.
- **Strict readers drop rows with unknown fields.** That is what forced catalog v3 (#157492).

**Decision (models and catalog maintainer):** catalog data safety is enforced through `AGENTS.md` guidance and PR evidence, not a hard CI block on publishing.

## Evidence

- `pnpm check:agents-md-size`: all files are within 20000 chars.
- `oxfmt --check` and `git diff --check` pass.
- I checked the claims on `main`:
  - Strict rows: v2026.9.35 and v2026.10.8 validate `z.array(modelV2Schema)` as a whole, and `main` skips invalid rows (`packages/model-catalog-core/src/remote-catalog-bundle.ts`).
  - v2026.9.35 reads `thinkingLevelMap` in `src/auto-reply/thinking.ts`.
  - The 4-hour publish cron is in `openclaw/catalog` `.github/workflows/publish.yml`.

Co-authored-by: Ayaan Zaidi <[email protected]>
obviyus added a commit that referenced this pull request Oct 29, 2026
## What Problem This Solves

The model catalog has a v3 wire format (#157492) that nothing uses:
- The hosted publisher never writes it. `openclaw/catalog`'s publish workflow passes only `--out` and `--out-v2`, so `catalog.openclaw.ai/models/v3/catalog.json` returns 404.
- No release reads it by default. The default feed is v2.

Still, every catalog change has to keep a third schema, parser, publisher path and set of tests valid, and the extra format confuses anyone reading the catalog code.

## User Impact

There is no change for hosted-catalog users: published v1/v2 bundles are byte-identical. A self-hosted mirror that serves v3 is now rejected like any unsupported format. The refresh fails with an error, and the previous catalog stays active.

## Why This Change Was Made

- **Removed:**
  - The v3 schemas, types, parser and sanitizer (`remote-catalog-bundle.ts`).
  - The client's `schemaVersion === 3` branch (`remote-bundle.ts`).
  - The publisher's `--out-v3` path. `assembleVersionedModelCatalogBundle` collapses into `assembleModelCatalogBundleV2`.
  - The v3 mirror docs and the v3-only tests.
- **Kept:**
  - The `inference` capability data in plugin manifests and bundled rows, which ONNX, Levanto, Liquid AI, ClawRouter, Baseten and the OpenAI policy read.
  - The SQLite slot key `modelCatalog.remote.v3`. It is persisted state, and renaming it would discard every install's cached catalog; only its comment changes.

**Decision (models and catalog maintainer, approved by @vincentkoc, the v3 author):** remove v3 rather than publish a third hosted feed for one optional field. Additive fields will be handled by reader tolerance, not by new wire versions.

Net −248 lines (9 files, +44/−292).

**Known edge, unchanged behavior:** an install that points at a custom v3 mirror and still has a v3 row cached gets a parse error from `readRemoteModelCatalogUpdate` and the recommendation read until it points at a v1/v2 feed. That is the existing intended contract for any unreadable stored download (see "keeps the accepted pair after invalid JSON"). Startup already treats it as absent.

## Evidence

- **Upgrade from latest stable (2026.10.8), sandboxed with the network blocked:**
  - The stable `openclaw models refresh` cached the hosted v2 catalog. It wrote the row `modelCatalog.remote.v2` (`schemaVersion` 2), and `config set agents.defaults.model.primary` was also set.
  - This PR's build, reading the same state, still lists 2 marker models that exist only in the hosted catalog. The same build with no cache lists neither.
  - The config value is intact, and the stored row is unchanged (no re-download).
  - The legacy v1 slot, emulated by re-keying a v1 row, still loads too.
  - A mirror serving `schemaVersion: 3` fails the refresh with exit 1, and the previous catalog stays active. A stored v3 row at startup is treated as absent: the Gateway starts cleanly with bundled rows.

- Byte-identical publisher output. I ran the publisher offline before and after the change (real repo manifests with empty source lists, plus the decisions fixture). `cmp` matches for v1 (167,405 B), v2 (174,027 B), both fixture outputs and the list of fetched URLs.
- Focused tests pass:
  - `model-catalog-normalize`: 55 tests, including new rejection of `schemaVersion: 3`.
  - `remote-refresh` and `remote-overlay`: 19 tests, including a new "unsupported schemaVersion" case.
  - `publish-model-catalog-decisions` and `-typesafe`.
- `oxfmt --check` and `oxlint --type-aware` are clean on the changed files.
- `git grep -E 'BundleV3|bundleV3|outV3|out-v3|modelV3|ModelV3'` finds nothing.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
## What Problem This Solves

Catalog data reaches every released install within hours, with no release. Agents treat manifest rows as inert metadata, so per-model facts keep landing as exact-ID code (35 of 37 model launches since July needed code), and data edits can change released behavior without anyone checking.

## User Impact

There is no runtime change. Agents that work on models now follow 4 more rules in `src/plugins/AGENTS.md` "Model Listing":
- **New model in a known family:** add a manifest row with its thinking data and `input`, not new ID-list entries.
- **An exact-ID rule is allowed only** for a fact the catalog cannot express yet, with a comment citing its live probe or vendor source.
- **Catalog data is live behavior.** Before changing `thinkingLevelMap`, `compat` or `input` on a shipped row, compare the offered levels and request bodies on the stable, extended-stable and beta readers. Report the result in the PR, and change only what a dated live probe supports.
- **Hosted rows parse strictly.** On 2026.10.8 and earlier, one unknown row field rejects the whole refresh; current `main` skips only that row. New facts go inside `compat` or `thinkingLevelMap`. Any other field needs a schema decision first.

## Why This Change Was Made

- **Measured on `main`:** 364 exact-ID model matchers exist in code.
- **Moonshot's manifest disagrees with its code** for K3: the manifest lists `low`/`high`/`max`, but the code forces `max`. Publishing that row unchanged would change what released installs send.
- **Strict readers drop rows with unknown fields.** That is what forced catalog v3 (openclaw#157492).

**Decision (models and catalog maintainer):** catalog data safety is enforced through `AGENTS.md` guidance and PR evidence, not a hard CI block on publishing.

## Evidence

- `pnpm check:agents-md-size`: all files are within 20000 chars.
- `oxfmt --check` and `git diff --check` pass.
- I checked the claims on `main`:
  - Strict rows: v2026.9.35 and v2026.10.8 validate `z.array(modelV2Schema)` as a whole, and `main` skips invalid rows (`packages/model-catalog-core/src/remote-catalog-bundle.ts`).
  - v2026.9.35 reads `thinkingLevelMap` in `src/auto-reply/thinking.ts`.
  - The 4-hour publish cron is in `openclaw/catalog` `.github/workflows/publish.yml`.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
…7481)

## What Problem This Solves

The model catalog has a v3 wire format (openclaw#157492) that nothing uses:
- The hosted publisher never writes it. `openclaw/catalog`'s publish workflow passes only `--out` and `--out-v2`, so `catalog.openclaw.ai/models/v3/catalog.json` returns 404.
- No release reads it by default. The default feed is v2.

Still, every catalog change has to keep a third schema, parser, publisher path and set of tests valid, and the extra format confuses anyone reading the catalog code.

## User Impact

There is no change for hosted-catalog users: published v1/v2 bundles are byte-identical. A self-hosted mirror that serves v3 is now rejected like any unsupported format. The refresh fails with an error, and the previous catalog stays active.

## Why This Change Was Made

- **Removed:**
  - The v3 schemas, types, parser and sanitizer (`remote-catalog-bundle.ts`).
  - The client's `schemaVersion === 3` branch (`remote-bundle.ts`).
  - The publisher's `--out-v3` path. `assembleVersionedModelCatalogBundle` collapses into `assembleModelCatalogBundleV2`.
  - The v3 mirror docs and the v3-only tests.
- **Kept:**
  - The `inference` capability data in plugin manifests and bundled rows, which ONNX, Levanto, Liquid AI, ClawRouter, Baseten and the OpenAI policy read.
  - The SQLite slot key `modelCatalog.remote.v3`. It is persisted state, and renaming it would discard every install's cached catalog; only its comment changes.

**Decision (models and catalog maintainer, approved by @vincentkoc, the v3 author):** remove v3 rather than publish a third hosted feed for one optional field. Additive fields will be handled by reader tolerance, not by new wire versions.

Net −248 lines (9 files, +44/−292).

**Known edge, unchanged behavior:** an install that points at a custom v3 mirror and still has a v3 row cached gets a parse error from `readRemoteModelCatalogUpdate` and the recommendation read until it points at a v1/v2 feed. That is the existing intended contract for any unreadable stored download (see "keeps the accepted pair after invalid JSON"). Startup already treats it as absent.

## Evidence

- **Upgrade from latest stable (2026.10.8), sandboxed with the network blocked:**
  - The stable `openclaw models refresh` cached the hosted v2 catalog. It wrote the row `modelCatalog.remote.v2` (`schemaVersion` 2), and `config set agents.defaults.model.primary` was also set.
  - This PR's build, reading the same state, still lists 2 marker models that exist only in the hosted catalog. The same build with no cache lists neither.
  - The config value is intact, and the stored row is unchanged (no re-download).
  - The legacy v1 slot, emulated by re-keying a v1 row, still loads too.
  - A mirror serving `schemaVersion: 3` fails the refresh with exit 1, and the previous catalog stays active. A stored v3 row at startup is treated as absent: the Gateway starts cleanly with bundled rows.

- Byte-identical publisher output. I ran the publisher offline before and after the change (real repo manifests with empty source lists, plus the decisions fixture). `cmp` matches for v1 (167,405 B), v2 (174,027 B), both fixture outputs and the list of fetched URLs.
- Focused tests pass:
  - `model-catalog-normalize`: 55 tests, including new rejection of `schemaVersion: 3`.
  - `remote-refresh` and `remote-overlay`: 19 tests, including a new "unsupported schemaVersion" case.
  - `publish-model-catalog-decisions` and `-typesafe`.
- `oxfmt --check` and `oxlint --type-aware` are clean on the changed files.
- `git grep -E 'BundleV3|bundleV3|outV3|out-v3|modelV3|ModelV3'` finds nothing.

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 docs Improvements or additions to documentation gateway Gateway runtime 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants