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: blocked before merge. What this changesThis PR limits the Model Providers cost request to one detailed session row while retaining complete provider aggregates. Example: Opening Models with Anthropic usage totaling $4.20 across nine sessions.
Review scores
ProductKind: Performance · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open for maintainer disposition: main has replaced the expensive detailed request with a compact overview, substantially reducing this PR’s remaining value, and GitHub reports a merge conflict. Priority: P3 Decision needed
Before merge
FindingsNone. Agent review detailsHow this fits togetherThe Models cost loader sends a date-scoped sessions.usage request through the shared UI helper and displays the Gateway’s provider aggregates; current main instead requests its compact overview projection. flowchart LR
A[Models page] --> B[Cost loader]
B --> C[Shared usage request]
C --> D[Gateway usage owner]
D --> E[Complete provider aggregates]
D --> F[Bounded session rows]
E --> A
Technical reviewBest possible solution: Have the assignee retire the overlapping optimization or sponsor a focused follow-up through the current overview owner. Do we have a high-confidence way to reproduce the issue? Source inspection disproves the original 1,000-detail-row trigger on current main: Models now requests a compact 50-row overview; no target code was executed. Is this the best way to solve the issue? The patch correctly trims the original legacy response, but preserving main’s overview requires a different implementation because the server overrides its row limit. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f585b0421821. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2, Tests +28. Total +30 across 4 files. Added test files: 0. View PR surface stats
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:
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 (9 earlier review cycles; latest 8 shown)
Reviewed October 18, 2026, 7:13 AM ET / 11:13 UTC (Revision 10). |
9150cc8 to
20038d5
Compare
20038d5 to
e64bbc2
Compare
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Still needed: checked current main at 182f79b. |
The Model Providers cost card only reads sessions.usage's aggregates.byProvider, but requestSessionUsage defaulted to limit:1000 for its aggregate-only caller. The Gateway aggregates every matched session row before applying limit (src/gateway/server-methods/usage.ts), so the detailed 1000-row page was serialized and discarded on every load, starving the Gateway HTTP path with multi-MB responses. Add an optional limit to requestSessionUsage's options (used only for the no-key/aggregate path; the shared Usage page keeps its detailed 1000-row default) and pass limit:1 from loadModelProviderCost — the smallest legal value per the sessions.usage schema minimum. Refs openclaw#127245
e64bbc2 to
5181050
Compare
|
Rebased onto current
Local results on the rebased head:
Exact-head CI: 52 passed, 31 skipped, 0 failed; |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Fresh stale review against main 147975c: this remains necessary. loadModelProviderCost still supplies no limit and reads only aggregates.byProvider; requestSessionUsage still sets limit:1000 for no-key calls (ui/src/pages/model-providers/load.ts:119-129; ui/src/lib/sessions/usage.ts:50). Current PR head remains 5181050, and its checks now show 53 success / 30 skipped / zero failed; the earlier exact-head tests and screenshot evidence remain in the thread. The patch is not absorbed upstream and there is no new contributor-facing code finding in the review. @vyctorbrzezowski, this assigned stale item is still wanted; please retain it for your maintainer review. No CI rerun or main-only rebase was requested. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Author update, 2026-10-11: this small optimization is still absent from main The PR is unchanged at @vyctorbrzezowski, this assigned PR is still wanted for #127245. Could you retain it for maintainer review rather than stale closure? The remaining tradeoff is unchanged: limit detailed rows, not the scan needed to compute complete aggregates. |
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
Author disposition following the October 18 review: @vyctorbrzezowski, I am withdrawing this now-obsolete implementation rather than rebasing it over #169660's merged compact-overview owner. I have reconciled #127245 and updated this PR's description, preserving the original contribution and before/after proof. At inspected main |
Author disposition — October 21, 2026
Withdrawing this obsolete implementation in favor of the merged compact-overview owner in #169660 (
7aae49e8677b18ca992b72a49221e1b6de4b45e4). This is not a claim that this PR merged or that all Models-page performance work is finished.Fresh source inspection at main
f91bca9546f5confirms:projection: "overview", replacing the original 1,000 detailed-row request.limit: 1to that path would have no effect.The paired report #127245 has been updated to distinguish the superseded request path from remaining live latency validation. #174904 is still open; its prospective consumer removal is not being treated as a merged fix. The original contribution, screenshots, and historical before/after proof below are preserved.
Historical implementation and proof (prior to the compact-overview cutover)
What Problem This Solves
The Model Providers cost card (
ui/src/pages/model-providers/load.tsloadModelProviderCost) only readsresult.aggregates.byProviderfromsessions.usage, butbuildSessionUsageParamsinui/src/lib/sessions/usage.tsdefaulted every no-key caller — including this aggregate-only one — tolimit: 1000. The Gateway'ssessions.usagehandler (src/gateway/server-methods/usage.ts) aggregates every matched session row before applyinglimit: the accumulator runs unconditionally, whilelimitonly bounds detailedsessions[]rows. Every Model Providers page load therefore serialized and transmitted up to 1000 rows that the caller immediately discarded. This is the remaining defect from #127245 after main already disabled context weight and added the route-data guard.Why This Change Was Made
SessionUsageQuerynow accepts the existing protocol's optionallimit, and the Model Providers cost query sets it to1, the smallest value allowed bypackages/gateway-protocol/src/schema/sessions.ts. The shared Usage page omits this field and keeps its existinglimit: 1000default. This reuses the current Gateway contract; no protocol, configuration, persistence, or dependency surface changes.User Impact
The Models settings page no longer asks the Gateway to return up to 1000 detailed session rows merely to read provider aggregates. The provider totals stay complete, while detailed response construction, serialization, and transfer are reduced to one row. The Usage page's detailed session list is unaffected.
Evidence
Current revision (October 4 status refresh)
The current head is
51810507a0c49d299973ec4b8e551c17946f384b, adapted to the inlinedrequestSessionUsageowner on base82949354d73c. The September 30 author update records 28/28 loader/helper tests, 543/543 page tests, 12/12 progressive UI E2E cases and the changed-file gate passing on that rebased head; no new test run was made for this status refresh. Current GitHub checks are 53 success / 30 skipped / zero failed. The screenshots below retain their original source provenance and are prior-build visual evidence, not screenshots of this rebased head.Fresh source inspection of main
147975c6c41dconfirms the optimization is still absent:loadModelProviderCostreads onlyaggregates.byProvider, but its no-key call still requests 1,000 detailed rows. Existing maintainer review remains the next action; no CI rerun was requested merely to refresh status.Built Control UI against a mock Gateway
Two independent production Control UI builds were served through the repository's Control UI E2E harness: the PR's main base (
cd8c74889d21) and exact PR head (20038d5ac3e3). Each build was exercised separately in Chromium at desktop (1440x1000) and mobile (390x844). All four uploaded files have distinct MD5s and source-SHA provenance. Each viewport made exactly onesessions.usagerequest and rendered Anthropic at$4.20/1.5M tokens · 9 sessionsand OpenAI JSON at$2.50/750k tokens · 5 sessions. The mobile viewport is scrolled so both aggregates are in frame.Main production build — desktop 1440
Source:
cd8c74889d21ddcc9f3a2d47fe868224a0e44acb(also visible in the build footer). Rendered cost:$4.20.In this PR — desktop 1440
Source:
20038d5ac3e3ef7b2f574cf90dcff2afeb8db86c(also visible in the build footer). Rendered cost:$4.20.Main production build — mobile 390
Source:
cd8c74889d21ddcc9f3a2d47fe868224a0e44acb. The scrolled frame visibly renders Anthropic$4.20and OpenAI JSON$2.50.In this PR — mobile 390
Source:
20038d5ac3e3ef7b2f574cf90dcff2afeb8db86c. The scrolled frame visibly renders Anthropic$4.20and OpenAI JSON$2.50.The progressive E2E now asserts this request shape while covering cold, prewarmed, and cached navigation; all three modes pass.
Regression and repository checks
The loader regression was first run with the production fix removed. It failed at the owner boundary as intended: expected
limit: 1, receivedlimit: 1000(1 failed, 12 passed). After restoring the fix:node scripts/run-vitest.mjs ui/src/pages/model-providers/load.test.ts ui/src/lib/sessions/usage.test.ts→ 2 files, 19 tests passednode scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/model-providers-progressive.e2e.test.ts→ 3 tests passed; production UI built and servedOPENCLAW_VITEST_MAX_WORKERS=2 pnpm check:changed→ exit 0 (format, translations, UI/core typecheck, lint, dead-code and repository guards)Live Gateway payload comparison
The contributor's read-only live Gateway comparison used the same 30-day aggregate query issued by Model Providers:
Because that live window was actively accruing sessions, a closed historical window (
2026-06-01through2026-06-28) isolated the limit variable:sessions[]lengthaggregates.byProviderdiffclean)This agrees with the Gateway owner: it aggregates before limiting detailed rows.
Prior CI failure classification
The prior-head run 33637688946 failed from runner infrastructure, not this change: five jobs lost the checkout fetch with
fetch-pack: unexpected disconnect, and 17 self-hosted jobs lost runner communication in the same minute. No source or test assertion failed; the gate failure was derivative. This branch has since been rebased onto current main to trigger exact-head CI.Fresh exact-head CI run 33822741510 completed with 122 successful and 13 intentionally skipped jobs. All three UI suites, all 12 Control UI E2E shards, the real-Gateway UI lane, UI performance, and UI i18n passed. Three unrelated prerequisites failed, plus the derivative aggregate gate:
security-fast: the external bulk advisory request exceeded its 60-second timeout. The exact command reproduced the same network timeout twice locally; it reported no dependency advisory.extensions/browser/chrome-extension/bootstrap.chromium.test.ts.src/gateway/local-request-context.session-tools.test.ts“unchanged” case hit its 120-second test timeout after 2,552 sibling tests passed.None intersects this PR's four-file UI diff. That historical head did not have a green aggregate gate; the current-head status is recorded above.
Diff size
Production LOC:
+3/-1(net+2); tests:+29/-1. The two net production lines are the optional query field and its caller value. No new helper or parallel request path was added.Risk and coverage
limit, so the helper's existing1000default and existing request-shape test remain unchanged.Provenance
In this PR, @Grynn reported #127245 and authored the original fix. The maintainer follow-up preserves that contributor commit and authorship, rebases it onto main, removes duplicate implementation-coupled tests, and adds loader-boundary plus built-Control-UI coverage.
Refs #127245