Skip to content

fix(usage): preserve the selected session owner in details - #143457

Merged
steipete merged 1 commit into
mainfrom
codex/fix-usage-detail-agent-owner
Sep 9, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-usage-detail-agent-owner

Conversation

@steipete

@steipete steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where users opening a session in the All-agent Usage view would see missing-owner errors instead of its timeline and conversation when the session used a raw key such as global. An overview refresh could also keep details from the previous agent when another agent acquired that same raw key.

Why This Change Was Made

The detail controller now carries the selected session's key and agent through requests, retained results, and recovery. Raw keys send their owner to the existing Gateway resolver. Qualified keys keep their existing key-only routing, including system sessions outside the configured roster. Automatic refresh retains matching details and replaces them when ownership changes; manual refresh still refreshes all details.

Both Gateway detail methods share key validation and owner resolution, and a single-use context-weight forwarding helper is removed. Existing authorization, key bytes, selection behavior, and storage semantics are preserved.

User Impact

Users can inspect the correct timeline, conversation, and available context weight for the selected agent's session, including system sessions. Stale responses cannot replace a successor owner's details.

Evidence

The original Gateway regression and three mounted UI regressions fail on the original production code. A separate system-session control proves why qualified requests must remain key-only. The final owner and sibling suites pass 94 distinct cases across six files, and all 32 selected validation stages pass. Independent review found no actionable issues through P2.

The before/after images use the same synthetic session and mock Gateway response policy in a source-built Control UI. Before, actual key-only detail requests produce missing-owner errors; after, the emitted owner-aware requests render the timeline and conversation. This is isolated browser and Gateway fixture proof, without live operator data. All full images were inspected before upload.

Before: selected session details fail with a missing owner

After: the selected session timeline loads

After: the selected session conversation loads

@clawsweeper

clawsweeper Bot commented Sep 9, 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 app: web-ui App: web-ui gateway Gateway runtime size: M maintainer Maintainer-authored PR labels Sep 9, 2026
@steipete
steipete marked this pull request as ready for review September 9, 2026 23:01
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 9, 2026
@clawsweeper

clawsweeper Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 9, 2026, 7:24 PM ET / 23:24 UTC (Revision 2).

ClawSweeper review

What this changes

The Usage dashboard carries the selected session’s agent into detail requests and replaces retained details when an overview refresh changes that owner.

Merge readiness

✅ Ready for maintainer review

This repair remains necessary on current main. The reviewed patch preserves qualified-key routing and fences replaced-owner responses; no actionable correctness or security finding was identified.

Priority: P2
Reviewed head: 495de05d3b2aa02108ed5b14b182ae91e34e47ad

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-lifecycle repair with useful visible fixture evidence and regression coverage, with no blocking finding.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The supplied repository metadata identifies maintainer-authored work, exempt from the ordinary external-contributor gate. Inspected screenshots demonstrate the selected raw-key timeline and conversation in the declared source-built mock-Gateway setup; Gateway and stale-response regressions provide supplemental coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied repository metadata identifies maintainer-authored work, exempt from the ordinary external-contributor gate. Inspected screenshots demonstrate the selected raw-key timeline and conversation in the declared source-built mock-Gateway setup; Gateway and stale-response regressions provide supplemental coverage.
Evidence reviewed 8 items Current main still needs the repair: The fetched main revision resolves detail ownership using only the key, while the UI retains detail identity by sessionKey alone. Both mechanisms described by the PR remain present.
Latest supplied release retains key-only resolution: The v2026.9.3 source also calls the detail owner resolver without an explicit agent hint; the requested repair is not present in that release.
Owner identity and stale-response fencing: The controller compares key plus agent, clears data when the target changes, and checks target identity before recovery. The existing request owner rejects completions from superseded requests. Qualified keys omit the wire hint while retaining local owner identity.
Findings None None.
Security None None.

How this fits together

The Usage dashboard turns Gateway session summaries into timelines, conversation logs, and context details. The selected key and agent identify which existing session store supplies those details.

