fix(app): avoid stale session context reads#986
Conversation
|
Warning Review limit reached
More reviews will be available in 48 minutes and 52 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Suggested priority: P2 (includes user-path files (packages/app/src/components/session-context-usage.test.ts, packages/app/src/components/session-context-usage.tsx)).
P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.
There was a problem hiding this comment.
Code Review
This pull request refactors the SessionContextUsage component to avoid passing volatile context accessors through non-keyed <Show> children by introducing a memoized contextUsedLabel. It also adds a test to enforce this render contract. The reviewer suggested using import.meta.url and fileURLToPath instead of __dirname in the test file to ensure path resolution remains stable across different execution contexts.
Summary
Fixes a Solid stale
<Show>accessor read inSessionContextUsageby avoiding callback accessors for context usage tooltip content.Why
Production v2026.5.29 can throw
Stale read from <Show>while switching sessions. The issue was first filed as #985. The release regression was exposed by PR #969 keeping the composer mounted during session opening; Claude's read-only review agreed that restoring the composer guard would be a symptom fix that regresses #969, and that the smaller root fix is to stop passing volatile context accessors through non-keyed<Show>children inside the composer subtree.Related Issue
Fixes #985
Human Review Status
Pending
Review Focus
Please check that the tooltip still renders the same context/cost information while no longer using callback-form
<Show>accessors for values that can disappear during session transitions.Risk Notes
Low risk. This keeps the #969 composer mount behavior intact and only changes the render shape inside the context usage tooltip. Review follow-up replaced the brittle source-string render contract with a browser-condition test that renders SessionContextUsage itself and clears the mocked session messages so context metrics disappear. Platform/packaging surfaces were not touched. Docs, dependencies, permissions, generated files, and local file behavior were not touched.
How To Verify
Screenshots or Recordings
Visual snap checked locally:
docs/design/preview/screenshots/session-context-cache.png(session-context-cache).Checklist
bug,enhancement,task,documentation. Type labels are author-added; the labeler bot does NOT assign them. Add the label in the GitHub UI, then tick this.app,ui,platform,harness,ci. The labeler bot assigns these on PR open based on changed paths. Confirm the bot's choice (or override if wrong), then tick this.P0,P1,P2,P3. The priority-triage bot suggests one on PR open. Confirm or override, then tick this.Pending,Approved by @<reviewer>, orNot required: <reason>(default isPending; "not required" is restricted to bot-authored low-risk PRs).dev, and my PR title and commit messages use Conventional Commits in English.