Skip to content

Send auth token when fetching Duck.ai models - #9764

Open
malmstein wants to merge 1 commit into
feature/david/updated_pickers_flagfrom
feature/david/models_auth_token
Open

Send auth token when fetching Duck.ai models#9764
malmstein wants to merge 1 commit into
feature/david/updated_pickers_flagfrom
feature/david/models_auth_token

Conversation

@malmstein

@malmstein malmstein commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Task/Issue URL: https://app.asana.com/1/137249556945/task/1218299204283397
Tech Design URL (if applicable):
API Proposals URL(s) (if applicable): None

Description

/duckchat/v1/models only returns the editorial label behind each model, which the updated
picker shows as a subline, when the request carries an auth token. This passes the
subscription access token as a bearer header, gated behind updatedPickers so the request
stays anonymous until the new pickers consume the labels. A failed token lookup falls back to
an unauthenticated fetch instead of losing the model list.

The re-fetch trigger now keys off subscription status as well as entitlements. Entitlements
emit an empty set whenever there is no active subscription, so they don't signal a sign-in on
their own. Sign-in is covered too: signInV2 refreshes subscription data, which emits a new
status. The one gap is signing in to an account with no subscription record, where that refresh
throws and emits nothing; the picker's on-attach fetch picks the labels up next time it opens.

Stacked on #9759.

Steps to test this PR

Feature 1

  • With updatedPickers off, open Duck.ai and confirm models still load, and that the
    request to /duckchat/v1/models carries no Authorization header (Proxyman or charles)
  • Enable updatedPickers in the internal feature flag menu, force stop and relaunch
  • Signed out, open the model picker and confirm models load and label is null in the
    response
  • Sign in with a Plus or Pro subscription, open the picker, and confirm the request now
    carries Authorization: Bearer ... and the response has label set on some models
  • Cancel or expire the subscription and confirm the models are re-fetched

UI changes

None

The models endpoint only returns the editorial label used for picker
sublines when the request is authenticated, so pass the subscription
access token as a bearer header. The header is gated behind
updatedPickers, keeping the request anonymous until the new pickers
consume the labels, and a failed token lookup falls back to an
unauthenticated fetch rather than losing the model list.

Re-fetch now also keys off subscription status, not just entitlements:
signing in or out changes whether labels come back, while entitlements
stay empty either way when there is no subscription.

https://app.asana.com/1/137249556945/task/1218299204283397

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@malmstein malmstein mentioned this pull request Sep 9, 2026
3 tasks
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