Skip to content

bug(platform): API key changes leave other organization views stale #3899

Closed

Description

@yannickmonney

API-key create/revoke leaves other organizations' account-wide key lists stale

P2 confirmed local defect. Same-person API keys are account-wide, but the UI partitions their query cache by organization and invalidates only the organization currently being viewed.

Reproduction

  1. As one account that belongs to organizations A and B, open Settings → API → REST in A to warm its key list.
  2. Switch to B, open the same settings, and revoke an existing synthetic key (or create a new one).
  3. Within five minutes, switch back to A and reopen the API key settings.

Actual: A still displays the revoked key, or omits the newly created key. The account-wide server result has already changed. The warm list makes no new call. Revocation itself is successful; this is misleading key-management state, not continued key validity.

Expected: the account-wide key listing updates in every org context when this account creates/revokes a key. Use a shared account-scoped query key, or invalidate all cached API key lists on these mutations.

Root cause

At source 9ea5972, services/platform/app/features/settings/api-keys/hooks/use-api-keys.ts:16-26 keys the read as ['api-keys', organizationId] although authClient.apiKey.list() has no org argument. Creation and revocation invalidate only that exact org prefix at lines 56-59 and 79-82. app/router.tsx:35 configures five-minute freshness. The actual switch route removes only backend/Convex keys (app/routes/dashboard/switching.tsx:95-110), so these keys survive switching.

Isolated evidence

api-key-org-cache.probe.test.tsx: two tests pass using the real useApiKeys/useCreateApiKey/useRevokeApiKey hooks and TanStack Query. Synthetic auth-client responses represent one account-wide key list; no server, secrets, provider or real key is used. Both create and revoke reproduce stale return-to-A data. Explicitly invalidating ['api-keys'] immediately heals the stale list, proving the cache-key boundary. These are hook/cache observations, not a full browser-navigation or native backend test.

Dedup: searched findings.json, baseline-102.json and issues-live-batch11.json. Distinct from #3675 refused creation feedback, #3676 initial list failure, #2317 Last used stamping, #3712 connector cross-client hint propagation. Here a successful same-client personal-key mutation misses the other org cache.

Parent independently replayed both cases at the pinned SHA: 2 tests passed. Parent log: settings-functional-next/parent.replay.log.

Activity

  1. yannickmonney commented on Sep 29, 2026

    @yannickmonney
    ContributorAuthor

    Current-main revalidation — b7f8ca0

    Source: b7f8ca02ec249c004652b1ee52e112d9cdfa53ea. Two current-source hook/TanStack cache cases reproduce create/revoke leaving a warm other-organization API-key view stale; explicit broad api-keys invalidation restores freshness in the control. Actual hook/cache, inert transport; no real API key was created or revoked.

    Evidence: /Users/yannick/.codex/notes/tale-1000-additional/current-main-reconciliation/settings-triage/current-replay.log. Installed external dependencies are reused; app/UI/shared source points at the isolated current tree. Browser runs retain the runner/browser version warning. These revalidations add no findings and include no production testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions