Skip to content

fix: keep usage pricing from blocking the Gateway on filesystem lookups - #197599

Merged
steipete merged 13 commits into
mainfrom
fix/usage-pricing-async-source
Nov 12, 2026
Merged

steipete merged 13 commits into
mainfrom
fix/usage-pricing-async-source

Conversation

@steipete

@steipete steipete commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Usage-pricing lookups repeatedly performed synchronous filesystem admission when an agent's models.json was absent. A slow lookup could block the Gateway main thread. Usage, status and session-list formatting now consume operation-prepared cost facts; recorded totals, including billed zero, skip optional pricing preparation entirely.

User Impact

Recorded totals, authored positive prices, model selection, source precedence, unknown prices and tiered pricing preserve their existing behavior. Internal synchronous renderers receive numeric facts; the public terminal SDK helper remains synchronous. External manual edits to models.json require a Gateway restart, matching the existing positive-entry behavior. No configuration option, dependency, schema or cache owner is added.

Why This Change Was Made

The canonical catalog owner publishes its source or known absence into its existing bounded projection. Pricing-only cold reads recheck that projection inside the existing models-file writer queue, so concurrent readers share the result and delayed reads cannot overwrite newer committed prices. Fresh catalog captures retain their fresh-read contract. Each operation holds its exact agent/provider pricing context through presentation and persistence, so projection eviction cannot change its answer. The redundant Gateway per-model cache and obsolete synchronous pricing-context getter are removed.

Scope and tradeoffs

Against prerequisite e22e72a4d281cf4795191c1797b9dacfb15b8985 in #197736, pricing production grows by 262 lines: asynchronous fallback preparation and retained operation facts cross existing presentation, SDK and session-mutation boundaries. Tests grow by 405 lines, with an exact five-line allocation above the universal 400 allowance for cancellation cleanup and explicit E2E agent-scope setup. Previously repaired generated output and CLI/research fixtures are now in main and contribute no remaining PR delta.

Cold capture now waits asynchronously. Five-sample candidate median/max were 2.056/10.300 ms, versus historical baseline medians 1.121/.570 ms. This scheduling cost is accepted to keep filesystem stalls off the main thread. All earlier samples, including a 57.117 ms cold maximum under heavier load, remain retained. These are owner measurements, not whole-Gateway latency claims.

Evidence

Current source: 6834f3959963e535b629c257396c36ec3abe33ac, building on the conflict-free merge of reviewed pricing head e3b6b18d073ec21b9f2f0caf31e3a901a05a2990 with exact prerequisite e22e72a4d281cf4795191c1797b9dacfb15b8985. Prerequisite #197736 passed exact-head CI and merged as 7910cd62c6ca2f8a5099298dd6de84be87d55739; its logging and bootstrap source inclusion in main was verified before this publication. The merge was conflict-free. Pricing owner, benchmark and dependency-manifest bytes remain unchanged; logging and Gateway bootstrap bytes match the reviewed prerequisite exactly. No default-log-target overlay is included.

Prior pricing-head CI 43214846389 finished with 78 successful jobs, 25 skipped jobs and only the remote-catalog failure plus its aggregate gate. The producer regression was introduced by #197586: lazy logger initialization changed the process environment after the catalog pool captured it, causing admission rejection with live borrowers. The prerequisite establishes the existing logging policy during configuration before catalog capture, while preserving standalone logger initialization. It does not weaken the catalog environment check. On the combined source, both cases of the original failed remote-catalog file pass (32.203/10.179 seconds), with fresh runtime preparation recorded separately. Core and logging test types, scoped lint, formatting, exact-prerequisite line ratchet and pricing's final 405/400+5 test budget pass.

Earlier repairs are preserved: the abort assertion reproduced locally before repair; 61 cancellation/accounting/authority cases and the affected real CLI case pass. The complete retired/aborted table checks immediate rejection and no redispatch before draining tracked work, then checks lease release. Isolated Codex reviews of pricing and the prerequisite are clean through P2; the conflict-free composition retains those exact reviewed bytes. Prior full changed checks and subsequent focused repairs remain composed evidence, not a claim that the entire command was repeated at this head.

One local gap remains: the canonical research-fixture replay timed out during its five-second service-start phase before disposal; the following portable-documents case passed. The log does not distinguish jobs-module loading from wake-reference recovery. No timeout increase, error suppression or inherited-red waiver is used. New exact-head CI is required before landing.

Regression coverage includes 66 repeated missing-file lookups, captured prices surviving projection eviction, delayed read versus committed writer ordering, concurrent same-agent cold reads, interleaved agent scopes, billed zero, final unknown totals and cache-inclusive estimates. Retirement during the actual pricing await rejects with zero usage logs/diagnostics. Public SDK final-media cases retain their synchronous contract. Earlier qualified consumer, catalog, publisher, benchmark and presentation batches passed; the later BTW ownership/test relocation preserves all assertions. Both unused-file scans passed on their qualified earlier source snapshots.

Earlier local UI browser 4 cases and affected question-guest/post-deploy E2E 7 cases passed with a fresh production UI build; these remain prior-head evidence. The logging prerequisite is directly imported by the usage-sessions owner-attribution E2E file. The combined-source run used a fresh private-QA runtime and production UI build: both owner-attribution cases and the two-point recreation case passed, while the one-point case exposed missing fixture scope setup. Its screenshot showed the page scoped to main although the fixture creates an opus session. The fixture now selects opus through the public picker; both recreation cases pass with every existing assertion preserved. The unchanged owner-attribution pair retains its preceding green proof. UI-E2E types, scoped lint and fresh Codex review are green. This is composed 2+2 case evidence, not a claim of an all-four final-head rerun. Pricing head e3b has ClawSweeper zero findings/open items; the new integration requires final-head review and CI.

Matched owner measurements

Synthetic missing-file pricing, Node 26.12.1, five serial A1/B/A2 rounds of 10,000 warm lookups after 1,000 warmups. Count mode is separate from the counter-free timing mode, which also records exact V8 main-isolate allocation. Baseline owner modules are pinned to incident source 24819901d92ee379b5b36a957276d3b3657d7b79; this is a historical owner comparison, not attribution of unrelated current-main changes. All rows are retained; load1 ranged 33.70–38.38.

Warm 10,000 lookups, median A1 Candidate A2
Wall ms 85.080 4.869 81.891
Main-thread CPU ms 85.073 4.898 81.804
Process CPU ms 101.508 11.266 98.720
Main allocation bytes 49,748,760 17,973,496 49,675,376

Candidate allocation increased from the preceding candidate's 12.99 MB to 17.97 MB after cold-load sharing; this cost is retained. Main-CPU p95/max across five samples: 105.004/8.793/89.456 ms; wall 317.141/8.800/98.479 ms includes a retained A1 scheduling outlier. Counts: 66 warm lstatSync calls → 0 synchronous and 0 asynchronous file calls. Cold: one lstatSync→one async readFile, zero synchronous calls. API counts are not one-to-one kernel syscall counts.

node --expose-gc --import ./scripts/tsx.mjs scripts/perf/usage-cost-source-measure.mjs \
  --owner /path/to/checkout --fixture-root /path/to/scratch --mode counts
node --expose-gc --import ./scripts/tsx.mjs scripts/perf/usage-cost-source-measure.mjs \
  --owner /path/to/checkout --fixture-root /path/to/scratch --mode timing --iterations 10000

Publish the model catalog owner’s local source or absence into the existing pricing projection and retain prepared prices through each operation. Serialize async source reads with the existing writer queue, remove synchronous pricing reads and migrate callers without changing cost precedence.

Regression tests cover repeated absent-file formatting, retained prices after eviction, read/write publication order and consumer readiness. Owner counters show 66 warm lstatSync calls reduced to zero. Preserve the cold async scheduling tradeoff separately from warm timing gains.
@clawsweeper

clawsweeper Bot commented Nov 12, 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 Nov 12, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR prepares usage prices asynchronously and carries captured pricing facts through accounting, status, and session rendering.

