fix(sidebar): resolve stale per-session active account display#54
Open
iceteaSA wants to merge 1 commit into
Open
fix(sidebar): resolve stale per-session active account display#54iceteaSA wants to merge 1 commit into
iceteaSA wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
iceteaSA
force-pushed
the
fix/sidebar-stale-active-display
branch
from
July 20, 2026 19:50
3c4fbe7 to
4686858
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug (operator-hit, live)
A session's sidebar kept showing
work-altas the active account while its subagent children were actively serving from a newly added fallback (client-alt). Live state: the session's per-sessionactiveRoutingentry pointed atwork-alt, which had since hit 100% used (reset days in the future). The entry was honored becauseresolveSessionSidebarRoutingonly checks that the target account exists, is enabled, and isn't killed — never its quota. The fallthrough had the same blindness: it picks the first enabled fallback, which was again the exhausted one.Additionally, subagent serves never refresh the parent session's routing entry, so a parent TUI idles on stale data while its children serve from a different account.
Fix (display-layer only; real routing untouched)
sidebar-state.ts—isQuotaExhausted(quota, now): primary windowusedPercent >= 100withresetsAtin the future. Unknown/missing/malformed quota is not exhausted (fail-open, consistent with the killswitch doctrine).resolveSessionSidebarRoutingrejects a session entry whose target account is exhausted, and the fallthrough prefers the first non-exhausted enabled fallback (array order preserved; all-exhausted keeps prior behavior).index.ts— the fetch override capturesx-parent-session-id(before header rewriting) and, on a serve, upserts the routing entry for both the child and the parent session (same activeId/route,parent !== childguard, best-effort, same compare-and-retry RMW path as all routing writes).resolveQuotaDialogActiveIdalready delegates to the shared resolver — the/openai-quotadialog inherits the fix.Verification
work-alt+ healthyclient-alt→ old code returnswork-alt, fixed code returnsclient-alt); parent-entry-absent RED for the upsert; EISDIR best-effort RED.resetsAt(elapsed window ≠ exhausted), missing/null quota honored, all-fallbacks-exhausted preserved,mainexhaustion symmetric,parent === childguard.updatedAtvs pruning clamp all verified; RED claims confirmed by reverse-applying the diff.Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by cubic
Fixes the sidebar’s per-session active account display so exhausted accounts aren’t shown as active, and parent sessions reflect the account actually serving via child sessions.
x-parent-session-id(when present and different). Best-effort write; request routing is unchanged./openai-quotadialog uses the shared resolver and reflects these rules.Written for commit 4686858. Summary will update on new commits.