fix(surgical): Establish a single source of truth for "this command cann... (#1589)#69
Draft
aidandaly24 wants to merge 1 commit into
Draft
fix(surgical): Establish a single source of truth for "this command cann... (#1589)#69aidandaly24 wants to merge 1 commit into
aidandaly24 wants to merge 1 commit into
Conversation
…wire feedback to its interactive screen (aws#1589) Derive CLI_ONLY_COMMANDS from CLI_ONLY_EXAMPLES keys so the cliOnly list-placement flag can never diverge from App.tsx dead-end routing. Remove feedback from CLI_ONLY_EXAMPLES and route it to the existing interactive FeedbackScreen. Drop the unused insights key. Add a coverage test asserting the two lists agree. Refs aws#1589
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#1589
Issues
feedbackandconfigappear in the MAIN (interactive) command list, but selecting them dead-ends on the "this command runs in the terminal" CliOnlyScreen instead of doing anything.feedbackis the worst case: it has a real interactive FeedbackScreen the TUI could render, but the TUI tells the user to go run it in the terminal instead. Meanwhile genuinely CLI-only commands behave a third way and preview-gatedexportsimply doesn't appear. Net effect is inconsistent, confusing UX across unsupported/partially-supported commands.Root cause
Two manually-synced lists have diverged: CLI_ONLY_COMMANDS (commands.ts:20) sets the cliOnly flag that HelpScreen.tsx:232,236 uses for list placement, while CLI_ONLY_EXAMPLES (copy.ts:68) controls App.tsx:138-142 dead-end routing. config (copy.ts:142) and feedback (copy.ts:138) are in the second but not the first and are registered unconditionally (cli.ts:101,122), so they render in the main interactive list (cliOnly=false) yet route to the CliOnlyScreen dead-end. feedback has a real FeedbackScreen (commands/feedback/command.tsx:27) the TUI never reaches. Verified at v0.20.2 by reading all files and running the coverage test (passes, so it does not catch this).
The fix
Establish a single source of truth for "this command cannot run interactively in the TUI" and reconcile membership, then enforce consistency in tests. Concretely: derive the
cliOnlyflag in commands.ts from the keys of CLI_ONLY_EXAMPLES (or vice versa) so a command can never be in the main list yet dead-end. Then decide membership per the issue author's lean toward hiding:feedbackshould NOT be CLI-only — wire its existing FeedbackScreen (commands/feedback/command.tsx:27) into App.tsx onSelectCommand so it opens interactively;configshould either get a tiny TUI screen or, at minimum, be flagged cliOnly consistently (or hidden via HIDDEN_FROM_TUI) so it isn't shown-then-dead-ended. Also drop the unusedinsightskey from CLI_ONLY_EXAMPLES. Strengthen app-command-coverage.test.ts to assert the two lists agree: every CLI_ONLY_EXAMPLES key that is a registered top-level command must be flagged cliOnly, and every cliOnly command must have examples. Design decision required: hide-all-unsupported vs show-in-CLI-only-section-with-usage; author recommends hide.Files touched: src/cli/tui/utils/commands.ts (CLI_ONLY_COMMANDS:20, HIDDEN_FROM_TUI:15, cliOnly derivation:56); src/cli/tui/copy.ts (CLI_ONLY_EXAMPLES:68 — feedback:138, config:142, unused insights:146); src/cli/tui/App.tsx (onSelectCommand CLI_ONLY_EXAMPLES branch:138-142, add a feedback route alongside FeedbackScreen); src/cli/tui/screens/home/HelpScreen.tsx (interactive vs cliOnly split:231-237); src/cli/tui/tests/app-command-coverage.test.ts (add list-consistency assertion)
Validation evidence
The fix was verified by reproducing the original symptom and re-running after the change:
PASS CONDITION 1 (feedback opens interactive screen): Tab -> command list -> filtered "feedback" -> Enter. AFTER FIX: opens the interactive Ink FeedbackScreen ("Message -> Screenshot -> Consent -> Submitting -> Done" stepper with "Tell us what's on your mind / Feedback" text input). It NO LONGER routes to the generic "this command runs in the terminal" CliOnlyScreen. BEFORE FIX (per symptom + code): feedback was in CLI_ONLY_EXAMPLES so App.tsx:140-142 short-circuited every feedback selection to the cli-only dead-end, while cliOnly=false placed it in the main interactive list.
PASS CONDITION 2 (config consistent): In the main interactive list, "config" is ABSENT. Pressing "/" reveals a separate "CLI only" section containing pause/resume/stop/traces/config/archive. Selecting CLI-only "config" routes to the CliOnlyScreen ("Usage: $ agentcore config"). So config is now flagged cliOnly consistently (CLI-only section AND dead-end route agree) instead of being in the main list while routing to the dead-end.
PASS CONDITION 3 (single source of truth): commands.ts:25 now derives CLI_ONLY_COMMANDS = new Set(Object.keys(CLI_ONLY_EXAMPLES)); the cliOnly flag (HelpScreen list placement) and App.tsx CLI_ONLY_EXAMPLES dead-end routing can no longer diverge.
PASS CONDITION 4 (test fails pre-fix, passes post-fix): Verified empirically.
Test suite: green.
Staged on the fork as a draft for human review. Promote to aws/agentcore-cli after vetting.