Example: A running Gateway performs 66 pricing lookups for an agent without models.json.

  • Before: Missing-file lookups repeatedly enter synchronous filesystem admission on the main thread.
  • After: The first lookup reads asynchronously, and subsequent lookups reuse the owner's recorded absence.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The ownership repair and focused regressions are coherent; evidence remains primarily owner-level and harness-based, with exact-head broad CI unfinished.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the contributor proof gate; owner measurements exercise the pricing source, while reported consumer E2E runs support presentation behavior and the inspected linked screenshots cover an unrelated config-form change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Optional pricing lookups can block the Gateway main thread while formatting usage, status, or session results.
Reason: The source establishes unnecessary synchronous work, and the maintainer-authored direction accepts the documented cold-read tradeoff while retaining existing accounting ownership.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR addresses a synchronous pricing path still present on main, and I found no actionable code defect; exact-head CI remains pending.

Priority: P2
Reviewed head: 6834f3959963e535b629c257396c36ec3abe33ac

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied owner measurements and reported browser E2E runs do not demonstrate a Gateway request during a delayed missing-file pricing lookup.
Agent review details

How this fits together

The model-catalog owner supplies agent-local prices and catalog policy to usage accounting, which produces numeric costs for persistence and synchronous presentation.

flowchart LR
  A[Agent models file] --> B[Catalog owner queue]
  B --> C[Bounded source projection]
  D[Catalog pricing policy] --> E[Captured operation prices]
  C --> E
  E --> F[Usage accounting]
  F --> G[Status and session presentation]
Loading

Technical review

Best possible solution:

Retain asynchronous preparation at the existing catalog owner and pass captured prices or numeric costs through consumers.

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

Current main demonstrably retries synchronous reads for absent models.json files; the body supplies owner-level before/after measurements, and no target code was executed during this review.

Is this the best way to solve the issue?

The change follows the existing ownership boundaries, removes the redundant Gateway price cache and synchronous context getter, and preserves lazy recorded-cost precedence.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Local pricing publication and cache ownership keeps the original intent (7bb6926: Refresh the written agent's prices after catalog publication while preserving other agents and recorded costs.)
  • Synchronous local pricing reads changes intended behavior with a stated reason (dec91c4: Keep status display on synchronous model metadata; this PR explains why filesystem preparation must move ahead of synchronous rendering.)
  • Operation-owned pricing context keeps the original intent (73d1fc7: Bind an operation's fingerprint and model prices to one captured hosted catalog context.)
  • Lazy plugin usage estimation keeps the original intent (72943b0: Resolve fallback prices only when explicit recorded billing does not already settle accounting.)
  • Authored runtime prices and hosted pricing precedence keeps the original intent (c1666b0: Use current hosted rates without replacing authored-provider runtime pricing.)
  • Logging environment initialization keeps the original intent (fix: keep model catalog refresh working after logging starts #197736: Publish logging policy before catalog workers capture their environment, preserving standalone initialization and catalog admission checks.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

PR surface statistics unavailable: the file list is incomplete.

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Repeated optional pricing reads can stall Gateway request handling, but the evidence does not establish an urgent outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 execution lanes are retired.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-11-12T07:49:37.478Z sha baed4a6 :: needs changes before merge. :: [P2] Await pricing results in the remaining catalog-publisher tests
  • reviewed 2026-11-12T08:28:39.038Z sha a090d68 :: needs changes before merge. :: none
  • reviewed 2026-11-12T09:03:20.272Z sha 0002cd1 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-12T09:12:21.318Z sha 1c111a0 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-12T09:46:16.917Z sha be9ab5a :: needs changes before merge. :: none
  • reviewed 2026-11-12T10:07:21.812Z sha 85e20c8 :: needs changes before merge. :: [P2] Share concurrent cold pricing-source loads | [P2] Keep pricing preparation inside the estimation fallback
  • reviewed 2026-11-12T11:26:45.921Z sha 1328278 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-12T12:13:51.014Z sha e3b6b18 :: needs maintainer review before merge. :: none

Reviewed November 12, 2026, 8:50 AM ET / 13:50 UTC (Revision 10).

Preserve hosted-over-bundled and vendor-model pricing from main while retaining authored runtime prices before metadata preparation. Keep raw runtime tier shapes and identity through a narrow overload; ordinary cost lookups retain normalized return types.

Validated 149 affected tests, four Chromium browser cases, seven UI E2E cases, affected typechecks, lint and exact-parent guards. Fresh isolated Codex review is clean; the authored-provider no-preparation regression fails on the intermediate eager capture and passes with the owner repair.
@steipete

Copy link
Copy Markdown
Contributor Author

Addressed the latest review's numbered merge item on baed4a695dd38299d9fba87b6dc6d6b9c6863e6a:

  1. Resolve conflicts and preserve current pricing behavior. Merged main 6f6bf91812cac3521c68b78425c721a91b144415, resolving the three conflicts without replacing the hosted-over-bundled or exact-vendor fixes. The existing async price owner preserves the authored-provider runtime cost before metadata preparation (usage-format.ts:265); model resolution preserves the original model when that cost is retained (model.ts:74). Exact-vendor ownership remains included in pricing fingerprints (pricing.ts:197). The affected pricing and model-resolution batch passed 149 tests across eight files. An added assertion fails for an intermediate eager-preparation resolution and passes on this head (model.test.ts:552). Core and affected test types, lint, exact-parent guards, four UI browser cases and seven affected UI E2E cases pass; fresh isolated Codex review is clean through P2.

The body now distinguishes historical owner measurements from the current main integration and records final controls. The source-owner counter proves 66 warm synchronous calls become zero; it is not represented as a new whole-Gateway trace. The UI E2E evidence exercises the changed session projection consumers with a fresh production UI build.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete marked this pull request as ready for review November 12, 2026 07:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-12T13:46:17.354545Z 6834f39 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 12, 2026
Await catalog publishing price assertions, supply projection owner facts in maintained benchmarks, and wait for actual observer publication. Keep fingerprint tests independent of utility discovery. Align internal and browser fixtures with the WebChat policy introduced by #197544 while preserving terminal and custody assertions.
@steipete

Copy link
Copy Markdown
Contributor Author

Addressed the latest review's open item on a090d68c78796c000659e09a38919639dd1f0b1d:

  1. Await pricing results in the remaining catalog-publisher tests. All three calls now await the async owner before checking their values: line 267, line 274, and line 1162. The publisher file passes all 31 tests. Expected free and unknown prices are unchanged.

This commit also migrates the five maintained benchmark callers, repairs two Gateway fixture assumptions exposed by asynchronous preparation, and aligns three exact-parent failing fixtures with #197544's WebChat policy. No production runtime code changes. Focused tests, script and affected test types, lint, five benchmark smokes, formatting, and line budgets pass. Fresh independent Codex review is clean through P2. The body records the remaining research failure's exact-parent reproduction and the still-unqualified introducing commit without claiming a landing exception.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Preserve the human WebChat heartbeat fixture independently repaired in #197605 and retain all exact benchmark registrations. Async pricing runtime source is unchanged from the reviewed head; focused fixture, Knip, ratchets and Codex integration review pass against db964b7.
@clawsweeper clawsweeper Bot removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 12, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Final head: 13282785dcbdf94fdaa2df6a60bc2034bcd78ad6.

  1. Share concurrent cold pricing-source loads. Pricing-only capture rechecks the existing cost projection inside the models-config owner's existing write queue; the first queued read publishes the fact used by the next request. Fresh catalog captures still read afresh and writer ordering stays unchanged. The interleaved multi-agent regression preserves distinct prices and reduces two same-agent cold reads to one. See the owner queue recheck and interleaved scope regression.

  2. Keep pricing preparation inside the estimation fallback. The shared aggregate decision returns recorded totals, billed zero and final unknowns before optional rates. Plugin completion, turn/diagnostic accounting, status, reply/session formatting, BTW and terminal settlement now consume this decision or carry its numeric result. Cold billed direct/isolated and aggregate regressions fail with one preparation before the fix and pass with zero. The existing requester-retirement cases now pause actual pricing preparation, revoke authority, and prove rejection with zero usage logs or diagnostic publication. The public synchronous estimator, terminal SDK helper and prepared Decision billing branch remain synchronous. See the shared lazy decision, plugin finalizer, retirement proof and terminal settlement owner.

  3. Restore the intent of refactor(runtime): defer unused model pricing lookup #189893. Explicit billed costs already settle accounting, so optional pricing belongs only in the fallback. This intent is preserved for positive totals and zero, including aggregate consumers; adapter zeros without recorded provenance still require known rates, and tiered aggregate unknowns are not reconstructed. The explicit-cost fallback preserves this behavior. No new cache, configuration or schema is introduced.

The body contains the refreshed owner controls and scoped proof. Focused consumer/authority/SDK tests, affected types/lint, line budgets and isolated Codex review are green. Net test growth is 400 within the universal 400 allowance, with no allocation credit. The production growth is explained in the body.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

Integrate pinned CI main and retain its canonical CLI provenance and research disposal fixture. Join the existing async work scope before asserting lease release, and leave post-await authority checks with completion callers. Allocate the exact two test lines above the shared 400-line allowance.
@openclaw-barnacle openclaw-barnacle Bot removed the app: web-ui App: web-ui label Nov 12, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

The latest ClawSweeper review covered 13282785 with zero open items. Successor e3b6b18d073ec21b9f2f0caf31e3a901a05a2990 repairs its CI findings against the exact CI main parent.

  1. The three type/lint failures shared one semantic merge collision: main test: repair hourly CI fixtures for current owner contracts #197621 added the same internal CLI provenance. The fixture now exactly matches main, with one property; its real CLI case passes. The same main change absorbed the research disposal repair, so its single canonical service-stop callback replaces our superseded pre-stop.
  2. The aborted quota test asserted physical lease release immediately after logical cancellation. Its complete two-case table now uses the existing deadline suite's work scope, preserves immediate rejection/no redispatch, drains work, then asserts release once. The original aborted case reproduced red; 61 affected cleanup/accounting/authority cases pass. Optional accounting leaves final authority enforcement with the existing callers and lease owner.
  3. The remote-catalog timeout remains unclassified: unchanged local v1 passes in 63.585 seconds, which is not a fix. The canonical research replay separately timed out during service startup before disposal; the following portable case passed. Both failed attempts remain recorded and new exact-head CI must qualify them. No timeout or runtime policy changed.

Core and affected test types, scoped lint, formatting, exact-parent line budgets and fresh isolated Codex review pass. The final test budget is 402 with exact 2-line credit above 400; production delta is +262 after main absorbed generated output. Prior Claw cold-load and lazy-cost findings remain resolved with unchanged pricing-owner bytes.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 12, 2026
Preserve the exact #197736 prerequisite ancestry and its stable logging policy publication before catalog environment capture. Both remote catalog schema cases pass on the combined pricing tree. Pricing owner, benchmark, and dependency inputs remain unchanged; no default log-target changes are included.
@steipete

Copy link
Copy Markdown
Contributor Author

The latest ClawSweeper review covered pricing head e3b6b18d073ec21b9f2f0caf31e3a901a05a2990 with zero findings and open items. Successor 6834f3959963e535b629c257396c36ec3abe33ac integrates the reviewed prerequisite #197736 at exact e22e72a4d281cf4795191c1797b9dacfb15b8985, without conflicts.

  1. The remaining remote-catalog CI failure is attributed to fix(logging): keep file logging from blocking Gateway requests #197586: lazy logger initialization changed the process environment after catalog capture. The prerequisite establishes the existing policy during logging configuration before catalog admission, retaining standalone initialization and the catalog's environment guard. Both cases of the original failed catalog file pass on the combined pricing source (32.203/10.179 seconds).
  2. Pricing owner, benchmark and dependency-manifest bytes are unchanged. The prerequisite logging files and Gateway bootstrap/kernel match its reviewed source exactly. Core and logging-test types, scoped lint, formatting and exact-prerequisite line/test budgets pass. Pricing remains +262 production/+405 test lines, including exact +5 credit; the prerequisite's +5/+6 is separate.
  3. The affected UI E2E run exposed missing fixture setup: the recreation case creates opus usage while the page was scoped to main. The fixture now selects opus through the public picker (ui/src/e2e/usage-sessions-owner-attribution.e2e.test.ts:491–493), preserving all assertions. Both recreation cases pass; the unchanged owner-attribution pair retains its preceding green proof. UI-E2E types, scoped lint and fresh Codex review pass.
  4. The canonical research service-start timeout remains an unresolved local attempt. No timeout increase, suppression or inherited-red waiver is used. Earlier pricing cold-read sharing, lazy recorded-cost decisions, operation-owned price facts and post-await authority regressions remain covered. Prerequisite fix: keep model catalog refresh working after logging starts #197736 passed exact-head CI and merged as 7910cd62c6ca2f8a5099298dd6de84be87d55739; logging and bootstrap source inclusion in main is verified. Final-head CI and Claw review remain required before landing.

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot added the app: web-ui App: web-ui label Nov 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. label Nov 12, 2026
@steipete
steipete merged commit 0ac0df3 into main Nov 12, 2026
166 of 169 checks passed
@steipete
steipete deleted the fix/usage-pricing-async-source branch November 12, 2026 14:23
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Nov 12, 2026
…plugin-reload-runtime-20261112

* commit '5d6a026e43757ea6302e4c1151d6ace28468ced0':
  fix(logging): avoid main-thread stalls when resolving default log files (#197742)
  fix(sessions): commit selected invitations with original messages (#184512)
  improve: make Telegram tool progress easier to scan (#197523)
  fix(test): keep queued Stop cleanup on real timers (#197734)
  fix: keep usage pricing from blocking the Gateway on filesystem lookups (#197599)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 13, 2026
…ps (openclaw#197599)

* fix: prepare usage pricing before synchronous consumers

Publish the model catalog owner’s local source or absence into the existing pricing projection and retain prepared prices through each operation. Serialize async source reads with the existing writer queue, remove synchronous pricing reads and migrate callers without changing cost precedence.

Regression tests cover repeated absent-file formatting, retained prices after eviction, read/write publication order and consumer readiness. Owner counters show 66 warm lstatSync calls reduced to zero. Preserve the cold async scheduling tradeoff separately from warm timing gains.

* test: complete async pricing consumer migration

Await catalog publishing price assertions, supply projection owner facts in maintained benchmarks, and wait for actual observer publication. Keep fingerprint tests independent of utility discovery. Align internal and browser fixtures with the WebChat policy introduced by openclaw#197544 while preserving terminal and custody assertions.

* test: remove superseded usage pricing line allocation

* test: stop provider services before research fixture retirement

* fix(gateway): regenerate inherited config hint validator

* fix(usage): preserve lazy pricing and share cold source reads

* fix(logging): keep catalog refresh working after logging starts

* test(usage): select the recreation fixture agent explicitly
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 17, 2026
…xtures

doctor-schema-migrations.recipient-authority built "upstream 41" from the
current schema minus authority, which now also carries upstream's 42 tool
usage: a 41 no build wrote, so the bridge refused it before the backup.
Strip tool usage for upstream's 41, add upstream's own 42, and expect 43.

status.continuation's readiness case expected buildStatusMessage to price
the turn from config. Upstream openclaw#197599 moved the estimate to the caller
(estimatedCostUsd) and migrated its own status tests the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Nov 19, 2026
… status fixtures

Carried to the pure candidate (stage 2) from the chain's a71cde4 and
the status half of 2eb8f17, renumbered for 44.

agent-create.retained-schema fabricates upstream's 41 from a current
store by dropping 42's tool usage and 43's pending inputs, then expects
43. The pure candidate's current store also carries recipient authority
(44), which upstream's 41 never had. Drop that table too, so Doctor's
migration creates it, and expect 44. Red at f8ee3d2: 2 of 3
("expected { user_version: 44 } to deeply equal { user_version: 43 }").

status.continuation's readiness case expected buildStatusMessage to
price the turn from config. Upstream openclaw#197599 moved the estimate to the
caller (estimatedCostUsd) and migrated its own status tests the same
way. Red at f8ee3d2: 1 of 6 ("Cost: $0.0020" missing).

The other half of 2eb8f17 (Doctor's recipient-authority shapes) and
a71cde4's session-tombstone-recovery pin are not carried: 0ffb153
already takes Doctor to 44 over upstream's 37-43, and the tombstone suite
does not exist on the pure tree.

Refs openclaw#129388

Co-Authored-By: Claude Opus 5.5 <[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 app: web-ui App: web-ui clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. 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.

1 participant