fix(runtime): default omitted invoke user ID - #2187
Conversation
|
Claude Security Review: no high-confidence findings. (run) |
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Small, focused fix that centralizes a "default" fallback for runtimeUserId in normalizeRuntimeInvokeRequest (src/handlers/runtime/invoke/request.ts), with matching help-text updates and test coverage.
Verified:
- All user-facing invoke entry points (
runtime invokeheadless + TUI screen,project invoke runtime) route throughnormalizeRuntimeInvokeRequest, so the default reaches both the CUSTOM_JWT header path and the IAM/SDK path insrc/core/invokeRuntime.ts. src/core/eval.tsxintentionally builds its ownRuntimeInvokeRequestand still forwardsinput.userId(potentially undefined). That's not covered by this change; since eval has its own userId semantics (per-example), leaving it out looks deliberate — worth confirming that's intended.- Override test in
request.test.tsstill passes an explicitruntimeUserIdthrough unchanged, and the screen test atinvoke.screen.test.tsx:811was updated correctly.
One thing to double-check (not a blocker): this is a behavior change — invocations that previously omitted X-Amzn-Bedrock-AgentCore-Runtime-User-Id will now always send default. Make sure that matches the server-side default and doesn't affect existing sessions/metrics that were keyed on "no user id".
Nothing else that requires changes before merging.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2187 +/- ##
=========================================
Coverage 97.08% 97.08%
=========================================
Files 536 536
Lines 36979 36981 +2
=========================================
+ Hits 35901 35903 +2
Misses 1078 1078 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| flag("accept", "the accepted response content type", z.string().optional()), | ||
| flag("session-id", "the Runtime session ID", z.string().optional()), | ||
| flag("user-id", "the Runtime user ID", z.string().optional()), | ||
| flag("user-id", 'the Runtime user ID (default: "default")', z.string().optional()), |
There was a problem hiding this comment.
nit: should be get this from DEFAULT_RUNTIME_USER_ID.
Summary
defaultTesting
bun test src/handlers/runtime/invoke/request.test.ts src/handlers/runtime/invoke/invoke.test.tsx src/handlers/runtime/invoke/invoke.screen.test.tsx src/handlers/project/invoke/index.test.tsx(83 pass)bun test src(2804 pass)bun run typecheckbun run lint:checkbun run format:checkbun run buildIssue686_Echoreturned HTTP 200 without--user-idx-amzn-bedrock-agentcore-runtime-user-id: default, while an explicit--user-idoverrides it