Repository navigation
feat(runtime-core): export getAgentApiKeyEnvVar for agent provider API keys - #569
Conversation
…I keys Callers that pass `apiKey` to the agent block themselves cannot apply the same environment-variable fallback as `resolveAgentModel` without copying the variable names. Expose the name from the existing PROVIDER_ENV table so it stays defined in one place. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K3EZUwBoLd7dWhp6Y5QwAr
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #569 +/- ##
========================================
Coverage 90.44% 90.44%
========================================
Files 216 216
Lines 12584 12586 +2
Branches 3636 3529 -107
========================================
+ Hits 11382 11384 +2
Misses 1199 1199
Partials 3 3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…entModel reads The literal-mapping test restated PROVIDER_ENV and would stay green if resolveAgentModel stopped reading the variable the getter names. Assert that the named variable is the one resolveAgentModel falls back to. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K3EZUwBoLd7dWhp6Y5QwAr
…he list Export the constant from the module (not the package root) so a newly added provider is covered by the getAgentApiKeyEnvVar fallback test automatically. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K3EZUwBoLd7dWhp6Y5QwAr
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The change adds a documented provider environment-variable lookup with per-provider coverage. No actionable merge risk is identified; normal checks remain appropriate. 🚥 Pre-merge checks | ✅ 4 | ❌ 1 | ❓ 1
Comment |
Summary
resolveAgentModelfalls back to a provider-specific environment variable (OPENAI_API_KEY,ANTHROPIC_API_KEY,DEEPNOTE_AGENT_API_KEY) whenapiKeyis omitted. Those names lived only in the privatePROVIDER_ENVtable, so callers that supplyapiKeythemselves couldn't apply the same fallback or name the variable in their own messages without copying the strings.This exports
getAgentApiKeyEnvVar(providerId)from the@deepnote/runtime-corepackage root. It readsPROVIDER_ENV[providerId].apiKeyVar, so each name is still defined in one place.resolveAgentModel/executeAgentBlockbehavior and error messages are unchanged..deepnoteformat,docs/, orskills/changes: library API addition only.Test plan
getAgentApiKeyEnvVarnames is accepted byresolveAgentModel. Confirmed it fails if the getter returns the wrong field or ifresolveAgentModelreads a different variablepnpm exec vitest run packages/runtime-core— 361 passedpnpm typecheckpnpm biome:check— no new warnings (8 pre-existing onmain)pnpm testhas one failure,packages/cli/src/commands/run.test.ts › creates ExecutionEngine with correct config, which also fails on cleanmain🤖 Generated with Claude Code
https://claude.ai/code/session_01K3EZUwBoLd7dWhp6Y5QwAr
Summary by CodeRabbit