fix(cli): persist Anthropic auth header format during setup - #1158
Conversation
Signed-off-by: Brian Newsom <brnewsom@nvidia.com>
📝 WalkthroughWalkthroughProvider creation and update flows now send ChangesProvider authentication payload
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
|
tylersbray
left a comment
There was a problem hiding this comment.
LGTM. All the verification is nice. Agent found this little bit of feedback:
Non-blocking: consider explicitly sending required_extra_headers=None on Anthropic provider update so repair intent does not depend on PUT defaulting omitted fields to null.
Signed-off-by: Brian Newsom <brnewsom@nvidia.com>
Good suggestion, updated this. |
Summary
nemo setupcurrently stores Anthropic'sX-Api-Keytemplate inrequired_extra_headers, where it remains the literal string{{ auth_secret }}and Anthropic rejects every request. This change persists the existing provider definition'sauth_header_formatfield on both create and update, so the inference gateway renders the secret at request time; default Bearer-auth providers are unchanged.Changes
auth_header_formatthrough setup provider create and update calls.required_extra_headerswhen interactive or automatic setup is rerun.Type of Change
Quality Gates
auth_header_formatbehavior are already documented; this fixesnemo setupto follow that contract.Verification
Signed-off-by:traileruv run pre-commit run -apasses, or any blocked checks are identified belowTargeted validation on current head (
242b66df17):Live reproduction on
origin/mainbefore the fixPrerequisites: a local Platform at
http://localhost:8080and a validANTHROPIC_API_KEYexported in the shell. I used an isolated workspace and removed other provider credential variables from the repro shell so automatic setup selected Anthropic.Observed provider state:
{ "auth_header_format": null, "required_extra_headers": {"X-Api-Key": "{{ auth_secret }}"}, "default_extra_headers": {"anthropic-version": "2023-06-01"} }A real Anthropic Messages request through the provider route then failed:
Observed result: Platform HTTP 502 wrapping Anthropic HTTP 401
authentication_error: invalid x-api-key.Live verification after the fix
Rerunning the same setup command updated the existing secret and provider. On a second clean Platform instance created from
origin/main, the fixed CLI also created the provider successfully from scratch.Observed provider state after reconciliation:
{ "auth_header_format": "X-Api-Key: {{ auth_secret }}", "required_extra_headers": null, "status": "READY", "served_models": 10 }The real Anthropic Messages request then succeeded:
Observed HTTP 200 response:
{ "type": "message", "role": "assistant", "model": "claude-haiku-4-5-20251001", "stop_reason": "end_turn", "text": "OK.", "error": null }The real key was loaded locally from the existing environment and was never printed, logged, written to a tracked file, or included in this pull request. Setup sent the raw value only to the Secrets service; provider create/update received the secret name plus the inert
X-Api-Key: {{ auth_secret }}template.Summary by CodeRabbit