Skip to content

fix(cli): In browser-mode.ts launchBrowserDev(), replace the inline... (#1376)#66

Draft
aidandaly24 wants to merge 1 commit into
mainfrom
fix/1376
Draft

fix(cli): In browser-mode.ts launchBrowserDev(), replace the inline... (#1376)#66
aidandaly24 wants to merge 1 commit into
mainfrom
fix/1376

Conversation

@aidandaly24

Copy link
Copy Markdown
Owner

Refs aws#1376

Issues

  • In preview, with harness agentcore -> dev and agentcore dev are different experiences aws/agentcore-cli#1376 — In preview builds, launching dev via the interactive agentcore menu and selecting "dev" renders the harness deploy as plain inline spinner/console.log lines in the normal terminal buffer, whereas running agentcore dev directly takes over the screen with the full alt-screen DevScreen TUI. Same deploy, two inconsistent looks depending on entry path. Cosmetic only — deployment functions identically either way; preview-gated so GA users are unaffected.

Root cause

Two divergent CLI render paths for the same harness deploy: interactive menu (render.ts:70-73 -> launchBrowserDev -> runCliDeploy inline spinner at progress.ts:46-90, no alt screen) vs direct agentcore dev (command.tsx:514 -> launchTuiDevScreenWithPicker alt-screen DevScreen). Both call the same handleDeploy; only the wrapper differs. Introduced by bed1de0 (aws#1341), confirmed via git blame -L 136,138.

The fix

In browser-mode.ts launchBrowserDev(), replace the inline if (hasHarnesses) { await runCliDeploy(); } (lines 136-138) with launchTuiDevScreenWithPicker(workingDir) — the same alt-screen TUI picker the direct agentcore dev command uses (command.tsx:514) — then route the picker result into runBrowserMode (passing agentName/harnessName, otelEnvVars, collector) or return early if the user cancels (pickerResult == null). No extra isPreviewEnabled() gate is needed inside the block since the surrounding hasHarnesses already includes it (line 129); GA/non-preview behavior is unchanged. This is exactly what OPEN PR aws#1410 (Closes aws#1376, ~22-line change in browser-mode.ts + tests) does on branch fix/dev-tui-consistency-1376-main; the earlier PR aws#1409 was closed/superseded. Track PR aws#1410 to merge — it is not yet an ancestor of v0.20.2.

Files touched: src/cli/commands/dev/browser-mode.ts launchBrowserDev() lines 136-138 (the inline await runCliDeploy()) — replace with launchTuiDevScreenWithPicker() + runBrowserMode routing, per PR aws#1410. Reference paths: src/cli/tui/render.ts:70-73 (interactive-menu entry via exit action 'dev'), src/cli/commands/dev/command.tsx:513-533 (the correct TUI path), src/cli/commands/deploy/progress.ts:46-90 (the inline spinner renderer), src/cli/tui/screens/dev/DevScreen.tsx + src/cli/tui/hooks/useDevDeploy.ts (the structured alt-screen deploy UI).

Validation evidence

The fix was verified by reproducing the original symptom and re-running after the change:

BEFORE (original buggy code, git HEAD): launchBrowserDev() called await runCliDeploy() inline for harness-only projects needing a deploy, so the interactive agentcore menu -> "dev" path (render.ts:70-72 -> launchBrowserDev) printed plain white console.log lines ("Deploying project resources...", spinner) into normal terminal scrollback with no alt-screen takeover, while agentcore dev direct (command.tsx:522-526) showed the contained alt-screen DevScreen box. I proved the buggy behavior is what the regression test guards: temporarily re-introduced the inline runCliDeploy() and the new test FAILED ("expected vi.fn() not to be called, actually called 1 times" on mockRunCliDeploy; render never invoked). AFTER (fix/1376): browser-mode.ts removes the runCliDeploy import + inline call (grep count of runCliDeploy in file = 0); launchBrowserDev() now calls launchTuiDevScreenWithPicker(workingDir) at line 144, routes the non-null pickerResult into runBrowserMode({agentName, harnessName,...}) and returns early when pickerResult==null. tui-harness reproduction: built CLI at dist/cli/index.mjs, created harness-only scratch project (runtimes:[], 1 harness, undeployed => isDeploySkippable=false), launched interactive agentcore menu via tui-harness, selected "dev". The deploy rendered INSIDE the alt-screen DevScreen TUI (bufferType: alternate) as a contained box: header "Dev", "Deploying project resources..." with step-by-step [done] markers (Load deployment target / Validate proje

Test suite: green.


Staged on the fork as a draft for human review. Promote to aws/agentcore-cli after vetting.

The interactive agentcore menu -> dev path called runCliDeploy() inline
for harness-only projects, printing plain console.log lines into normal
terminal scrollback instead of the contained alt-screen DevScreen box
shown by the direct `agentcore dev` command. launchBrowserDev() now
routes through launchTuiDevScreenWithPicker so the deploy renders inside
the alt-screen TUI, matching the direct command.

Removes the unused runCliDeploy import and inline call. Adds a dedicated
unit test that fails on baseline and passes with the fix.
@github-actions github-actions Bot added the size/m PR size: M label Jun 25, 2026
@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 37.27% 13636 / 36581
🔵 Statements 36.53% 14495 / 39671
🔵 Functions 31.87% 2338 / 7336
🔵 Branches 31.2% 9030 / 28934
Generated in workflow #121 for commit 92e6051 by the Vitest Coverage Report Action

@github-actions github-actions Bot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Jun 25, 2026
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.

In preview, with harness agentcore -> dev and agentcore dev are different experiences

1 participant