Repository navigation
refactor: separate usage pricing preparation from formatting - #203043
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 changesMoves pricing preparation into the model-catalog owner, migrates consumers and tests, and keeps formatting and arithmetic separate. Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR implements the linked ownership plan, and source review found no actionable correctness or security defect. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherUsage accounting prepares rates from agent-local, configured, and catalog sources, then passes numeric cost facts to session accounting and status or CLI formatting. flowchart LR
A[Config and catalog sources] --> B[Model catalog pricing preparation]
B --> C[Usage accounting]
C --> D[Cost formatting]
F[Token formatter] --> D
D --> E[Status and CLI output]
Technical reviewBest possible solution: Complete the existing ownership split with unchanged pricing contracts and successful focused validation. Do we have a high-confidence way to reproduce the issue? This PR addresses an internal module boundary rather than a runtime failure; source inspection confirms that current main still combines the responsibilities. Is this the best way to solve the issue? The move uses existing model-catalog, token-formatting, and status-formatting owners, removes superseded exports, and preserves the implementations without parallel machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b7645726f23a. Provenance checked
TestingProof path: none. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -13, Tests +11, Other -1. Total -3 across 40 files. Added test files: 1. 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. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed November 21, 2026, 5:25 AM ET / 10:25 UTC. |
|
Merged via squash.
|
…3044 * origin/main: refactor(test): remove duplicate token startup wait case (#203087) fix: keep Plugin SDK declarations within the build limit fix(ci): remove unused hook type exports (#203074) fix(test): exercise the sign-in callback path guard (#203075) refactor(tts): separate caption eligibility from text helpers (#203068) test: reuse worker preload options (#203058) refactor(test): share Bun native-policy test launcher (#203064) fix(cron): a chat-created automation's failure notice reaches that chat (#203056) refactor(test): remove duplicate claw origin rejection case (#203067) refactor(channels): move chunk-mode lookup to streaming readers (#203047) refactor: separate skill queries from workspace discovery (#203045) fix: resume new chat turns in retained tasks after a restart refactor: separate usage pricing preparation from formatting (#203043) fix: avoid repeated filesystem probes before agent turns (#203057) perf(agents): preserve sealed history during endpoint compaction (#203037) fix(test): give deferred identity fixtures read scope (#203053) refactor(test): remove redundant channel catalog facade (#203052) refactor(cli): isolate daemon port presentation (#203020) refactor(cron): isolate CLI input parsing (#203031)
* feat: open shared sessions in their source Control UI * feat: open shared sessions in their source Control UI OpenClaw-Publication: a3826b6b-5899-8ff2-a1b5-84961c64219f * Merge remote-tracking branch 'origin/main' into land/open-original-203044 * origin/main: fix(ci): decouple boundary fixture from timing inventory (#203026) fix(ci): shard capable compatibility UI targets (#203042) perf(agents): restore selected subagent payloads once (#203039) fix: keep standalone context from completing QA tool steps perf(sessions): reuse sealed ownership for context projections (#203040) refactor(hooks): separate event predicates from hook registry (#203017) fix(ci): align update export audits with their consumers (#203030) fix: keep cold baseline checks within the existing heap limit * fix(session-share): accept the runtime config snapshot in the source link resolver The stored-session link resolver took a mutable config, so the plugin's readonly runtime snapshot failed production and test typechecks. Accept the snapshot type. Document the real Open original setup: allow the link command on the receiver Gateway, set the source Control UI origin, reinstall the source node with all three commands, then approve the widened surface. Move the section ahead of Security boundary and add a troubleshooting entry. Assert through the Gateway catalog list that a provider-supplied link survives streamed and final rows, and drop the menu unit test the browser fixture covers. * Merge remote-tracking branch 'origin/main' into land/open-original-203044 * origin/main: refactor(test): remove duplicate token startup wait case (#203087) fix: keep Plugin SDK declarations within the build limit fix(ci): remove unused hook type exports (#203074) fix(test): exercise the sign-in callback path guard (#203075) refactor(tts): separate caption eligibility from text helpers (#203068) test: reuse worker preload options (#203058) refactor(test): share Bun native-policy test launcher (#203064) fix(cron): a chat-created automation's failure notice reaches that chat (#203056) refactor(test): remove duplicate claw origin rejection case (#203067) refactor(channels): move chunk-mode lookup to streaming readers (#203047) refactor: separate skill queries from workspace discovery (#203045) fix: resume new chat turns in retained tasks after a restart refactor: separate usage pricing preparation from formatting (#203043) fix: avoid repeated filesystem probes before agent turns (#203057) perf(agents): preserve sealed history during endpoint compaction (#203037) fix(test): give deferred identity fixtures read scope (#203053) refactor(test): remove redundant channel catalog facade (#203052) refactor(cli): isolate daemon port presentation (#203020) refactor(cron): isolate CLI input parsing (#203031) * chore(plugin-sdk): record the approved session-discussion surface growth Open original adds two exports to openclaw/plugin-sdk/session-discussion: the stored-session Control UI path resolver and the session path parser. Raise the public export and callable budgets by two for them. Use neutral fixtures for the rejected-origin and rejected-query URL tests so the fixtures do not resemble credentials; the same rejections are covered. Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: vincentkoc <[email protected]>
- status-message: the fork moved formatVoiceModeLine out (line cap) and upstream openclaw#203043 moved formatEstimatedContextBudgetTokens out; together they took the last reader of the SessionEntry type import (TS6133). - followup-runner.test: upstream openclaw#202997/openclaw#203029 replaced the createSettledExecution fixture with createExecution("settled" default); the fork's suppressed-delivery ordering case follows (TS2552). No behavior change. Refs openclaw#129388 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…w#203043) * refactor(usage): move pricing resolution to model catalog * fix(usage): erase the pricing snapshot type import
* feat: open shared sessions in their source Control UI * feat: open shared sessions in their source Control UI OpenClaw-Publication: a3826b6b-5899-8ff2-a1b5-84961c64219f * Merge remote-tracking branch 'origin/main' into land/open-original-203044 * origin/main: fix(ci): decouple boundary fixture from timing inventory (openclaw#203026) fix(ci): shard capable compatibility UI targets (openclaw#203042) perf(agents): restore selected subagent payloads once (openclaw#203039) fix: keep standalone context from completing QA tool steps perf(sessions): reuse sealed ownership for context projections (openclaw#203040) refactor(hooks): separate event predicates from hook registry (openclaw#203017) fix(ci): align update export audits with their consumers (openclaw#203030) fix: keep cold baseline checks within the existing heap limit * fix(session-share): accept the runtime config snapshot in the source link resolver The stored-session link resolver took a mutable config, so the plugin's readonly runtime snapshot failed production and test typechecks. Accept the snapshot type. Document the real Open original setup: allow the link command on the receiver Gateway, set the source Control UI origin, reinstall the source node with all three commands, then approve the widened surface. Move the section ahead of Security boundary and add a troubleshooting entry. Assert through the Gateway catalog list that a provider-supplied link survives streamed and final rows, and drop the menu unit test the browser fixture covers. * Merge remote-tracking branch 'origin/main' into land/open-original-203044 * origin/main: refactor(test): remove duplicate token startup wait case (openclaw#203087) fix: keep Plugin SDK declarations within the build limit fix(ci): remove unused hook type exports (openclaw#203074) fix(test): exercise the sign-in callback path guard (openclaw#203075) refactor(tts): separate caption eligibility from text helpers (openclaw#203068) test: reuse worker preload options (openclaw#203058) refactor(test): share Bun native-policy test launcher (openclaw#203064) fix(cron): a chat-created automation's failure notice reaches that chat (openclaw#203056) refactor(test): remove duplicate claw origin rejection case (openclaw#203067) refactor(channels): move chunk-mode lookup to streaming readers (openclaw#203047) refactor: separate skill queries from workspace discovery (openclaw#203045) fix: resume new chat turns in retained tasks after a restart refactor: separate usage pricing preparation from formatting (openclaw#203043) fix: avoid repeated filesystem probes before agent turns (openclaw#203057) perf(agents): preserve sealed history during endpoint compaction (openclaw#203037) fix(test): give deferred identity fixtures read scope (openclaw#203053) refactor(test): remove redundant channel catalog facade (openclaw#203052) refactor(cli): isolate daemon port presentation (openclaw#203020) refactor(cron): isolate CLI input parsing (openclaw#203031) * chore(plugin-sdk): record the approved session-discussion surface growth Open original adds two exports to openclaw/plugin-sdk/session-discussion: the stored-session Control UI path resolver and the session path parser. Raise the public export and callable budgets by two for them. Use neutral fixtures for the rejected-origin and rejected-query URL tests so the fixtures do not resemble credentials; the same rejections are covered. Co-authored-by: Vincent Koc <[email protected]> Co-authored-by: vincentkoc <[email protected]>
Fixes #202999
What Problem This Solves
Developers changing usage formatting currently share a module with model-catalog preparation and pricing caches. Token-only callers also reach that stateful module through a redundant forwarding export.
User Impact
No user-visible change. Pricing precedence, cache identity, zero/partial/tier pricing, and the existing public cost-config type remain unchanged.
Why This Change Was Made
Move pricing preparation into the model-catalog owner, keep formatting and cost arithmetic separate, and migrate every pricing consumer. Route seven token-only callers directly to the existing formatter and remove the superseded exports. Move pricing tests with their filesystem setup while retaining pure formatting tests. The context-estimate formatter also moves unchanged to its existing status-formatting owner.
Evidence
The 17-suite run passed 252 tests with one existing Windows-only skip. Core and seven test type graphs and the assertion check passed. Initial typed lint found one residual runtime import for a type-only dependency; the correction passed all 13 affected usage-line tests and that file’s typed lint. Other source and dependency inputs were verified unchanged before reusing the prior-head checks.
Normal hooks and formatting passed. A fresh review of the complete corrected 40-file range found no actionable defects. Current-head CI and its required gate passed, including
build:ci-artifactsand the mandatory sealed-worker file/import checks.