Skip to content

fix: prompt state swaps accounts instantly on owner transition - #12314

Merged
kodjima33 merged 1 commit into
mainfrom
kodjima33/prompt-owner-transition
Aug 27, 2026
Merged

kodjima33 merged 1 commit into
mainfrom
kodjima33/prompt-owner-transition

Conversation

@kodjima33

@kodjima33 kodjima33 commented Aug 27, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Follow-up to #12312 (per-account prompt state): storage was owner-scoped, but the cached isVisible/current published state persisted across an account switch until the next question or flag reload.

What

RatingPromptManager.ownerDidChange() (clears thank-you, recomputes from the new owner's keys) and RemotePromptEngine.ownerDidChange() (drops the slot without writing a resolution, re-evaluates, refetches). DesktopHomeView's owner-keyed .task(id: currentOwnerId) — the app's established owner-transition seam (same pattern as the chat-first capability task) — invokes both on every transition; the rating manager additionally observes .userDidSignOut for the sign-out leg.

Verification

Two new PromptStateAccountScopingTests exercise the transition with a VISIBLE prompt and no manual flag reload or extra question: the armed rating bar disappears the moment the owner flips to B and returns when it flips back to A; a visible remote banner survives the switch unresolved, B's dismissal doesn't stick to A. All prompt suites 25/25; swift build clean.

Failure-Class: none

Review in cubic

Cross-review follow-up: ownerProvider changes keyed the STORAGE per account,
but cached isVisible/current stayed until the next question or flag reload.
Both managers now expose ownerDidChange(); DesktopHomeView's owner-keyed
task (the established transition seam) calls it on every switch, and
RatingPromptManager also observes .userDidSignOut for the sign-out leg.
The rating manager clears thank-you and recomputes for the new owner's keys;
the remote engine drops the slot (no resolution written), re-evaluates, and
refetches.

Tests: two new PromptStateAccountScopingTests drive ownerDidChange with a
VISIBLE prompt — armed rating bar disappears for account B and returns for
A; a remote banner survives the switch unresolved and B's dismissal never
sticks to A. Prompt suites 25/25.

Failure-Class: none
@kodjima33
kodjima33 merged commit b9fdb92 into main Aug 27, 2026
8 checks passed
@kodjima33
kodjima33 deleted the kodjima33/prompt-owner-transition branch August 27, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant