fix(ui): scope usage requests by agent filter - #87222
Conversation
|
Codex review: needs changes before merge. Reviewed May 28, 2026, 8:57 PM ET / 00:57 UTC. Summary PR surface: Source +277, Tests +484, Docs +2, Other +4. Total +767 across 17 files. Reproducibility: yes. from source: current main's UI never sends Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Copy recommended automerge instructionNext step before merge
Security Review findings
Review detailsBest possible solution: Land one canonical fix that scopes selected-agent fallback data consistently, keeps the protocol/docs/generated clients aligned, and has maintainer acceptance for the all-agent default before closing the linked issue and superseding sibling PRs. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main's UI never sends Is this the best way to solve the issue? No, not quite yet: the main current-gateway path is a maintainable fix, but selected-agent legacy fallback still needs aggregates and daily chart data scoped to the selected agent. The all-agent default also needs maintainer acceptance as an intentional compatibility/security-boundary change. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 8bd4736f03bc. Label changesLabel justifications:
Evidence reviewedPR surface: Source +277, Tests +484, Docs +2, Other +4. Total +767 across 17 files. View PR surface stats
Security concerns:
Acceptance criteria:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
@clawsweeper re-review Current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Updated head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Updated head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
This comment was marked as spam.
This comment was marked as spam.
|
Maintainer review/proof request: Current head I do not have a real multi-agent browser/gateway setup available to produce stronger live proof from my side. If a maintainer can run or record that verification, or is comfortable accepting the focused UI controller/rendering + gateway handler/cache coverage already in this PR, could you review this PR or apply a proof override? I will avoid adding more commits unless there is a concrete code or proof issue to address. |
4bea777 to
900637a
Compare
900637a to
aacdb12
Compare
aacdb12 to
d67156a
Compare
|
Ready to land. Verification:
Known proof gap: no live browser session against a multi-agent gateway; covered here by focused UI/controller tests plus gateway aggregation tests. |
Fixes #87132.
Summary
agentScope: "all", while selected agents still useagentIdusage.costsummaries across configured agents and keep scoped cache entries separateagentIdandagentScope, with generated protocol/docs updatesVerification
node scripts/run-vitest.mjs ui/src/ui/controllers/usage.node.test.ts ui/src/ui/app-render-usage-tab.test.ts ui/src/ui/views/usage.test.ts --reporter=dot(18 tests passed)node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway-methods.config.ts src/gateway/server-methods/usage.test.ts src/gateway/server-methods/usage.cost-usage-cache.test.ts src/gateway/server-methods/usage.sessions-usage.test.ts --reporter=dot(34 tests passed)pnpm check:test-typespnpm protocol:checknode scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/gateway/protocol/schema/sessions.ts src/gateway/server-methods/usage.ts src/gateway/server-methods/usage.test.ts src/gateway/server-methods/usage.cost-usage-cache.test.ts src/gateway/server-methods/usage.sessions-usage.test.ts ui/src/ui/controllers/usage.ts ui/src/ui/controllers/usage.node.test.ts ui/src/ui/app.ts ui/src/ui/app-view-state.ts ui/src/ui/app-render-usage-tab.ts ui/src/ui/app-render-usage-tab.test.ts ui/src/ui/views/usage.ts ui/src/ui/views/usage.test.ts ui/src/ui/views/usageTypes.tsgit diff --check.agents/skills/autoreview/scripts/autoreview --mode commit --commit d67156a3c5 --thinking low --no-web-searchReal behavior proof
Behavior addressed: The Usage page needed a real agent scope, not a query-string side effect. Default Usage now asks the gateway for all configured agents, selected agents use
agentId, and the gateway can aggregate all-agent cost totals instead of silently falling back to the default agent.Real environment tested: Local OpenClaw checkout on branch
pr-87222, using the Control UI usage tests, gateway usage method tests, generated gateway protocol check, and test typecheck.Exact steps or command run after this patch: Ran the verification commands listed above after the final fixup commit.
Evidence after fix: UI usage tests passed 18/18, gateway usage tests passed 34/34,
pnpm check:test-typespassed,pnpm protocol:checkpassed with generated Swift protocol output staged, targeted oxlint returned success,git diff --checkreturned clean, and the narrowed autoreview reported no accepted/actionable findings on the Swift compatibility fix.Observed result after fix: With no selected agent, the UI sends
agentScope: "all"tosessions.usageandusage.cost. With a selected agent, both requests send thatagentId. The gateway lists sessions across configured agents for explicit all-agent scope, rejects conflicting all-agent plus specific-agent/key requests, aggregates cost totals by date across configured agents, and keeps cost cache entries separated by all/default/specific-agent scope.What was not tested: I did not run a live browser against a multi-agent gateway. A local
pnpm buildattempt was stopped aftertsdownstayed quiet for about 15 minutes; CI will cover the full build lane. A Testboxpnpm check:changedrun exited255without actionable logs.