fix(intake): identity-linked Anthropic keys need a workspace id, and drafting has no way to send one #271

Closed
opened 2026-09-02 16:53:39 -05:00 by bermudalamb · 0 comments
Owner

Every draft in QA fails. The error reaches the review queue correctly, which is the design working, but the call never succeeds:

Drafting failed: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"anthropic-workspace-id is required when authenticating with an
identity-linked API key; send the id of the workspace this request acts in."}}

What is wrong

anthropicClient.ts constructs the client with an API key and nothing else. That is correct for an ordinary key. An identity-linked key — one issued against a workspace rather than standing alone — additionally requires an anthropic-workspace-id header naming the workspace the request acts in. There is no way to supply one today, so drafting cannot work with that kind of key at all.

Nothing about the key's shape says which kind it is, so this could not have been caught before a real call. #223's task 8 existed precisely to make a real call, and this is what it found.

Fix

Read ANTHROPIC_WORKSPACE_ID and, when set, pass it as a default header on the client. Absent, behave exactly as now — plenty of keys do not need it, and requiring one would break the ordinary case.

Then wire it into both compose files the way the key itself is wired: QA_ANTHROPIC_WORKSPACE_ID for QA, ANTHROPIC_WORKSPACE_ID for production, both optional with an empty default so an unset variable cannot fail a deploy.

What is already right and should not change

The failure handling. The submission survived with its photos, the draft recorded ai_error, the state went to failed after its attempts, and the review queue showed the reason. A model call failing must never lose somebody's consignment, and it did not.

Worth noting for #227

The budget still has no measured number behind it, because no call has yet succeeded. The first successful draft's cost_micros is the figure that should set it.

Found by #223 task 8.

Every draft in QA fails. The error reaches the review queue correctly, which is the design working, but the call never succeeds: ``` Drafting failed: 400 {"type":"error","error":{"type":"invalid_request_error", "message":"anthropic-workspace-id is required when authenticating with an identity-linked API key; send the id of the workspace this request acts in."}} ``` ## What is wrong `anthropicClient.ts` constructs the client with an API key and nothing else. That is correct for an ordinary key. An **identity-linked** key — one issued against a workspace rather than standing alone — additionally requires an `anthropic-workspace-id` header naming the workspace the request acts in. There is no way to supply one today, so drafting cannot work with that kind of key at all. Nothing about the key's *shape* says which kind it is, so this could not have been caught before a real call. #223's task 8 existed precisely to make a real call, and this is what it found. ## Fix Read `ANTHROPIC_WORKSPACE_ID` and, when set, pass it as a default header on the client. Absent, behave exactly as now — plenty of keys do not need it, and requiring one would break the ordinary case. Then wire it into both compose files the way the key itself is wired: `QA_ANTHROPIC_WORKSPACE_ID` for QA, `ANTHROPIC_WORKSPACE_ID` for production, both optional with an empty default so an unset variable cannot fail a deploy. ## What is already right and should not change The failure handling. The submission survived with its photos, the draft recorded `ai_error`, the state went to `failed` after its attempts, and the review queue showed the reason. A model call failing must never lose somebody's consignment, and it did not. ## Worth noting for #227 The budget still has no measured number behind it, because no call has yet succeeded. The first successful draft's `cost_micros` is the figure that should set it. Found by #223 task 8.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bermudalamb/redefined-designs#271