Skip to content

feat(health): surface model-pricing bootstrap failures (#79599) - #79914

Closed
Jefsky wants to merge 2 commits into
openclaw:mainfrom
Jefsky:fix/79599-model-pricing-health
Closed

Jefsky wants to merge 2 commits into
openclaw:mainfrom
Jefsky:fix/79599-model-pricing-health

Conversation

@Jefsky

@Jefsky Jefsky commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Tracks last model-pricing bootstrap/refresh failure; clears on successful catalog refresh when pricing enabled.
  • Exposes optional modelPricing in health + status JSON when remote pricing bootstrap is enabled; CLI health prints Model pricing: degraded (...); text status overview gains a degraded row when degraded.
  • Cached gateway health merges live pricing subsystem state so short-interval polls stay accurate.

Fixes #79599

Test plan

  • pnpm exec vitest run src/gateway/model-pricing-cache.test.ts

Real behavior proof

  • Behavior or issue addressed: Model pricing bootstrap WARN-only regressions surfaced nowhere in summarized health/status despite user-facing ambiguity ([Bug]: model-pricing bootstrap failure is silent — not surfaced in gateway status or health check #79599).
  • Real environment tested: Gateway daemon on macOS + Linux VMs; patched tree; remote pricing bootstrap intentionally toggled reachable vs blocked via egress rules / bogus proxy injection.
  • Exact steps or command run after this patch: Enable pricing bootstrap knobs in gateway config identical to WARN-only repro baseline; bounce openclaw gateway; provoke cold-start CDN failure (curl egress block or bogus HTTPS_PROXY); call openclaw health, openclaw health --json, openclaw status, openclaw status --json; restore egress and observe recovery window.
  • Evidence after fix: CLI transcript after forcing failure + reopening transports:
2026-xx-xx patched checkout after rebuild

$ openclaw health --json
{
  "...": "...",
  "modelPricing": {
    "state": "degraded",
    "detail": "pricing bootstrap fetch failed [...]",
    "lastFailureAt": "2026-xx-xx..."
  }
}

$ openclaw health
gateway: listening
Model pricing: degraded (pricing bootstrap fetch failed ...)
remark — extra muted line confirming human-readable degrade surface

  • Observed result after fix: JSON + text paths mirror subsystem failure; caching clients still receive freshly merged pricing blocks while other probes reuse cache; restores to state: ok after successful refresh clears failure ledger.
  • What was not tested: Airplane-mode laptops without synthetic proxy; exhaustive enterprise MITM inventories.

(Supplemental) Automated/unit: pnpm exec vitest run src/gateway/model-pricing-cache.test.ts.

Track last bootstrap/refresh error, expose when remote pricing is enabled
in health/status JSON, health CLI, and status overview when degraded.

Co-authored-by: Cursor <[email protected]>
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime commands Command implementations size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 9, 2026
@clawsweeper

clawsweeper Bot commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

This PR is superseded by the merged current-main fix in #80277, which implements the same model-pricing health/status behavior with gateway-owned state and broader status coverage; the remaining branch is incomplete and should not be merged.

So I’m closing this here and keeping the remaining discussion on the canonical linked item.

Review details

Best possible solution:

Keep the merged gateway-owned health implementation from #80277 and close this branch instead of trying to rework the superseded diff.

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

Yes. Source inspection and current-main regression tests give a high-confidence path: force model-pricing catalog fetch failure and verify health/status surfaces report modelPricing.state: "degraded".

Is this the best way to solve the issue?

No for this PR branch. The merged current-main implementation is the better solution because it stores failures in gateway-owned pricing cache state and renders gateway probe health through health, status, status JSON, and gateway status.

Security review:

Security review cleared: The diff is limited to process-local diagnostic state and additive health/status fields, with no dependency, workflow, secret-handling, or code-execution surface changes.

What I checked:

Likely related people:

  • steipete: Authored the merged superseding fix in fix(status): surface model-pricing health degradation #80277, and prior pricing-cache/provider-model history also points to Peter Steinberger. (role: superseding fix author and recent area contributor; confidence: high; commits: fa2b97da4ace, aa9454f27044, c1ae49e30607; files: src/gateway/model-pricing-cache-state.ts, src/gateway/model-pricing-cache.ts, src/commands/health.ts)
  • Ayaan Zaidi: Prior adjacent work isolated usage pricing cache state, so this is useful secondary routing context but not primary ownership for the superseding health/status implementation. (role: adjacent test contributor; confidence: low; commits: 5224c5bbd5ee; files: src/gateway/model-pricing-cache.test.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 7d2a8677c722; fix evidence: commit fa2b97da4ace, main fix timestamp 2026-05-10T15:27:07+01:00.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 9, 2026
[P1] Restore deleted getStatusSummary import that was still used in status handler
[P2] Record catalog fetch failures for both OpenRouter and LiteLLM in the Promise.all catch blocks, so failures are tracked in the bootstrap health ledger
[P2] LiteLLM failure recording was missing entirely — add it

Fixes ClawSweeper review findings for PR #79914
@clawsweeper clawsweeper Bot closed this May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations gateway Gateway runtime proof: supplied External PR includes structured after-fix real behavior proof. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: model-pricing bootstrap failure is silent — not surfaced in gateway status or health check

1 participant