fix(intake): send the workspace id an identity-linked key requires (#271)

Every draft in QA failed with a 400: "anthropic-workspace-id is required when authenticating with an identity-linked API key". A key issued against a workspace, rather than standing alone, is refused unless the request names the workspace it acts in — and the client was constructed with an API key and nothing else.

Nothing about a key's shape says which kind it is, so no amount of configuration checking would have caught this. Only a real call would, which is exactly what #223's task 8 existed to make.

Sent only when ANTHROPIC_WORKSPACE_ID is set. Plenty of keys need no workspace, and sending an empty header would turn the ordinary case into a different error rather than leaving it working. Both compose files carry it with an empty default so an unset variable cannot fail a deploy, and the cutover doc goes from fifteen interpolated names to sixteen — checked against the file, and every name in the list now matches one in the compose.

The failure handling needed no change and got none. The submission kept its photos, the draft recorded ai_error, and the review queue showed the reason. A model call failing must never lose somebody's consignment, and it did not.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-02 17:25:03 -05:00
co-authored by Claude Opus 5
parent e69bd1ef93
commit 6c6aaa46eb
5 changed files with 122 additions and 2 deletions
+15
View File
@@ -54,6 +54,11 @@
# credential here that spends money per call, and it is
# reachable by anyone holding an upload link. Leave it unset
# and submissions still arrive, undrafted.
# QA_ANTHROPIC_WORKSPACE_ID — required alongside the key above when that key
# is identity-linked, i.e. issued against a workspace rather
# than standing alone. Without it every draft fails with a
# 400 naming the missing header (#271). Ordinary keys need
# no workspace and can leave it unset.
# QA_INTAKE_ACTION_SECRET — optional. Signs the regenerate and discard links
# in the notification email (#224). Absent, the email still
# sends and simply carries no shortcuts. Its own value, not
@@ -149,6 +154,16 @@ services:
# without its description written.
- ANTHROPIC_API_KEY=${QA_ANTHROPIC_API_KEY}
# Required alongside the key when that key is identity-linked — one issued
# against a workspace rather than standing alone. Such a key is refused
# with a 400 unless the request names the workspace it acts in, and
# nothing about a key's shape says which kind it is, so this only shows up
# on a real call. It did: every QA draft failed until this existed (#271).
#
# Optional. Plenty of keys need no workspace, and sending an empty one
# would turn the ordinary case into a different error.
- ANTHROPIC_WORKSPACE_ID=${QA_ANTHROPIC_WORKSPACE_ID:-}
# Signs the regenerate and discard links in the intake notification email
# (#224). Optional: absent, the notification still sends and simply links
# to the review queue without shortcuts. Anyone holding a link can act on