Skip to content

fix: usage dashboard fails on legacy global sessions - #129011

Merged
roboclaw-bot merged 1 commit into
mainfrom
fix/usage-agent-scope
Aug 25, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
fix/usage-agent-scope

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes an issue where users opening the Usage dashboard would see AGENT_SELECTION_REQUIRED instead of usage data when multiple agents use explicit ownership and the selected agent's store contains a legacy global session row.

Why This Change Was Made

The Usage Gateway handler already loads the explicitly selected agent's store, but its secondary row filter attempted to infer an ambient owner for global. Explicit-ownership fleets have no ambient default, so that second inference rejected an already-owned row.

The canonical owner-boundary repair retains the logical global row inside the already agent-scoped store. Owner checks remain unchanged for every non-global key, including agent-prefixed rows from another agent.

User Impact

The Usage dashboard loads normally for the selected agent on multi-agent installations that still have a legacy global session.

Evidence

  • Symptom reproduction: the strengthened regression fails before the fix with the reported AgentSelectionRequiredError at filterSessionStoreByAgent.
  • Focused proof: pnpm test src/gateway/server-methods/usage.sessions-usage.test.ts src/gateway/server-methods/usage.test.ts src/gateway/server-methods/usage.sessions-usage-cache.test.ts src/gateway/server-methods/usage.cost-usage-cache.test.ts — 80 tests passed.
  • Repository gate: pnpm check:changed passed after rebasing onto the published head, including formatting, lint, core typecheck, and core-test typecheck.
  • Independent review: fresh autoreview reported no accepted/actionable findings.
  • Production LOC: +1/-1 (net 0). Tests: +4/-3.
  • Sibling safety: the existing out-of-scope session-id test remains green, proving that non-global rows still cannot cross the requested agent boundary.

Live-proof gap

The original operator screenshot demonstrates the failing Usage surface. No after-fix screenshot was captured from the shared team Gateway because replacing that live service with an unmerged branch would disrupt unrelated sessions. The exact rejected Gateway handler path is instead covered by the failing-before/passing-after owner-boundary regression and exact-head hosted CI/Testbox remains mandatory for landing.

@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS maintainer Maintainer-authored PR labels Aug 25, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Land-ready verification

  • Exact source head: d268661fb1f3b21a8e90b2d07fd8e1509c25672e
  • Root cause: sessions.usage selected the requested agent store, then its secondary filter tried to infer ambient ownership for that store's legacy global row.
  • Canonical fix: retain only the logical global row inside the already selected store; non-global ownership filtering remains unchanged.
  • Production LOC: +1/-1 (net 0). Tests: +4/-3.
  • Focused proof: pnpm test src/gateway/server-methods/usage.sessions-usage.test.ts src/gateway/server-methods/usage.test.ts src/gateway/server-methods/usage.sessions-usage-cache.test.ts src/gateway/server-methods/usage.cost-usage-cache.test.ts — 80/80 passed.
  • Repository gate: pnpm check:changed passed after the publication rebase.
  • Fresh autoreview: clean, no accepted/actionable findings.
  • Exact-head hosted CI: run 32809896605 completed green for the source head.
  • Native landing preparation: OPENCLAW_TESTBOX=1 scripts/pr prepare-run 129011 passed in hosted_exact_or_recent_parent mode with the exact source and prep head unchanged.
  • ClawSweeper: exact review run 32809903032 completed successfully; patch correct (0.94), zero findings, security cleared. Its exact-head-check rank-up move is complete.

Known proof gap: no after-fix dashboard screenshot was captured because replacing the shared team Gateway with an unmerged branch would disrupt unrelated sessions. The original screenshot shows the symptom; the exact rejected handler path is covered by the failing-before/passing-after regression. The optional redacted dashboard-fixture rank-up is therefore skipped for this landing.

@roboclaw-bot
roboclaw-bot merged commit ebc70fa into main Aug 25, 2026
240 checks passed
@roboclaw-bot
roboclaw-bot deleted the fix/usage-agent-scope branch August 25, 2026 04:57
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant