fix(cli): Converge dev onto the in-TUI error pattern. DevScreen alr... (#1588)#70
Draft
aidandaly24 wants to merge 1 commit into
Draft
fix(cli): Converge dev onto the in-TUI error pattern. DevScreen alr... (#1588)#70aidandaly24 wants to merge 1 commit into
aidandaly24 wants to merge 1 commit into
Conversation
…ects TUI dev menu path only; converges the no-agent dev flow onto the existing in-TUI DevScreen error pattern (mirroring logs). No change to the standalone `agentcore dev` CLI command, browser-mode.ts exit guards, or the agent-present/harness-only browser-launch behavior. Refs aws#1588
Coverage Report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs aws#1588
Issues
Root cause
Verified at v0.20.2: TUI dev menu entry (App.tsx:144-147) does setExitAction({type:'dev'})+exit() with no agent pre-check; render.ts:70-74 then calls launchBrowserDev() (browser-mode.ts:119) which does console.error+process.exit(1) at lines 123-126/131-134 for agent-less projects. loadProjectConfig (config.ts:139-157) returns non-null for an existing-but-empty project so the !project guard misses it. logs instead routes to an in-TUI error screen (App.tsx:156-157 -> LogsScreen.tsx:78-83). The standalone
agentcore devCLI command throws ValidationError (command.tsx:327-331, caught+printed) and never calls launchBrowserDev, so the raw exit is reachable only via the menu exit-action path.The fix
Converge dev onto the in-TUI error pattern. DevScreen already implements a noAgentsError in-TUI screen (DevScreen.tsx:500-518) mirroring LogsScreen; route the menu dev selection through an in-TUI DevScreen path (the launchTuiDevScreenWithPicker mechanism already used by the standalone command at command.tsx:514) instead of setExitAction+exit, so the error renders in-app. Keep browser-mode.ts:123-134 process.exit(1) as a CLI-only backstop. Add a regression test under src/cli/tui/screens/dev/tests/ paralleling LogsScreen.test.tsx. Precedent: PR aws#1575 fixed the same early-exit class for web-search/no-gateway.
Files touched: src/cli/tui/App.tsx:144-147 (dev menu branch — route to in-TUI DevScreen instead of setExitAction+exit); src/cli/commands/dev/browser-mode.ts:123-134 (process.exit(1) guards demoted to CLI-only backstop) and the existing launchTuiDevScreenWithPicker at browser-mode.ts:328; reuse src/cli/tui/screens/dev/DevScreen.tsx:500-518 noAgentsError branch; pattern reference src/cli/tui/screens/logs/LogsScreen.tsx:78-83; new regression test under src/cli/tui/screens/dev/tests/ mirroring src/cli/tui/screens/logs/tests/LogsScreen.test.tsx
Validation evidence
The fix was verified by reproducing the original symptom and re-running after the change:
AFTER (fixed build, App.tsx routes dev menu via setRoute({name:'dev'}) -> in-TUI DevScreen): same steps render the in-app DevScreen error screen while the TUI stays alive (bufferType remains "alternate"): title "Dev Server", "No agents or harnesses defined in project.", "Dev mode requires at least one agent with an entrypoint or a harness.", "Run agentcore add agent to create one.", helpText "Esc quit". Pressing Esc returns to the main Commands menu (TUI not exited, navigation continues). Confirmed parity: selecting "logs" in the same project shows its own in-TUI error ("No runtimes defined in agentcore.json", "Esc back") and likewise stays in-TUI. No bare error line and no exit code 1 from the dev menu action. browser-mode.ts:123-134 process.exit(1) CLI backstop guards remain unchanged.
Test suite: green.
Staged on the fork as a draft for human review. Promote to aws/agentcore-cli after vetting.