Skip to content

fix(run-insights): TUI wizard state, inline name validation, job history#1602

Merged
jariy17 merged 2 commits into
aws:mainfrom
notgitika:fix/run-insights-tui
Jun 29, 2026
Merged

fix(run-insights): TUI wizard state, inline name validation, job history#1602
jariy17 merged 2 commits into
aws:mainfrom
notgitika:fix/run-insights-tui

Conversation

@notgitika

@notgitika notgitika commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Four fixes to the agentcore run insights interactive wizard, from the Lens-in-CLI bug bash:

  • Single-agent flow leaves Confirm blank. When the project has exactly one agent, the wizard skipped the agent step but never populated config.agent, so the Confirm screen showed an empty Agent: line. The default config now pre-populates the sole agent so it threads through to confirm and the API call.

  • Inline name validation. The Name step accepted spaces / hyphens / leading digits and only blew up after submit with a service 400. We now validate inline using the service-side BatchEvaluationName shape (^[a-zA-Z][a-zA-Z0-9_]{0,47}$) from AgentCoreEvaluationCommonModel. Lookback days also validate inline (1-90, integer only) instead of silently coercing 0 → 7.

  • Preserve config on error. Hitting "Go back" from a launch error reset the entire wizard. The failed config is now stashed in flow state and the wizard re-opens at the Name step with all prior selections intact.

  • Post-launch "No insights runs found". The wizard wrote to the job-engine store, but the post-launch "View Insights Jobs" screen reads from the legacy .cli/insights/*.json store. We now mirror successful starts to the legacy store after launch so the new job appears immediately.

…inline, surface job in history

Multiple fixes to the `agentcore run insights` interactive wizard:

- **Single-agent flow** (#4): when the project has exactly one agent, the
  wizard skipped the agent step but never set `config.agent`, so the
  Confirm screen showed a blank "Agent:" line. Pre-populate the sole
  agent in the default config so it's threaded through to confirm and
  the API call.

- **Inline name validation** (aws#6): the Name step accepted invalid values
  (spaces, hyphens, leading digits) and only failed at submit time when
  the API returned a 400. Validate inline against the service-side
  `BatchEvaluationName` pattern (`^[a-zA-Z][a-zA-Z0-9_]{0,47}$`).
  Lookback days now also validate inline (1-90, integer only) instead of
  silently coercing 0 to 7.

- **Preserve config on error** (aws#16): when the launch failed, hitting
  "Go back" reset the wizard to the Source step and discarded all
  selections. Now the failed config is stashed in flow state and the
  wizard re-opens at the Name step with everything pre-populated.

- **Post-launch history** (aws#17): the wizard wrote to the job-engine store
  but `view insights` reads from the legacy `.cli/insights/*.json`
  store, so the brand-new job rendered as "No insights runs found".
  Mirror successful starts to the legacy store after launch.

Bug bash items #4, aws#6, aws#16, aws#17 (mix of P1/P2).
@notgitika notgitika requested a review from a team June 22, 2026 03:06
@github-actions github-actions Bot added the size/m PR size: M label Jun 22, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026
@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-0.20.2.tgz

How to install

gh release download pr-1602-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.20.2.tgz

@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 22, 2026

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice, focused fixes for the bug bash items. Two things I'd like addressed before merge:

  1. The new forwardRef / useImperativeHandle / jumpToStep surface on RunInsightsScreen appears to be dead code — nothing in the tree passes a ref, and resume-on-error works entirely through the new initialConfig / initialStep props (the screen re-mounts when RunInsightsFlow transitions from error back to wizard). Either wire it up to a caller or drop it; otherwise it adds an API contract that's unused, untested, and (in React 19) unnecessary.
  2. The two new pure validators are good candidates for a small unit test. There are no tests under src/cli/tui/screens/run-insights/ at all, and three of the four fixes here (single-agent default, inline name validation, resume-on-error) are reachable via the wizard hook + pure helpers without any TUI rendering. A small validateJobName / validateLookbackInput / useRunInsightsWizard test file would lock these in cheaply.

One smaller suggestion inline about the silent catch in persistToLegacyStore.

Comment thread src/cli/tui/screens/run-insights/RunInsightsScreen.tsx Outdated
Comment thread src/cli/tui/screens/run-insights/useRunInsightsWizard.ts Outdated
Comment thread src/cli/tui/screens/run-insights/RunInsightsFlow.tsx Outdated
@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Jun 22, 2026

@jariy17 jariy17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have one blocking comment.

Comment thread src/cli/tui/screens/run-insights/RunInsightsFlow.tsx Outdated
…gine store

Addresses review feedback:
- Remove unused forwardRef, useImperativeHandle, RunInsightsScreenHandle,
  and jumpToStep — resume-on-error works through initialConfig/initialStep.
- Replace persistToLegacyStore workaround: InsightsJobsScreen now reads
  directly from the job engine store (listRecords), eliminating the
  two-source-of-truth problem.
@github-actions github-actions Bot removed the size/m PR size: M label Jun 29, 2026
@github-actions github-actions Bot added the size/m PR size: M label Jun 29, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Jun 29, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Jun 29, 2026
@jariy17 jariy17 merged commit 3874af6 into aws:main Jun 29, 2026
32 of 33 checks passed
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.

3 participants