Skip to content

Developer API keys created before 2026-06-27 have no memory grant and 403 permanently — no backfill exists #10734

Closed

Description

@mdmohsin7

Summary

Developer API keys created before the memory-grant seeding landed (commit 8e03144a, 2026-06-27) have no entry under users/{uid}/memory_control/app_key_memory_grants. Because the app/key scope-grant check fails closed, those keys get a permanent 403 from GET /v1/dev/user/memories regardless of the scopes on the key. There is no backfill for them, so the state is unrecoverable without the developer creating a brand-new key.

This is a second, independent gate from the rollout gate fixed by #10094. #10094 is deployed and working (the endpoint went from zero successes to hundreds of 200s/day), but a large residual population still 403s on this gate.

Symptom

GET /v1/dev/user/memories -> 403
{"detail":{"enabled":false,"reason":"missing_app_key_scope_grant","consumer":"developer_api"}}

/v1/dev/user/conversations and /v1/dev/user/action-items return 200 on the same key, so it reads to the developer as "the memories endpoint is broken", not "my key is missing a grant".

Cause

backend/database/dev_api_key.py:97 seeds the grant, but only on the create path:

grant_default_read = Scopes.MEMORIES_READ in (resolved_scopes or [])
grant_write = Scopes.MEMORIES_WRITE in (resolved_scopes or [])
if grant_default_read or grant_write:
    seed_developer_api_key_memory_grant(...)

authorize_memory_external_default_memory_read in backend/utils/memory/product_authorization.py (EXTERNAL_MEMORY_CONSUMERS at line 84, reason='missing_app_key_scope_grant' at line 328) denies when no grant document is found. Keys that predate the seeding commit were never written into the grants tree and nothing backfills them.

backend/scripts/ has backfill_mcp_key_full_access.py (MCP keys only) and the ops readiness script app_key_memory_grant_assignment_readiness.py, but no equivalent for developer_api.

Scale

Every Developer API key carrying a memories scope that predates the seeding commit is affected, which is the large majority of keys in use today — the seeding path is only a month old. A random sample of accounts from that cohort found no developer_api grant on any of them. Exact figures from the prod trace are available internally on request.

Proposed fix

A backfill that walks dev_api_keys where created_at < 2026-06-27 and the key carries a memories scope, and seeds the grant from the scopes already on the key — i.e. the same call the create path makes. No new authorization is granted; it only materialises the grant the key's own scopes already imply.

Workaround (currently the only one)

Create a new Developer API key with the memories scopes selected; the create path seeds the grant and the new key works. Worth noting because the previous support guidance was "regenerating your key does not help", which was correct pre-#10094 and is now wrong.

Activity

  1. added
    bug
    on Jul 27, 2026
  2. mdmohsin7 commented on Jul 27, 2026

    @mdmohsin7
    MemberAuthor

    Related, same authorization surface: #10735 (hosted MCP returns an empty 200 instead of an error on the same denials) and #10736 (in-app chat memory tools still hard-deny on missing_rollout_state, which #10094 relaxed for the Developer API path).

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions