Skip to content

fix(ai): show the assistant panel after signing in from a shared link - #46

Open
vlidholt wants to merge 1 commit into
mainfrom
fix/ai-panel-after-sign-in
Open

vlidholt wants to merge 1 commit into
mainfrom
fix/ai-panel-after-sign-in

Conversation

@vlidholt

@vlidholt vlidholt commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

A colleague in the same organization opened a document shared with them (edit access) and the Assistant was missing from the side rail, although the organization has a shared AI key.

Root cause

  • Following a shared link while signed out goes through the sign-in screen. The router opens the document as soon as the auth status flips to signed in, but the assistant is only installed when the sign-in setup finishes (profile and preferences load first).
  • The editor screens built their panel list once from services.assistant and never rebuilt when the assistant was installed, so the Assistant icon stayed out of the rail until a reload. Users who open documents from Drive after sign-in never hit it.
  • The server was not at fault: key resolution and assistant.getStatus use the requesting user's organization, so a colleague gets the organization's key on any document.

Fix

  • ShellServices.assistantOffered (the assistant is installed and not switched off on the server) is updated when the assistant is installed, removed, or its status changes.
  • Write, Sheets and Slides rebuild their side panels from it. Sheets and Slides had the same pattern.

Whose key pays on a shared document

Keys follow the requesting user, not the file (spec 10 §1):

  • a colleague in the owner's organization uses that organization's shared key;
  • an editor from another organization uses their own key or their organization's;
  • an editor with no key sees "AI isn't configured". The owner's key never pays for people outside the organization.

Spec 10 §1 and §3 document this and the rebuild.

Test plan

  • dart analyze clean (wonky_app, Write, Sheets, Slides, server); dart format no changes.
  • New server tests in ai_org_key_test.dart for the shared-document cases above; test/integration/platform/ai and test/integration/write/ai pass (66).
  • New Write widget test: a document opened before the assistant is installed gets the Assistant rail icon once it is, and loses it when AI is switched off on the server. It fails without the fix.
  • Flutter suites pass: wonky_app assistant and AI providers, Write screen and AI, Sheets assistant/AI/editor, Slides AI/editor screen.
  • Not checked in the running app: the sign-in-from-a-shared-link flow was not walked through in a browser.

🤖 Generated with Claude Code

A colleague who opened a shared document through the sign-in screen got
no Assistant in the rail. The router opens the document as soon as the
auth status flips to signed in, but the assistant is installed only when
the sign-in setup finishes (profile, preferences), and the editor screens
built their panel list once from `services.assistant` without listening
to it. The server was not at fault: keys resolve per requesting user, so
an organization member gets the organization's key on any document.

- ShellServices.assistantOffered (installed and not switched off) is
  updated when the assistant is installed, removed or its status changes.
- Write, Sheets and Slides rebuild their panels from it.
- Server tests pin whose key pays on a shared document; spec 10 §1/§3
  document it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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