fix: dont show deploy screen when deploy is skipped#1585
Conversation
|
Claude Security Review: no high-confidence findings. (run) |
Package TarballHow to installgh release download pr-1585-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-0.20.1.tgz |
agentcore-cli-automation
left a comment
There was a problem hiding this comment.
Nice cleanup — eliminating the alt-screen flash for harness-only projects with no pending changes is a real UX win. Two issues worth addressing before merging, plus a note about test coverage.
| otelEnvVars, | ||
| collector, | ||
| }), | ||
| }; |
There was a problem hiding this comment.
Behavior change: harness pre-selection is lost on the new fast path.
For a harness-only project with a single harness and an up-to-date deploy, the previous flow rendered DevScreen, which set selectedHarness = harnesses[0] and called onLaunchBrowser({ harnessName }), so runBrowserMode was invoked with harnessName: harnesses[0] and the web UI opened with that harness pre-selected.
This new branch (needsTuiDeploy === false) bypasses the TUI entirely and calls runBrowserMode with no harnessName and agentName: opts.runtime (which is undefined for harness-only projects). End result: the user lands in the web UI without anything pre-selected, even though we know exactly which harness they want.
This also affects --skip-deploy for harness-only projects, which now follows this same fast path.
Two ways to fix:
- Resolve the harness name here in
command.tsxbefore callingrunBrowserMode(mirrorDevScreen's logic: whenisHarnessOnly && project.harnesses?.length === 1, passharnessName: project.harnesses[0].name). - Keep the gate but plumb the resolution through — e.g., still compute
pickerResult-like selection here so both branches converge on the samerunBrowserModecall.
Option 1 is the smaller change.
There was a problem hiding this comment.
not needed. web ui auto-selects the first option in dropdown if nothing is supplied
| } catch { | ||
| return false; | ||
| } | ||
| } |
There was a problem hiding this comment.
isDeploySkippable() constructs a fresh new ConfigIO() with no arguments, which auto-discovers from process.cwd(). The two new callers (command.tsx and DevScreen.tsx) both already have a workingDir in scope, and DevScreen in particular receives it as a prop that may not equal cwd.
In practice these are usually the same, but it's a footgun for any future caller and means this helper silently ignores the workingDir that DevScreen was explicitly given. Suggest taking an optional baseDir (or configIO) parameter and threading workingDir through from the call sites. The existing canSkipDeploy(configIO) signature is a good model.
There was a problem hiding this comment.
I had initially passed in workingDir but it didnt work because config lives in agentcore folder, so ConfigIO wasnt able to find config in the project root. calling new ConfigIO() with no arguments is fine since the cdk package calls findConfigRoot
| } catch { | ||
| return false; | ||
| } | ||
| } |
There was a problem hiding this comment.
Missing test coverage. No tests were added for isDeploySkippable or for the two new branching paths in command.tsx / DevScreen.tsx. Given that this is a fix for buggy UX behavior and the surrounding logic is non-trivial (multiple skipDeploy sources, harness-only vs mixed projects, browser vs terminal mode), please add at least:
- Unit tests for
isDeploySkippablecovering the happy path, theensureDefaultDeploymentTargetfailure path, and thecanSkipDeployerror path (all should fall through tofalse). - A test that exercises the
DevScreenharness-only branch whenskipDeploy=truevs when changes are detected, since that branch is the last line of defense for the terminal mode.
Problems
agentcore dev --skip-deploystill shows "Deploying project resources..." TUI — The--skip-deployflag was passed to the deploy hook, which skipped the actual deploy but still rendered the deploy screen for a frame before resolving.agentcore devon an already-deployed harness project briefly flashes the TUI — Browser mode always entered the alt-screen TUI (launchTuiDevScreenWithPicker) even when there was nothing to deploy, causing a visible terminal flicker before the browser opened.Mixed projects (agent + harness) auto-deployed on
agentcore dev— ThelaunchBrowserDev()path (TUI → dev) unconditionally calledrunCliDeploy()whenever harnesses existed, regardless of whether the project also had agents.Terminal harness chooser appeared in browser mode — When a project had multiple agents or harnesses, the terminal selection list appeared even in browser mode (default
agentcore dev), where the web UI should handle selection.Multi-harness projects only supported single-harness auto-deploy — The harness-only branch in DevScreen required exactly 1 harness (
harnesses.length === 1), so projects with 2+ harnesses fell through to the chooser without deploying.Solutions
Check
isDeploySkippable()before entering deploy mode — Bothcommand.tsx(browser mode) andDevScreen.tsx(terminal mode) now callisDeploySkippable()before settingmode = 'deploying'. If the flag is set or no CDK changes exist, deploy UI is never rendered.Gate TUI entry on whether deploy is actually needed — In
command.tsx, the preview browser path now checksisDeploySkippable()first. Only when deploy is genuinely needed does it enterlaunchTuiDevScreenWithPicker. Otherwise it goes straight torunBrowserMode()— no alt-screen, no flicker.Only auto-deploy for harness-only projects —
launchBrowserDev()now checkshasHarnesses && !hasRuntimesbefore deploying. Mixed projects skip deploy entirely and let the web UI handle everything.Browser mode skips the terminal chooser for all project types — The
onLaunchBrowserauto-launch condition is widened fromagents.length === 1toagents.length > 0. Multi-agent and mixed projects immediately launch the browser, passing no pre-selection so the web UI shows the picker.Harness-only branch handles any number of harnesses — Changed from
harnesses.length === 1 && agents.length === 0toharnesses.length > 0 && agents.length === 0. Single-harness is pre-selected; multi-harness defers selection to post-deploy (terminal chooser or web UI).Shared utility:
isDeploySkippable()Extracted to
src/cli/operations/deploy/change-detection.ts. Bundles the repeated pattern ofnew ConfigIO()→ensureDefaultDeploymentTarget()→canSkipDeploy(). Used by:command.tsx— gates whether to enter the TUI at all (browser mode)DevScreen.tsx— gates whether to show deploy UI (terminal mode)browser-mode.ts— gates whetherlaunchBrowserDev()(TUI → dev) runs deployBefore / After
Browser mode (
agentcore dev) on deployed harness project (no changes)Before: Alt-screen enters → "Deploying project resources..." flashes → resolves instantly → exits → browser opens
After: Browser opens immediately. No terminal flicker.
agentcore dev --skip-deployon harness projectBefore: Alt-screen enters → "Deploying project resources..." appears for one frame → skips → exits → browser opens
After: Browser opens immediately. No deploy UI rendered at all.
agentcore devon mixed project (agent + harness)Before: TUI chooser appears in terminal, user must select before browser opens. If harness selected, deploy runs.
After: Browser opens immediately with no chooser. Web UI shows both agent and harness options. No auto-deploy.
agentcore dev --no-browseron multi-harness project (needs deploy)Before: Chooser appeared immediately (user had to pick before deploy started, only single-harness was supported)
After: Deploy runs first (for all harnesses), then chooser appears so user can pick which to invoke.
Test Plan
agentcore devopens browser immediately, no flashagentcore devopens browser, no deploy, no chooseragentcore devopens browser, no flash, no "Deploying" UIagentcore devshows deploy progress, then opens browser--skip-deployon any harness project: no deploy UI ever rendered--no-browseron multi-harness: deploys first, then shows terminal chooser