flowchart LR
  A[Usage overview rows] --> B[Selected key and agent]
  B --> C{Qualified session key?}
  C -->|Yes| D[Key-only request]
  C -->|No| E[Key and owner request]
  D --> F[Gateway session resolver]
  E --> F
  F --> G[Existing session store]
  G --> H[Owner-matched details]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +41, Tests +153, Docs +1. Total +195 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 113 72 +41
Tests 3 173 20 +153
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 287 92 +195

Review metrics

Metric Value Why it matters
Detail request contract 2 RPC methods now consume an optional agentId The owner hint reuses existing resolution rules while preserving key-only requests for qualified sessions.

Technical review

Best possible solution:

Keep one key-and-agent detail identity throughout selection, refresh, and recovery while using the existing Gateway resolver and qualified-key contract.

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

Yes, from source: select an unqualified session such as global in a multi-agent overview; current main drops its agent before resolving details. This review did not execute the application or tests.

Is this the best way to solve the issue?

Yes. Carrying the existing owner identity through the detail lifecycle repairs the producer and consumer together, preserves qualified system-session routing, and avoids a competing resolver.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs missing or wrong-owner Usage details in multi-agent setups without changing the primary agent workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied repository metadata identifies maintainer-authored work, exempt from the ordinary external-contributor gate. Inspected screenshots demonstrate the selected raw-key timeline and conversation in the declared source-built mock-Gateway setup; Gateway and stale-response regressions provide supplemental coverage.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The supplied repository metadata identifies maintainer-authored work, exempt from the ordinary external-contributor gate. Inspected screenshots demonstrate the selected raw-key timeline and conversation in the declared source-built mock-Gateway setup; Gateway and stale-response regressions provide supplemental coverage.

Evidence

What I checked:

  • Current main still needs the repair: The fetched main revision resolves detail ownership using only the key, while the UI retains detail identity by sessionKey alone. Both mechanisms described by the PR remain present. (src/gateway/server-methods/usage.ts:61, e157c6b250b8)
  • Latest supplied release retains key-only resolution: The v2026.9.3 source also calls the detail owner resolver without an explicit agent hint; the requested repair is not present in that release. (src/gateway/server-methods/usage.ts:61, 1391f7cd2d40)
  • Owner identity and stale-response fencing: The controller compares key plus agent, clears data when the target changes, and checks target identity before recovery. The existing request owner rejects completions from superseded requests. Qualified keys omit the wire hint while retaining local owner identity. (ui/src/pages/usage/detail-controller.ts:43, 495de05d3b2a)
  • Existing routing and permission boundaries: The existing resolver validates explicit agent IDs, rejects conflicting owners, and allows qualified disk-backed owners without requiring an explicit configured-agent hint. Usage methods retain operator.read authorization; this patch routes existing identities without introducing credentials, grants, or persistent authority. (src/gateway/session-request-agent.ts:95, 495de05d3b2a)
  • Regression coverage inspected: The added Gateway cases exercise independent same-ID transcripts and system-session routing. Mounted UI cases cover raw and qualified keys, manual and automatic owner replacement, failed successor requests, and late prior-owner completion. Tests were inspected, not executed during this read-only review. (ui/src/pages/usage/usage-page-details.test.ts:38, 495de05d3b2a)
  • Inspected visual evidence: All three prepared images were inspected. The before image visibly reports missing ownership for global; the after images show a timeline and the selected Opus conversation. The captured PR body explicitly identifies a source-built UI with synthetic mock-Gateway responses, so these images establish the visible fixture flow rather than live Gateway authorization or storage behavior.

Likely related people:

  • Peter Steinberger: Raw commit 77f6290 adds ui/src/pages/usage/request.ts:14 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 77f62904ae7c; files: ui/src/pages/usage/request.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-09T23:07:02.511Z sha 760464a28cebebab634cb4d46b84410c8ca62fc4 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/fix-usage-detail-agent-owner branch from 760464a to 495de05 Compare September 9, 2026 23:16
@steipete
steipete merged commit 46cfa0e into main Sep 9, 2026
183 checks passed
@steipete
steipete deleted the codex/fix-usage-detail-agent-owner branch September 9, 2026 23:46
@steipete

steipete commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant