-32021 storage_token missing in production despite storage_grant.allowedScopes: ["user","tool"] and a plugin requesting scope="user"

Posting this at the request of the review team, who hit the error while testing my app and asked for a fuller reproduction.

The short version: every declaration on my side checks out, the grant explicitly permits the scope I request, and the host still does not issue a storage token. The same code works when the storage backend is reached via anna-app dev --storage aps, and fails when the published binary runs under the Cloud Agent.

App: error-journal, id 183, version 0.1.2 (id 536) Executa: tool-sadi-error-journal-r483yxrw, id 1099, v0.3.3 (executa_version 379) CLI: v0.1.49 · Host: https://anna.partners


The error

Returned on every diagnose_error invoke in the reviewers’ session:

-32021: storage_token missing — host did not authorize storage for this invoke

Worth noting this is not a scope rejection. In an earlier round I saw:

-32029: storage_token does not permit scope='app'; allowed=['tool', 'user']

That one was my bug — I was requesting scope='app', which is not issued for plugin-side tokens. Fixed by switching to scope="user".

The current error is different in kind: no token was minted at all, which happens before my request’s scope is evaluated. So the question is not “why was my scope refused” but “why was no token issued for this invoke, when the grant permits it.”


Everything on my side, verified

1. The published binary declares user-scope capabilities

Extracted from the exact artifact uploaded for executa v0.3.3:

$ tar -xzf error-journal-0.3.3-linux-x86_64.tar.gz
$ echo '{"jsonrpc":"2.0","method":"describe","id":1}' | ./error-journal
version: 0.3.3
caps   : ['aps.scope.user.read', 'aps.scope.user.write', 'llm.sample']

2. The plugin requests scope="user"

$ grep -n 'STORAGE_SCOPE' error_journal_plugin.py
33:  STORAGE_SCOPE = "user"
275: res = reverse_rpc("storage/get", {"scope": STORAGE_SCOPE, "key": key}, invoke_id)
280: params = {"scope": STORAGE_SCOPE, "key": key, "value": value}

Every reverse RPC passes context.invoke_id from the parent invoke.

3. The platform’s stored manifest agrees

$ anna-app executa list --json | jq '.executas[0].manifest_cache.host_capabilities'
["aps.scope.user.read", "aps.scope.user.write", "llm.sample"]

4. host_capabilities is declared at the top level of manifest.json too

{
  "schema": 2,
  "host_capabilities": ["aps.scope.user.read", "aps.scope.user.write", "llm.sample"],
  ...
}

anna-app validate --strict passes.

5. The grant explicitly permits the scope I request

$ anna-app apps grants error-journal
bundled executa grants
  error-journal:
    sampling_grant: {"enabled":true}
    storage_grant:  {"enabled":true,"allowedScopes":["user","tool"]}

No missing grants warning. Sampling, which is granted the same way, works.

6. The Executa’s visibility is correct

$ anna-app executa status tool-sadi-error-journal-r483yxrw --json
{ "visibility": "app_bundled", "is_published": false,
  "latest_version": { "version": "0.3.3", "id": 379 } }


The same code works through the local harness against real APS

