fix: handle ESC properly on policy generate selection screen - #2225
Conversation
|
Claude Security Review: no high-confidence findings. (run) |
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
This is a small, correct fix. The GatewayPolicyGenerateScreen picker has breadcrumb ["agentcore", "gateway", "policy", "generate"], so GatewayPicker's default onBack would navigate to /agentcore/gateway/policy, which in Root.tsx (lines 479–482) is just a <Navigate to="/agentcore/gateway/policy/generate" replace /> — i.e., it bounces right back to the picker. Explicitly wiring onEscape to /agentcore/gateway correctly skips the redirect-only route and lands on the Gateway menu.
The new test in generate.screen.test.tsx exercises the full picker → menu path and uses the standard TestCoreClient — no excessive mocking. Nothing to change here.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2225 +/- ##
=========================================
Coverage 97.05% 97.05%
=========================================
Files 555 555
Lines 38385 38386 +1
=========================================
+ Hits 37253 37254 +1
Misses 1132 1132 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…2234) * fix(tui): esc from a deep-linked harness wizard returns to the menu `agentcore harness create` with no flags opens the TUI directly on the wizard, so the wizard is the only history entry. Its first-step back was navigate(-1), which had nothing to pop, and esc did nothing. The wizard now takes an explicit onExit: create returns to the harness menu, update returns to the update picker. * test(tui): cover esc from every command with a screen Walk the compiled command tree, mount every screen-backed command through the real route table, press esc, and assert the header belongs to a menu above it. This is the counterpart to the command-line-only walk in CliOnlyScreen.test, so a screen added later is covered without a new test. It catches both the policy picker redirect loop (#2225) and the deep-linked wizard. compiledRootCommand() is extracted from the harness so tests can enumerate the tree the same way the app does. * fix(tui): keep the update wizard's escape as a history pop The update wizard is only reached from the update picker or the detail screen's update action, never as the first history entry, so a pop returns to whichever the user came from. Only the create wizard can be deep-linked and needs an explicit target. Note the same invariant at EndpointWizard's pop, which the route walk cannot reach because every route into it passes a picker first. * test(tui): reuse compiledRootCommand and note what the walk tolerates Drop the two inline root compiles now that the harness exports one, and record that the walk accepts any ancestor menu, so it catches a no-op or a loop but not an escape that jumps too far up.
Description
Fix an issue in
agentcore -> gateway -> policy -> generateTUI flow. ESC on the "choose gateway to generate policy for screen" caused an infinite redirection back to the gateway selection table. Solution changesonEscapeto direct you back to gateway management screen.Before:
Screen.Recording.2026-09-04.at.2.02.39.PM.mov
After
Screen.Recording.2026-09-04.at.2.03.55.PM.mov
Type of Change
Testing
How have you tested the change?
bun run test(2988 pass, 0 fail)npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.