Skip to content

fix(invoke): show full session ID and print resume command on exit#904

Merged
aidandaly24 merged 2 commits intomainfrom
fix/invoke-session-id-display
Apr 22, 2026
Merged

fix(invoke): show full session ID and print resume command on exit#904
aidandaly24 merged 2 commits intomainfrom
fix/invoke-session-id-display

Conversation

@aidandaly24
Copy link
Copy Markdown
Contributor

@aidandaly24 aidandaly24 commented Apr 21, 2026

Description

The invoke TUI truncated the session ID to 8 characters (550e8400), making it impossible to copy the full UUID needed for agentcore invoke --session-id <id> to resume a session. Additionally, there was no guidance on how to resume a session after exiting.

This PR:

  • Displays the full session ID in the TUI header instead of truncating to 8 chars
  • Prints a colored resume command (agentcore invoke --session-id <full-uuid>) after TUI exit
  • Uses Ink's unmount() instead of process.exit(0) for clean shutdown, which also fixes the update notifier not appearing on Esc exit
Screenshot 2026-04-21 at 3 34 25 PM

Related Issue

Closes #

Documentation PR

N/A

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

Manually tested all exit paths:

  • Ctrl+C: Resume message and update notifier both display ✅

  • Double Esc: Resume message and update notifier both display ✅

  • agentcore invoke (direct): Works correctly ✅

  • agentcore → invoke (TUI): Works correctly ✅

  • Session resumption: Copied session ID from output, used --session-id flag to resume successfully ✅

  • I ran npm run test:unit and npm run test:integ

  • I ran npm run typecheck

  • I ran npm run lint

  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

The invoke TUI truncated the session ID to 8 characters, making it
impossible to copy the full UUID needed for --session-id. Additionally,
there was no guidance on how to resume a session after exiting.

- Display full session ID in the TUI header instead of truncating
- Print a colored resume command after TUI exit (both Esc and Ctrl+C)
- Use Ink's unmount() instead of process.exit(0) for clean shutdown,
  which also fixes the update notifier not showing on Esc exit
@aidandaly24 aidandaly24 requested a review from a team April 21, 2026 19:39
@github-actions github-actions Bot added the size/s PR size: S label Apr 21, 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-904-tarball/aws-agentcore-0.9.1.tgz

@jesseturner21
Copy link
Copy Markdown
Contributor

The useEffect that sets the exit message will cause issues when InvokeScreen is used from the main TUI (agentcore → invoke → Esc → help → exit). The message is set as soon as a session is created, but it's never cleared when the user navigates away from the invoke screen. This means users will see "To resume this session..." even if they left invoke and did other things before exiting.

Options to fix:

  1. Add a cleanup function to clear the message on unmount:
useEffect(() => {
  if (sessionId) {
    const cyan = '\\x1b[36m';
    const reset = '\\x1b[0m';
    setExitMessage(`To resume this session, run: ${cyan}agentcore invoke --session-id ${sessionId}${reset}`);
  }
  return () => clearExitMessage();
}, [sessionId]);
  1. Only set the message when actually exiting (similar to how CreateScreen does it) - wrap the onExit prop to set the message before calling it:
const handleExit = useCallback(() => {
  if (sessionId) {
    const cyan = '\\x1b[36m';
    const reset = '\\x1b[0m';
    setExitMessage(`To resume this session, run: ${cyan}agentcore invoke --session-id ${sessionId}${reset}`);
  }
  onExit();
}, [sessionId, onExit]);

Then use handleExit instead of onExit throughout the component.

Option 1 is simpler but means the message won't show if the user navigates away and then exits. Option 2 ensures the message only shows when exiting directly from invoke, which matches the CreateScreen pattern.

Comment thread src/cli/commands/invoke/command.tsx
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.43% 7169 / 16895
🔵 Statements 41.84% 7602 / 18169
🔵 Functions 40.14% 1273 / 3171
🔵 Branches 41.02% 4803 / 11708
Generated in workflow #1872 for commit 318f690 by the Vitest Coverage Report Action

@github-actions github-actions Bot added size/s PR size: S and removed size/s PR size: S labels Apr 21, 2026
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.

LGTM

@aidandaly24 aidandaly24 merged commit ce683c0 into main Apr 22, 2026
23 checks passed
@aidandaly24 aidandaly24 deleted the fix/invoke-session-id-display branch April 22, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants