fix(invoke): pass session ID to local invoke log files#894
Merged
Conversation
The --session-id flag value was correctly sent to Runtime but never passed to InvokeLogger, causing local log files to always show "Session ID: none". Wire options.sessionId through to both the InvokeLogger constructor and logPrompt() calls in exec and standard invoke modes. Closes #890
Contributor
Package TarballHow to installnpm install https://github.com/aws/agentcore-cli/releases/download/pr-894-tarball/aws-agentcore-0.9.1.tgz |
Contributor
Coverage Report
|
aidandaly24
approved these changes
Apr 20, 2026
Contributor
aidandaly24
left a comment
There was a problem hiding this comment.
Looks great thanks for fixing this. Great testing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agentcore invoke --session-idlocal log files always showingSession ID: noneinstead of the actual session IDInvokeLoggerin the CLI code path (both exec and standard invoke modes)Root Cause
In
src/cli/commands/invoke/action.ts,options.sessionIdwas available but never wired through to:InvokeLoggerconstructor (missingsessionIdproperty)logPrompt()calls (passedundefinedinstead ofoptions.sessionId)The TUI code path (
useInvokeFlow.ts) already handled this correctly — only the CLI path was broken.Changes
src/cli/commands/invoke/action.ts: Passoptions.sessionIdtoInvokeLoggerconstructor andlogPrompt()in both exec mode and standard invoke modesrc/cli/logging/__tests__/invoke-logger-session-id.test.ts: 5 unit tests covering session ID in header, logPrompt output, fallback behavior, and absent session IDTest plan
agentcore invoke --session-id <id> --stream, verified log file shows correct session ID in header, request line, and JSON bodyCloses #890