$ anna-app dev --storage aps
  storage backend   aps (real nexus APS via /api/v1/storage/*)

Pasting the same Kubernetes error three times produces, on the third:

This is the 3rd time you have hit this in prod-cluster — first seen 20 August.

storage.set returns ok with an etag, incidents persist, and repeat detection works. Screenshot attached.

So the difference is not the code. It is the execution path: local harness → real APS works; published binary → Cloud Agent does not get a token.


Possibly related: apps status and apps grants disagree about latest

$ anna-app apps status error-journal
  latest    : v0.1.2 (id=536, published=—)

$ anna-app apps grants error-journal
  "latest_version": "0.1.1",
  "installed_version": "0.1.1",
  "update_available": false

apps status reports v0.1.2 as latest; apps grants reports v0.1.1 as both latest and installed, with update_available: false.

I have never been able to install v0.1.2. Uninstalling and reinstalling from the Developer Console returns installed_version: 0.1.1 every time. submit-review confirmed under review: v0.1.2, and the review team confirmed they installed v0.1.2 — but from my side the runtime consistently reports 0.1.1.

Is the installable version derived from a different field than apps status reports? If the runtime resolves an older version than the review pins, that would explain a lot on both sides.


What would help

  1. Anything visible server-side about why a storage token was not minted for this invoke — a rejected precondition, a mismatch between the grant and the executa version, anything.
  2. Whether the storage grant is scoped to a particular installed app version. If the grant was enabled against v0.1.1 and the runtime resolves a different executa version, that could produce exactly this.
  3. Whether there is a supported way to force a newer cut version to become the installed one.

Happy to run any diagnostic, enable extra logging, or re-cut with changes if it helps isolate it. I have not changed anything since the review round, so the state is exactly as tested.

Hi @sadi! :waving_hand:

First off — thank you for an absolutely stellar report. The artifact extraction, the grant dumps, the local-vs-prod comparison… you did our debugging for us, and your key insight was spot on: no token was minted at all, before your scope was ever evaluated. :detective::sparkles:

What was happening: the host only minted a plugin-side storage token for the aps.kv / aps.files capability strings. Your manifest declared aps.scope.user.read/write — which are gate strings for the iframe Host API face, not mint triggers for the plugin face. So the host never issued a token, and you got -32021 before scope evaluation. The really unfair part: our validator, apps grants, and the local dev harness all treated your config as perfectly fine — so everything looked green locally and only failed in production. That inconsistency was entirely on us. :person_bowing:

The good news — this is fixed! :white_check_mark:

  • Fixed in: 1.1.0-beta.159 (live now :rocket:)
  • Storage capability declarations now converge: aps.scope.* declarations also mint the plugin storage token. Your existing v0.3.3 binary should work as-is — no re-cut needed. Just invoke again and your scope="user" reads/writes will go through.
  • @anna-ai/cli 0.1.52 closes the local↔prod parity gap: anna-app dev now applies the same capability gate the production host does, so this class of “works locally, fails in prod” surprise can’t sneak past you again (there’s a --no-strict-caps flag if you ever need the old behavior).
  • Docs have been updated to make the two capability-string families and when each mints a token much clearer. :books:

On the apps status vs apps grants “latest” disagreement: good catch — that’s a real inconsistency in how the two commands resolve “latest”, and we’re tracking it separately. It did not contribute to the -32021 (token minting reads the live Executa manifest and is version-independent), but we agree it’s confusing and it’s on our list. :hammer_and_wrench:

Please give your app another spin and let us know how it goes. And seriously — reports like this one make the whole platform better for every developer. Thank you! :yellow_heart:

Happy building! :sparkles:

Confirmed the fix works — thank you. Existing v0.3.3 binary, no re-cut needed, exactly as described.

Three pastes of the same error in production:

  1. First: correctly diagnosed, no -32021.
  2. Second: opened with “You’ve hit this ModuleNotFoundError before — it’s been recorded in your error journal” and the correct fingerprint. Storage round-trip confirmed working.
  3. Third: fingerprint still present, but the repeat-detection line was gone entirely — read as a fresh diagnosis with no mention of history.

One thing worth flagging separately from the storage bug, since it’s a different class of issue.

My tool computes a headline string server-side specifically so the repeat-detection sentence can’t be dropped in presentation (e.g. “This is the 3rd time you have hit this — first seen 20 August. What fixed it last time: …”), and a follow_up field that should populate once occurrence count hits 3+. Both system_prompt_addendum and SKILL.md instruct the agent to print these verbatim.

Across the three pastes, follow_up never appeared once, including on the third occurrence where my own logic guarantees it’s non-null. And the repeat-detection line itself appeared on paste 2 but not paste 3, despite the underlying history.seen_before being true both times.

So it looks like the storage layer is now solid, but the agent treats returned fields like headline and follow_up as optional colour rather than content to reproduce — inconsistently, run to run, even within the same conversation.

Not blocking, and possibly out of scope for this thread since it’s presentation rather than storage. But since system_prompt_addendum is the documented mechanism for telling the agent how to present tool output, I’d guess this affects any app relying on it for structured or ordered output, not just mine. Happy to open a separate thread with more reproductions if that’s more useful than tacking it on here.

Hi @sadi! :waving_hand:

Thank you for confirming the storage fix is working — and for flagging this presentation behavior so clearly. Your three-paste comparison table is exactly the kind of signal we love to see. :detective::sparkles:

You’re right that this is a different class of issue from the storage bug, and we’re very interested in digging into it. The scenario you describe — server-side computed fields like headline and follow_up being treated as optional colour rather than content to reproduce, inconsistently from run to run — touches on how structured tool output gets presented, and we’d like to understand your use case in depth before deciding how to improve it. :hammer_and_wrench:

If you’re up for it, a dedicated thread would be super helpful (this deserves its own space rather than living at the bottom of a storage thread :grinning_face_with_smiling_eyes:). A few things that would help us the most:

  1. Your concrete scenarios :clipboard: — the tool response shape you return (field names, where the presentation-critical strings live), and the instructions you give in system_prompt_addendum / SKILL.md. Feel free to redact anything sensitive — structure matters more than content.
  2. What you observed vs. what you expected :magnifying_glass_tilted_left: — like your paste 2 vs. paste 3 comparison. If you can note whether the app was explicitly #mentioned in each conversation (or invoked another way), that’s a genuinely useful data point for us.
  3. Your ideal behavior :thought_balloon: — this is the big one! If you could design the mechanism yourself, what would it look like? For example:
    • certain fields rendered verbatim, guaranteed (a “display this exactly” channel)?
    • ordering guarantees (“always lead with headline”)?
    • conditional fields (“show follow_up whenever non-null”)?
    • something else entirely?
  4. How often it matters :bar_chart: — is this cosmetic for your app, or does dropping follow_up break the core value of your error journal for users?

Your point that this likely affects any app relying on structured or ordered output — not just yours — is well taken, and it’s exactly why we want to hear the real-world requirements from developers building these experiences. :seedling:

Thanks again for the consistently excellent reports — they genuinely make the platform better for everyone. Looking forward to the new thread! :yellow_heart:

Happy building! :sparkles:

A small correction to item 4 of my original post: the top-level
host_capabilities in manifest.json does not list aps.scope.user.read and
aps.scope.user.write. It has aps.kv and llm.sample. The aps.scope.user.*
declarations are in the Executa’s describe manifest, which is the one
your fix reads. Sorry for the confusion, and thanks again for the fix.