Skip to content

fix(invoke): pass session ID to local invoke log files#894

Merged
notgitika merged 1 commit intomainfrom
fix/invoke-session-id-logging
Apr 20, 2026
Merged

fix(invoke): pass session ID to local invoke log files#894
notgitika merged 1 commit intomainfrom
fix/invoke-session-id-logging

Conversation

@jesseturner21
Copy link
Copy Markdown
Contributor

Summary

  • Fix agentcore invoke --session-id local log files always showing Session ID: none instead of the actual session ID
  • The session ID was correctly sent to Runtime but never passed to InvokeLogger in the CLI code path (both exec and standard invoke modes)
  • Add unit tests to prevent regression

Root Cause

In src/cli/commands/invoke/action.ts, options.sessionId was available but never wired through to:

  1. The InvokeLogger constructor (missing sessionId property)
  2. The logPrompt() calls (passed undefined instead of options.sessionId)

The TUI code path (useInvokeFlow.ts) already handled this correctly — only the CLI path was broken.

Changes

  • src/cli/commands/invoke/action.ts: Pass options.sessionId to InvokeLogger constructor and logPrompt() in both exec mode and standard invoke mode
  • src/cli/logging/__tests__/invoke-logger-session-id.test.ts: 5 unit tests covering session ID in header, logPrompt output, fallback behavior, and absent session ID

Test plan

  • 5 new unit tests pass (header, logPrompt, fallback, none cases)
  • Full test suite passes (230 files, 3301+ tests)
  • Build succeeds
  • E2E: deployed agent, ran agentcore invoke --session-id <id> --stream, verified log file shows correct session ID in header, request line, and JSON body

Closes #890

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
@jesseturner21 jesseturner21 requested a review from a team April 20, 2026 15:43
@github-actions github-actions Bot added the size/m PR size: M label Apr 20, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.9.1.tgz

How to install

npm install https://github.com/aws/agentcore-cli/releases/download/pr-894-tarball/aws-agentcore-0.9.1.tgz

@github-actions
Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.38% 7143 / 16852
🔵 Statements 41.8% 7574 / 18118
🔵 Functions 40.18% 1270 / 3160
🔵 Branches 41.05% 4784 / 11652
Generated in workflow #1851 for commit d6b4649 by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

@aidandaly24 aidandaly24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great thanks for fixing this. Great testing.

@notgitika notgitika self-requested a review April 20, 2026 20:50
Copy link
Copy Markdown
Contributor

@notgitika notgitika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, LGTM

@notgitika notgitika merged commit e966cb6 into main Apr 20, 2026
22 of 23 checks passed
@notgitika notgitika deleted the fix/invoke-session-id-logging branch April 20, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agentcore invoke local log always shows Session ID: none even when --session-id is provided

3 participants