Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesRefresh catalog-derived OpenRouter thinking efforts while preserving operator declarations and prepared metadata when capability loading fails. Example: OpenRouter removes xhigh from acme/effort-model after its catalog row was prepared.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes an unresolved OpenRouter catalog-refresh bug. Earlier findings are addressed, GitHub reports a clean merge, and the reviewed head passes its CI gate; no new actionable defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherProvider discovery publishes model metadata into prepared catalogs and registries; thinking selection and executable-model resolution consume those facts to construct provider requests. flowchart LR
A[OpenRouter catalog] --> B[Discovery rows]
B --> C[Prepared catalog and registry]
A --> D[Capability cache]
C --> E[Thinking selection]
D --> E
C --> F[Runtime model resolution]
D --> F
E --> G[Provider request]
F --> G
Technical reviewBest possible solution: Keep catalog refresh with the existing provider capability owner and preserve explicit declarations and usable prepared rows. Do we have a high-confidence way to reproduce the issue? Current-main source supports preparing xhigh, refreshing the separate capability cache without it, and retaining the prepared ladder; contributor before/after traces exercise that path, but this review ran no target code. Is this the best way to solve the issue? The provenance distinction is a focused repair using existing discovery, cache, registry, and request owners; it preserves authored precedence without synchronous session I/O or a second refresh mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 11a13b63d492. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +147, Tests +666, Docs 0, Other +1. Total +814 across 27 files. Added test files: 2. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (8 earlier review cycles)
Reviewed November 9, 2026, 8:30 AM ET / 13:30 UTC (Revision 9). |
|
Addressed the review findings on the new head ( P1 — clear catalog provenance after configured thinking-map overrides
Real-path proof (prepared session + final provider request after refresh) Ran a real-path harness with only the upstream OpenRouter endpoint impersonated by a local HTTPS endpoint (transport-level redirect; request URLs stay Reverting only the marker-clearing change reproduces the P1 symptom on the same harness ( The PR body's Evidence section has been updated with the full transcript and commands. The two failed |
5ba44d1 to
055b2ce
Compare
|
Follow-up round: rebased onto current 1. Merge conflicts resolved (rebased onto 2. P2 finding ( 3. New fix — the same leak on the config-merge path. 4. Real behavior proof including the host discovery-normalization handoff ( 5. Data-model compatibility proof ( The persisted catalog schema itself is unchanged: 6. Local verification on this head. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
3bd82fc to
a06c336
Compare
|
Round 3: addressed the P2 finding (mapping-only declarations) and the test note. Head is now 1.
This restores rather than changes the intent of 642b31d ("preserve operator effort lists, mappings, and scalar support over incomplete catalog guesses"): the marker only ever identifies rows whose effort metadata came from the catalog, so an operator mapping is now treated as authored on every path — route overrides ( 2. Regression covering the resulting thinking profile (real-path run, section Before/after on the identical script (only the two predicate lines reverted, then restored): |
|
🦞👀 Re-review progress:
|
a06c336 to
305b28d
Compare
|
Round 4: addressed the P2 finding "refresh discovered executable rows before exposing new efforts". Head is now The defect. The fix. A catalog-derived row is now refreshed through the provider's own dynamic-model resolver during normal host model resolution:
Unmarked rows (authored, custom-route, proxy) keep the previous single-lookup behavior; the change is gated on the provenance marker this PR introduces. Regression through normal model resolution (no direct Real-path proof updated — section 7 no longer calls the hook directly; it resolves the executable row through the real host Local verification on this head: The PR body's Evidence section carries all of the above. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Addressed the current review round (P2 "Retain the prepared model when capability refresh has no row") in commit a5fb5d0fc60. Fix: RED before the repair (review acceptance criterion): GREEN after, through normal model resolution and request construction:
Real-path proof ( Low-value tests removed as requested: the provenance-forwarding case in PR body updated (Follow-up 5, Evidence, Review state). CI lanes are running on GitHub Actions for this head. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…og refresh OpenRouter discovery copies upstream reasoning efforts into prepared catalog rows, but the in-process capability cache can refresh later, for example when a missing model triggers a catalog fetch. Prepared rows kept offering and selecting the old effort levels, and the OpenRouter thinking hook could not prefer the refreshed cache because its context could not tell catalog-derived fields from operator-declared ones. Mark catalog-derived effort metadata on prepared rows, thread it into the thinking profile hook context, and let the OpenRouter hook replace those fields with currently loaded capabilities while explicit declarations keep winning. The run-side frozen thinking capability also prefers the runtime model's refreshed efforts for marked rows. A marked row is also refreshed through the provider's own dynamic-model resolver during normal host model resolution, even when the model has no configured entry. Otherwise the session could offer an effort the stale executable row cannot carry, and the request resolver would silently clamp it. Fixes openclaw#160758
Catalog provenance lets a provider's runtime capability cache refresh catalog-derived effort metadata, so any row whose effort metadata an operator authored must not carry the marker. Two projection paths still copied it onto authored rows: logical route overrides, and the host merge of a discovered row with a configured row. The declaration checks also missed `reasoningEffortMap`, which is an explicit scalar-effort declaration: `resolveCatalogOwnedModelCompat` enables scalar support for a mapping-only row. On a warm capability cache the OpenRouter thinking hook then replaced the authored settings with cached catalog data, so a binary catalog generation dropped the operator's mapped effort. Clear the marker whenever overrides or configured rows declare effort metadata — a thinking map, effort tiers, scalar support, or an effort mapping — preserving the existing rule that operator effort lists, mappings, and scalar support win over incomplete catalog guesses. Cover both projection paths, the mapping-only declaration, and the warm-cache hook behavior with focused regression tests.
…s no row A marked catalog-derived row bypasses the registry fast path so the executable model follows capability refreshes. When the capability cache was cold and the /models fetch failed, the OpenRouter dynamic-model hook still rebuilt a synthetic default (reasoning false, text-only input, zero prices), which then replaced the usable prepared row and the completions request lost its selected reasoning effort. The hook now declines whenever capabilities are not loaded and the registry already prepared a row for the model, so normal host model resolution retains the prepared metadata; unknown models without a prepared row still resolve dynamically for missing-model runs. Also removes the two low-value field-copy test cases flagged in review (thinking.test.ts provenance forwarding, model-catalog-metadata.test.ts modelCatalogRowToEntry copy).
a5fb5d0 to
8a37e6b
Compare
|
Rebased onto current Conflict resolutions (main's newer behavior preserved):
Affected checks re-run on the resolved head: The tsgo lanes could not execute on this dev host on current main: the new PR body updated (Evidence + Review state). |
Record a test-lines allocation for the openclaw#160758 regression suite (666 net lines across the provenance/refresh/failload regressions demanded by review rounds) and type the failload fixture's input as a mutable array to match Model.input in the core test-type stripe.
|
The last review's only remaining item (GitHub-reported merge conflicts) is resolved: the branch is rebased onto current @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
AI-assisted: yes
Fixes #160758
What Problem This Solves
xhigh) after OpenRouter dropped it, because the effort metadata was copied into the prepared catalog row at discovery time and the in-process capability cache refreshed later without updating that row.thinkingLevelMapfrom logical overrides, so a warm capability cache could replace that authored map with cached catalog data. The marker is now cleared whenever logical overrides declare effort metadata.mergeProviderModels) had the same leak — an operator-authoredthinkingLevelMapor authored effort tiers still inherited the catalog marker from discovery, so a warm cache could clobber the authored settings. The marker is now cleared whenever the configured row declares effort metadata.mergeProviderModelsandoverlayCatalogMetadata) missedcompat.reasoningEffortMap, which is an explicit scalar-effort declaration —resolveCatalogOwnedModelCompatenables scalar support for a mapping-only row. Such a row kept the marker, so a warm catalog generation advertisingsupportsReasoningEffort: falsewith an empty ladder replaced the operator's mapping and dropped the mapped effort from session choices. Mapping declarations now clear provenance in both places, restoring the intent of 642b31d (operator effort lists, mappings, and scalar support win over incomplete catalog guesses).preferRuntimeResolvedModel). For a plain discovered canonical model the host returned the stale registry row as the executable model, so the session could offer an effort the row could not carry and the request resolver silently clamped it (xhigh→high). Marked rows are now refreshed through the provider's own dynamic-model resolver during normal host model resolution./modelsfetch,buildDynamicOpenRouterModelstill returned a synthetic default row (reasoning: false, text-only input, zero prices), and because that result was defined the host never fell back to the registry row. A prepared reasoning/image model lost those capabilities and the completions request omitted its selected effort. The OpenRouter dynamic-model hook now declines whenever capabilities are not loaded and the registry already prepared a row for the model, so normal host resolution retains the prepared metadata; unknown models without a prepared row still resolve dynamically, keeping missing-model runs working.Why This Change Was Made
catalogReasoningEfforts, and the OpenRouter thinking hook replaces those catalog-derived effort fields with the currently loaded capabilities (the same catalog's current generation) while keeping operator-authored compat facts. Explicit configured declarations never carry the marker, so they keep winning. The run-side frozen thinking capability also prefers the runtime model's refreshed efforts for marked rows.applyLogicalOverrides(route projection),mergeProviderModels(host merge of discovered + configured rows), andoverlayCatalogMetadata(configured overlay) — and a declaration counts as authored when it is a thinking map, effort tiers, scalar support, or an effort mapping. This keeps 642b31d's contract intact: operator effort lists, mappings, and scalar support still win over incomplete catalog guesses; only rows whose effort metadata genuinely came from the catalog follow a refresh.resolveModelWithPreparedRegistry/model.tsnow treat a catalog-derived registry row like a runtime-preferred row, so the model a run actually uses is re-resolved through the provider hook instead of being frozen at preparation time. Unmarked rows (authored, custom-route, proxy) keep the previous single-lookup behavior.overlayCatalogMetadata, route projection, the discovered/configured merge, model registry rows).User Impact
compat.supportedReasoningEfforts,compat.supportsReasoningEffort,compat.reasoningEffortMap, orthinkingLevelMapare unchanged and still take precedence; authored settings are no longer replaced by refreshed catalog data, whether they arrive through route overrides, a configured overlay, or a configured model row merged with discovery.models.json, persisted generated plugin catalogs) load unchanged; rows written before this change have no provenance marker and keep behaving exactly as before.["high","medium","low"], a prepared row that still carriesxhighresolves thinking levels withoutxhigh; with a cold capability cache the prepared row's own snapshot is kept; custom routes are unaffected; a row with an operator-authoredthinkingLevelMapkeeps that map and its own discovered efforts after the same refresh on the projection, overlay, and config-merge paths; and a row whose only declaration iscompat.reasoningEffortMap: { high: "medium" }still offershighafter the catalog refreshes to a binary generation with an empty effort ladder; and when a refresh adds an effort, the executable row follows it, so the level a session offers is the level the provider request actually carries (no silent clamp); and when a capability fetch fails against a cold cache, a prepared row keeps its usable metadata (reasoning, input, effort ladder) and the request still carries the selected effort, while a model with no prepared row still resolves dynamically.extensions/openrouter/index.ts(withOpenRouterCatalogThinking),extensions/openrouter/provider-catalog.ts(buildOpenRouterLiveModel), the marker plumbing insrc/agents/model-catalog-*.tsandsrc/auto-reply/thinking*.ts, the executable-row refresh insrc/agents/embedded-agent-runner/model.registry-resolution.ts(isCatalogDerivedRuntimeRow,resolveModelWithPreparedRegistry) andsrc/agents/embedded-agent-runner/model.ts, the marker-clearing insrc/agents/model-catalog-route.ts(applyLogicalOverrides),src/agents/models-config.merge.ts(mergeProviderModels), andsrc/agents/model-catalog-metadata.ts(overlayCatalogMetadata), and the regression fixturesextensions/openrouter/catalog-reasoning-refresh.test.ts,src/agents/model-catalog-route.test.ts,src/agents/models-config.merge.test.ts,src/agents/model-catalog-metadata.test.ts,src/agents/sessions/model-registry.test.ts,src/agents/embedded-agent-runner/model.compat-route.test.ts.Evidence
main, Node v26. Three evidence layers: (1) the vitest regressions below, (2) a real-path run that drives the real plugin catalog hook, the real host discovery normalization, the real registry projection, the real capability-cache refresh, a real prepared session, and the real final provider request — only the upstream OpenRouter endpoint is impersonated by a local loopback HTTPS endpoint (transport-level redirect; the request URL stayshttps://openrouter.ai/api/v1, key synthetic), and (3) a data-model compatibility run that loads stored catalogs through the real registry and validates them with both this build's schema and the latest stable release's compiled validator (v2026.10.8, schema source extracted from the tag).reasoning: {"effort": "high"}(no stalexhigh); the provenance marker survives the real host discovery-normalization handoff into the registry row; a row whose effort metadata an operator authored — through route overrides, a configured overlay, or a configured model row merged with discovery — keeps that authored metadata across the same refresh; and a mapping-only declaration (reasoningEffortMap: { high: "medium" }) still offershighafter the catalog refreshes to a binary generation with an empty ladder (["minimal","low","medium","high","ultra"], versus["low","ultra"]when the marker is kept).extensions/openrouter/index.tsto main made the refresh regression fail with an extra"xhigh"level. Follow-up 1: running the same real-path script with only the marker-clearing inapplyLogicalOverridesreverted producedRESULT: CHECKS FAILED(authored row clobbered to["low","medium","high","ultra"]). Follow-up 2: with themergeProviderModelsmarker-clearing absent,src/agents/models-config.merge.test.ts > drops catalog effort provenance when config authors effort metadatafails RED (expected true to be undefined), and the real-path[merge]step reportscatalogReasoningEfforts=trueon the authored row. Registry plumbing: removing the marker line fromcreateRegistryRuntimeModelmakessrc/agents/sessions/model-registry.test.ts > loads stored catalogs without effort provenance and keeps discovered provenancefail RED (expected undefined to be true). Follow-up 4 (this round): with the executable-row refresh reverted,src/agents/embedded-agent-runner/model.compat-route.test.ts > refreshes a catalog-derived row through the provider resolver before offering new effortsfails RED (expected [ 'low', 'medium', 'high' ] to deeply equal [ 'xhigh', 'high', 'medium', 'low' ]), and the real-path run reports the stale executable row ([run] ... supportedReasoningEfforts: ["xhigh","high","medium","low"]after the cache refreshed to["high","medium","low"]) withruntimeCompatRefreshed:false, preparedCompatRefreshed:false -> RESULT: CHECKS FAILED. Follow-up 3, all three RED before thereasoningEffortMappredicate was added:src/agents/models-config.merge.test.ts > drops catalog effort provenance when config authors effort metadata(expected true to be undefined),src/agents/model-catalog-metadata.test.ts > drops the marker when the overlay declares only an effort mapping(expected true to be undefined), and in the real-path run the mapped row reportedcatalogReasoningEfforts=truewith warm binary-cache session levels["low","ultra"](mappedhighlost). Follow-up 5 (this round): before the hook decline was added,extensions/openrouter/index.test.ts > keeps the prepared registry row when capabilities failed to loadfailed RED — the hook returned the synthetic default (reasoning: false,input: ["text"]) instead ofundefinedwith a prepared registry row present — and the real-path run's new[failload]checks (failloadKeepsPreparedRow,failloadWireCarriesEffort) fail on that head for the same reason.v2026.10.8schema source compiled with that tag's TypeBox major (1.3.34, present in the lockfile store), not a full install of the previous release.main(0ab37d2) to clear the GitHub-reported conflicts, preserving main's newer behavior:applyLogicalOverridesnow layers the provenance clearing over main'smergeConfiguredThinkingLevelMapper-key merge (authored maps still own the row and drop the marker), and the openrouter hook regression keeps main's extended decision-model exclusion list; affected checks were re-run on the resolved head (see Evidence). Addressed the current review round (P2 "Retain the prepared model when capability refresh has no row"): the OpenRouter dynamic-model hook now declines to rebuild a row from missing capabilities whenever the registry already prepared one, so normal host model resolution keeps the prepared metadata and the request still carries the selected effort; covered by a hook regression, a host-level regression throughresolveModelAsyncplus the real openai-completions transport, and the real-path run's new[failload]section (cold cache + failing/modelsendpoint, unknown models still resolve dynamically). Both low-value tests named in the review were removed (src/auto-reply/thinking.test.tsprovenance-forwarding case,src/agents/model-catalog-metadata.test.tsfinalmodelCatalogRowToEntryfield-copy case; the overlay precedence and route-change regressions are retained). Previous round: addressed the P2 "refresh discovered executable rows before exposing new efforts" finding: marked rows are now re-resolved through the provider's dynamic-model hook during normal host model resolution, with a regression that captures the outbound request throughresolveModelAsyncplus the real openai-completions transport (no directresolveDynamicModelcall), and the real-path run's[grow]section proves the same end to end for a refresh that adds an effort. Previous round:compat.reasoningEffortMapnow counts as an authored declaration in both provenance-clearing checks (mergeProviderModels,overlayCatalogMetadata), with unit regressions for each path plus the mapping-only thinking-profile scenario added to the real-path run; the low-value field-copy case insrc/plugins/provider-discovery.test.tswas removed as requested (the preceding parameterized cases already assert provider/model object identity across normalization, which preserves the field, and the real-path run proves the handoff end to end). Rebased onto currentmain(merge conflicts resolved; the worker-backed OpenRouter capability owner is retained — the thinking hook still readsgetLoadedOpenRouterModelCapabilitiesfrom the worker-backed plugin state, and the real-path proof exercises a real capability-cache refresh through it). The P2 finding aboutcopyProviderCatalogModeldropping the marker no longer applies on currentmain: that lossy copier was removed upstream by refactor(providers): share catalog facts and JSON response ownership #173375 (refactor(providers): share catalog facts and JSON response ownership), andnormalizePluginDiscoveryResultnow passes discovered provider/model objects through by identity. This head adds regression coverage pinning that handoff (src/plugins/provider-discovery.test.ts) and proves it end to end in the real-path run above. Also addressed: the config-merge provenance leak (new fix + RED/GREEN test) and the requested data-model compatibility proof.