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
+9
View File
@@ -92,6 +92,9 @@
# failing, so an empty value is a working configuration.
# ANTHROPIC_API_KEY Optional. Drafts a listing from a submitted photo
# (#223). Unset means submissions still arrive and wait
# ANTHROPIC_WORKSPACE_ID Required alongside the key above when that key is
# identity-linked. Without it every draft fails with a
# 400 naming the missing header (#271).
# INTAKE_ACTION_SECRET Optional. Signs the regenerate and discard links in the
# intake notification email (#224). Absent, the email
# still sends and carries no shortcuts.
@@ -229,6 +232,12 @@ services:
# than the bill.
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
# Required alongside the key when that key is identity-linked. Such a key
# is refused with a 400 unless the request names its workspace, and a
# key's shape does not say which kind it is (#271). Optional: ordinary
# keys need no workspace.
- ANTHROPIC_WORKSPACE_ID=${ANTHROPIC_WORKSPACE_ID:-}
# Signs the regenerate and discard links in the intake notification email
# (#224). Optional: absent, the notification still sends and links to the
# review queue without shortcuts. Rotating it revokes every outstanding