Skip to content

fix: F5 debug launch not entering interactive mode - #100

Open
ayeshurun wants to merge 11 commits into
mainfrom
dev/alonyeshurun/fix-f5-interactive-launch
Open

fix: F5 debug launch not entering interactive mode#100
ayeshurun wants to merge 11 commits into
mainfrom
dev/alonyeshurun/fix-f5-interactive-launch

Conversation

@ayeshurun

Copy link
Copy Markdown
Owner

Problem

Pressing F5 and submitting an empty argument prompt printed the welcome banner and then exited with a bare Error in interactive session: instead of entering the REPL.

Reproduced locally. Two independent defects, both pre-existing (.vscode/launch.json is unchanged since the initial commit ac4dc95).

Root cause

1. .vscode/launch.json

  • The default configuration used "args": "${command:pickArgs}". An empty prompt yields [], so main.py correctly falls through to interactive mode — the prompt was just noise on the common path.
  • The second configuration used "console": "externalTerminal" with stopOnEntry, which cannot attach a terminal inside a dev container.
  • Both used the deprecated ${workspaceRoot} instead of ${workspaceFolder}.

2. src/fabric_cli/core/fab_interactive.py

EOFError is a subclass of Exception, so the loop's generic except Exception as e caught it before the outer except (EOFError, KeyboardInterrupt) — making that outer handler unreachable from inside the loop. Since str(EOFError()) is the empty string, the message printed was Error in interactive session: with nothing after it.

This affected two cases:

  • Ctrl+D on a normal terminal (should print the goodbye message).
  • Non-terminal stdin, where prompt_toolkit raises EOFError immediately at the first prompt.

Changes

.vscode/launch.json

  • Default config Fabric CLI Debug (Interactive): "args": [], "module": "fabric_cli.main", "console": "integratedTerminal". Interactive mode requires a TTY, which the Debug Console does not provide.
  • Second config Fabric CLI Debug (Prompt for args) keeps ${command:pickArgs} for one-shot commands, also on the integrated terminal.
  • Removed the externalTerminal / stopOnEntry configuration.
  • ${workspaceRoot}${workspaceFolder}.

src/fabric_cli/core/fab_interactive.py

  • Re-raise EOFError from the loop so the outer handler runs.
  • Split the outer handler into except EOFError and except KeyboardInterrupt. On EOFError, if stdin is not a TTY, additionally explain why interactive mode cannot start; the normal exit message is printed in both branches.

tests/test_core/test_fab_interactive.py

test_start_interactive_eof_error_failure asserted the buggy blank message, so it encoded the defect and had to be rewritten. Added coverage for terminal and non-terminal stdin. interactive_cli.session.prompt is a module-level mock shared through the InteractiveCLI singleton, so reset_mock() is required before asserting call_count.

Verification

  • Real TTY (via pty.fork): banner → fab:/$ prompt → exit → goodbye message.
  • Non-TTY stdin: banner → explanation → goodbye message, exit code 0. Previously: blank error.
  • python3 -m pytest tests/test_core tests/test_utils → 553 passed.
  • mypy clean on both changed files; black --check reports no new diffs (3 pre-existing violations in these files are left untouched).

Not verified

I could not determine why the reporter's debug session had non-terminal stdin — that requires VS Code and debugpy, which are not available in this environment. The fix handles every branch regardless, and the non-TTY case now reports its own cause rather than failing silently.

Alon Yeshurun and others added 11 commits August 2, 2026 14:34
AB#1694265

## Summary
Scaffold feature 1694265 and add the Fabric CLI-specific design and seven-slice implementation plan for Azure CLI authentication.

## Prompting Intent
Draft the repo design spec from the Feature Registry artifacts, create an implementation plan and task breakdown, and prepare the design readiness gate required before syncing tasks to ADO.

## Linked Sources
- Requirements spec: https://[email protected]/powerbi/Trident/_git/PlatformDevFeatureRegistry?path=/Features/active/1694265/requirements-spec.md
- Engineering design: https://[email protected]/powerbi/Trident/_git/PlatformDevFeatureRegistry?path=/Features/active/1694265/engineering-design.md
- Implementation handoff: https://[email protected]/powerbi/Trident/_git/PlatformDevFeatureRegistry?path=/Features/active/1694265/implementation-handoff.md
- Test plan: https://[email protected]/powerbi/Trident/_git/PlatformDevFeatureRegistry?path=/Features/active/1694265/test-plan.md

## Rationale
Translate the locked cross-cutting contract into concrete Fabric CLI modules and reviewable workstreams while leaving security, host-integration, and rollout decisions as explicit gates. Task work items are intentionally deferred until this design is merged, as required by the feature readiness policy.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 9c368147-9689-45f9-9f29-fc882429424b
chore: Draft Azure CLI authentication design AB#1694265
Co-authored-by: Aviat Cohen <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
)

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
The default launch configuration prompted for arguments via
${command:pickArgs}. Submitting an empty prompt yields no arguments, so
main falls through to interactive mode, but the session then ended
immediately after printing the welcome banner.

Two independent problems:

1. launch.json prompted for arguments on every F5 and offered a second
   configuration using "externalTerminal" with stopOnEntry, which cannot
   attach to a terminal inside a dev container. The default config now
   passes no arguments and always uses the integrated terminal, which
   interactive mode requires because prompt_toolkit needs a TTY. The
   argument prompt is kept as an explicitly named second configuration.
   ${workspaceRoot} is also replaced with the current ${workspaceFolder}.

2. start_interactive caught EOFError in the loop's generic
   "except Exception" branch, which made the outer
   "except (EOFError, KeyboardInterrupt)" handler unreachable from inside
   the loop. Because str(EOFError()) is the empty string, both Ctrl+D and
   a non-terminal stdin printed a bare "Error in interactive session:".
   EOFError is now re-raised so the session exits with its normal goodbye
   message, and a non-terminal stdin additionally explains the cause
   instead of exiting without a reason.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 0c37de44-e0a0-4090-8f7e-299889108578
@ayeshurun ayeshurun changed the title Fix F5 debug launch not entering interactive mode fix: F5 debug launch not entering interactive mode Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants