Skip to content

feat(tui): add dedicated Logs screen for streaming runtime logs#1274

Open
notgitika wants to merge 6 commits into
aws:mainfrom
notgitika:feat/tui-logs-screen
Open

feat(tui): add dedicated Logs screen for streaming runtime logs#1274
notgitika wants to merge 6 commits into
aws:mainfrom
notgitika:feat/tui-logs-screen

Conversation

@notgitika
Copy link
Copy Markdown
Contributor

Summary

  • Adds a new TUI screen for streaming deployed agent CloudWatch runtime logs in real-time
  • Removes logs from the CLI-only command list so it's now accessible directly from the TUI menu
  • Users can select a deployed agent and stream logs with full-screen view support (press l)

Implementation

  • useLogsStream hook: manages CloudWatch streamLogs lifecycle with abort/cleanup, auto-detects log levels, caps buffer at 1000 entries
  • LogsScreen component: phases through loading → agent selection (if multiple) → streaming view with error handling
  • Reuses existing FullScreenLogView for scrollable full-screen log viewing

Test plan

  • Typecheck passes (tsc --noEmit)
  • Lint passes (eslint)
  • All 663 TUI unit tests pass
  • TUI harness e2e: logs command appears in menu (not CLI-only)
  • TUI harness e2e: selecting logs navigates to Logs screen
  • TUI harness e2e: error states render correctly (no deploy, no runtimes)
  • TUI harness e2e: streaming phase shows agent name, region, status
  • TUI harness e2e: Esc navigates back to command list

Closes #565

Adds a TUI screen for streaming deployed agent CloudWatch logs,
replacing the previous CLI-only help page. Users can now select
a deployed agent and stream logs in real-time from the TUI menu.

Closes aws#565
@notgitika notgitika requested a review from a team May 15, 2026 19:14
@github-actions github-actions Bot added the size/m PR size: M label May 15, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.13.1.tgz

How to install

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

Copy link
Copy Markdown

@agentcore-cli-automation agentcore-cli-automation left a comment

Choose a reason for hiding this comment

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

Nice addition — the screen flow (loading → optional agent select → streaming, with full-screen handoff) is clean and the abort-on-unmount logic in useLogsStream looks correct. A couple of things I think should be addressed before merging:

  1. The inline streaming view advertises arrow-key scrolling in its help text but doesn't actually implement it — only l is wired up. Either remove the misleading hint or implement scrolling.
  2. No unit tests are included for the new hook or screen, even though comparable code in this repo (e.g. useInvokeFlow, AddScreen) is covered. The PR description says 663 TUI tests pass, but none of them exercise this new code path.

Details inline.

Comment thread src/cli/tui/screens/logs/LogsScreen.tsx Outdated
Comment thread src/cli/tui/hooks/useLogsStream.ts
const [loadError, setLoadError] = useState<string | undefined>();
const [showFullScreen, setShowFullScreen] = useState(false);

const { logs, isStreaming, error: streamError } = useLogsStream(selectedAgent);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Minor robustness note: useLogsStream(selectedAgent) re-runs its effect whenever the selectedAgent reference changes. Since selectedAgent is set once from agents[selectedIndex] (a stable reference from state), this is fine in practice — but if you ever add a "refresh / reconnect" action that constructs a new AgentContext object with the same fields, you'd get an infinite-stream-restart loop. Consider keying the effect on agentContext.agentId (and friends) instead of the object identity, or memoizing the context. Not a blocker.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label May 15, 2026
- Remove misleading "↑↓ scroll" from inline streaming view help text
  since scrolling is only available in the full-screen view (press l)
- Add unit tests for useLogsStream hook (7 tests covering idle state,
  streaming, error handling, abort cleanup, and buffer cap)
- Add unit tests for LogsScreen (5 tests covering all phase transitions)
@github-actions github-actions Bot added size/l PR size: L and removed size/m PR size: M labels May 15, 2026
- Replace manual slice with LogPanel component (built-in ↑↓ scrolling,
  auto-scroll to bottom, page up/down)
- Add level filter shortcuts: 1=all, 2=errors, 3=warn+, 4=info+
- Change full-screen key from l to f (l conflicts with scroll)
- Show filter status and count in header
@github-actions github-actions Bot added size/l PR size: L and removed size/l PR size: L labels May 15, 2026
- Set fixed height on LogPanel container to prevent header from being
  pushed off screen when logs accumulate
- Remove redundant info+ filter (same as all), keep 1=all 2=errors 3=warn+
@github-actions github-actions Bot added size/l PR size: L and removed size/l PR size: L labels May 15, 2026
Add overflow="hidden" to the LogPanel container so long wrapped log
lines don't overflow past the fixed height and corrupt the help text.
@github-actions github-actions Bot removed the size/l PR size: L label May 15, 2026
@github-actions github-actions Bot added the size/l PR size: L label May 15, 2026
… default

Explicitly detect info level (gray/dim) separately from unclassified
logs which now render as system level (cyan, readable). Errors stay
red, warnings stay yellow.
@github-actions github-actions Bot added size/l PR size: L and removed size/l PR size: L labels May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/l PR size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add logs in the TUI

2 participants