Skip to content

fix(hyperion): address review findings from PR #43347 - #2

Merged
adhajar-amzn merged 1 commit into
feat/hyperion-multi-tenantfrom
fix/hyperion-review-fixes
Mar 12, 2026
Merged

fix(hyperion): address review findings from PR #43347#2
adhajar-amzn merged 1 commit into
feat/hyperion-multi-tenantfrom
fix/hyperion-review-fixes

Conversation

@adhajar-amzn

Copy link
Copy Markdown

Summary

Addresses automated review comments (Codex + Greptile) from PR #43347:

P1 fixes

  • Tenant ID derivation (agentcore/runtime.ts) — Use extractTenantId(sessionKey) instead of agent name to prevent cross-tenant collisions when different users share an agent name like "main"
  • Atomic pairing code consumption (pairing-store.ts, dynamodb-client.ts) — Replace read-then-delete with DynamoDB conditional delete (attribute_exists + ReturnValues: ALL_OLD) to prevent double-redemption race conditions
  • Tool API key mapping (tenant-config-loader.ts) — Map brave_searchsearch.apiKey and other providers → search.<provider>.apiKey instead of overwriting a single key for all providers
  • Gateway base config passthrough (hyperion/service.ts) — Forward ctx.config as defaultConfig to createHyperionRuntime() so tenant configs inherit global settings (e.g., ACP backend selection)

P2 fixes

  • Endpoint override without SSM skip (agentcore/config.ts, agentcore/index.ts) — Add endpointOverride field that applies after SSM loading, so runtime ARNs are still discovered when testing with a local endpoint

Other

  • Env var restoration in test (credentials.test.ts) — Delete undefined env var keys instead of setting them to string "undefined" via process.env.X = undefined

Skipped (not our code / false positive)

  • register.onboard.ts:135 — OC core file
  • tenant-config-loader.ts:201 — False positive; ...config.agents spread already preserves AgentsConfig shape

Test plan

  • All 99 affected tests pass (vitest run on 5 test files)
  • New tests added for endpointOverride in config.test.ts
  • Pairing store tests updated for atomic consumePairingCode flow

🤖 Generated with Claude Code

… pairing, tool key mapping

- Derive tenant ID from session key via extractTenantId() instead of agent
  name, preventing cross-tenant collisions when agents share names (P1)
- Consume pairing codes atomically with DynamoDB conditional delete to
  prevent double-redemption race conditions (P1)
- Map tool API keys to provider-specific paths (brave_search → search.apiKey,
  others → search.<provider>.apiKey) instead of overwriting a single key (P1)
- Pass gateway base config (ctx.config) into Hyperion runtime so tenant
  configs inherit global settings like ACP backend selection (P1)
- Add endpointOverride to AgentCore config that applies after SSM loading,
  so runtime ARNs are still discovered when testing with a local endpoint (P2)
- Fix env var restoration in credentials test to delete undefined keys
  instead of setting them to string "undefined"
- Update tests for all changes; all 99 tests pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@adhajar-amzn
adhajar-amzn merged commit 4436131 into feat/hyperion-multi-tenant Mar 12, 2026
2 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant