Skip to content

fix: show the selected global chat's context breakdown - #188731

Merged
shakkernerd merged 1 commit into
mainfrom
global-context-report-target
Oct 30, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
global-context-report-target

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #188676.

Opening the Context breakdown for a raw global chat can request the separate stored row agent:main:global. When that literal row has no report, the selected chat shows no breakdown even though its own matching report is available. The real browser reproduction selected the raw session, sent the literal key, and displayed no categories.

User Impact

The popover and Context panel use the selected conversation's saved report. A conversation without its own matching report keeps its existing unavailable state. Read permissions, cancellation, and session/model/provider matching continue to determine whether a result can be displayed.

This is the selection correction following the separately merged admission fix in #188670. It adds no configuration, migration, or Gateway interface.

Why This Change Was Made

The report owner used an artifact-wire projection for both its cache identity and the usage request. That projection can collapse raw and literal stored addresses. sessions.usage already accepts the stored key and agent separately, so this change retains that key at the existing owner and keeps distinct requests in distinct cache entries.

The regression exercises the production report owner and request adapter with fixed external responses for raw, literal, and other-agent rows. It checks reverse completion, incomplete session-ID metadata, and report absence without using another row's cached report. The 52-line allocation covers this missing request/cache contract; existing lifecycle and permission controls remain.

Evidence

The real Gateway/browser baseline used the checked admission prerequisite e02c1f3. A native raw-key request returned an eligible report matching the selected session, model, and provider. The actual Context popover instead requested the distinct literal row and showed zero categories with no permission error.

Remote changed-file formatting, lint, i18n, and selected production/test type checks passed. Both new regression cases failed against the prerequisite owner for the intended reasons; all 22 owner/consumer tests then passed with the candidate (2.70 seconds in Vitest; the single-file red run took 2.46 seconds).

Those focused checks cover the identical patch before its content-equivalent replay onto the merged admission prerequisite; the relevant source delta and range-diff were inspected. Exact-head hosted code, type, UI unit, and UI E2E checks passed.

On head 60e0667, the native Gateway/browser flow requests global with agent main, returns the selected session’s matching report, and renders five categories. Closing and reopening preserves the breakdown with one usage request and no page errors. Selecting the coexisting literal row requests its distinct key and session, returns its own absent report, and displays no categories. Other-agent isolation and lifecycle controls are covered by the focused tests and source review. No new model turn or synthetic saved report was used for this final comparison.

Independent engineering review and the separate P0 automated review remain clean for the unchanged patch. ClawSweeper’s review rates the current head Diamond with no findings. Current-head CI and the applicable security review passed, including the test-line gate after the separate budget correction in #188780.

The identical three-file patch was replayed onto a target containing that correction as 997a1ce. The media below retains its actual 60e0667 capture identity and remains applicable: the patch and 66 relevant selected-row, report-owner, request, guard, hydration, test, and dependency inputs are identical after replay. The inspected adjacent changes do not alter this flow; no fresh runtime execution is claimed.

Visual evidence

Open preview

Before After
Selected raw chat shows usage totals without its available context categories The same selected raw chat shows its five context categories

Open and reopen the selected raw chat context popover

context.mp4

Visual verification

  • Baseline: e02c1f3
  • Exact head: 60e066731214e82f71a72839f65825afd8781442
  • Scenario: Open the selected raw-global chat context ring, close it, and reopen it. Browser viewport 1440×1000; all screenshots use the same 350×395 crop at (650,600). Prompt/model/account content is hidden.
  • Runtime/build: OpenClaw 2026.10.9-60e066731214-2026-10-30T21-50-20.084Z; native Gateway and Vite at the same source.
  • Usage request key: agent:main:global → global; agentId remains main
  • Visible categories: 0 → 5
  • Selected chat usage: 49.5k / 252k · 20% before and after
  • Reopen: Five categories retained; one total usage request
  • Actual selected row, returned row, and saved report session IDs match.
  • Real Gateway responses supply the report; no mock or seeded report.
  • Record input and native source/build identity are checked by the recorder.

@shakkernerd shakkernerd self-assigned this Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves the selected stored session key in Context report requests and cache entries.

Example: Select raw global for agent main while agent:main:global also exists without a saved report.

  • Before: Context requests agent:main:global and displays no breakdown categories.
  • After: Context requests global with agentId main and displays the selected conversation’s five categories.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused, useful correction with inspected shipped-entry-point proof, meaningful regressions, and no actionable findings; remaining exact-head CI is pending.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected native Gateway/browser before-and-after screenshots demonstrate the selected raw-global report changing from zero to five categories; the body records exact request and report identities, and source comparisons support reuse after replay onto this head.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An available saved Context breakdown appears empty because the UI requests a different stored conversation.
Reason: The maintainer-authored direction restores documented behavior with a narrow correction in the existing owner.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fixes a current wrong-session read with a focused change; no actionable defects were found.

Priority: P2
Reviewed head: 997a1ce25ed78d51d3cfc0cd71808d041cda34ce

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Control UI’s shared Context report owner receives the selected session identity, requests its saved report through sessions.usage, and supplies the composer popover and Context panel.

flowchart LR
  A[Selected conversation] --> B[Shared Context report owner]
  B --> C[Session usage adapter]
  C --> D[Gateway stored row selection]
  D --> E[Saved context report]
  E --> B
  B --> F[Popover and Context panel]
Loading

Technical review

Best possible solution:

Preserve the selected stored key and explicit agent in the existing shared report owner while retaining its matching and lifecycle guards.

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

Current-main source establishes the wrong-key conversion, and the supplied native browser baseline demonstrates its visible result; this read-only review did not execute a reproduction.

Is this the best way to solve the issue?

This is the smallest complete correction: both request targeting and cache identity use the existing stored-key-plus-agent contract without changing unrelated artifact semantics.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Shared Context report request and cache identity keeps the original intent (ff63be5: The composer-popover feature introduced a shared session/model/provider-scoped report and in-flight request; the PR preserves that intent while correcting stored-row addressing.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vyctor H. Brzezowski: Raw commit ff63be5 adds ui/src/lib/session-context-report.ts:40 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: ff63be54cf44; files: ui/src/lib/session-context-report.ts)
  • Peter Steinberger: Raw commit 60740d9 adds ui/src/lib/session-context-report.ts:58 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 60740d98bdf3; files: ui/src/lib/session-context-report.ts)
  • Shakker: Raw commit 093d71e adds ui/src/lib/session-context-report.ts:58 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 093d71e81eb1; files: ui/src/lib/session-context-report.ts)

PR surface

Source +1, Tests +52, Other +2. Total +55 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 4 3 +1
Tests 1 52 0 +52
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 3 58 3 +55

Review metrics

Metric Value Why it matters
Production versus regression code Production +4/-3 lines; tests +52 lines The small owner correction needs distinct stored-key and agent isolation coverage, including incomplete session IDs and report absence; the matching allocation follows the repository test-budget contract.

Root-cause cluster

Relationship: same_root_cause
Canonical: #188676
Summary: This PR directly repairs the wrong stored-session selection documented by the linked issue; the merged admission repair addresses a separate prerequisite.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: The fix restores saved Context inspection for a specific existing session pair without changing conversation delivery or stored data.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-30T21:50:27.306Z sha 60e0667 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-30T22:17:52.885Z sha 60e0667 :: needs maintainer review before merge. :: none

Reviewed October 30, 2026, 7:14 PM ET / 23:14 UTC (Revision 3).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Oct 30, 2026
@shakkernerd
shakkernerd force-pushed the global-context-report-target branch from 60e0667 to 997a1ce Compare October 30, 2026 23:06
@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 30, 2026
@clawsweeper clawsweeper Bot removed the clawsweeper:intake:bug Preliminary submission classification; full source review pending. label Oct 30, 2026
@shakkernerd
shakkernerd merged commit 3c1eb67 into main Oct 30, 2026
119 checks passed
@shakkernerd
shakkernerd deleted the global-context-report-target branch October 30, 2026 23:20
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: Context breakdown now displays the selected raw-global conversation’s own saved report.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
Use each selected conversation's stored identity when requesting and caching its saved Context breakdown, preserving distinct raw and literal sessions.

Fixes openclaw#188676.
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 P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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.

[Bug]: Context breakdown requests the literal sibling of a selected raw-global chat

1 participant