Skip to content

Conversation

@michaelos443
Copy link

Problem

When a user presses Ctrl-C twice in a row, the application currently prints two different interrupt messages:

  1. "⚠️ Process interrupted by user" from run_interactive_session()
  2. "⚠️ Application interrupted by user" from main()

This creates a confusing user experience with duplicate messages.

Solution

This PR implements a clean fix using an interrupt tracking flag:

  • Added _interrupt_handled flag to the CLIApp class to track whether a KeyboardInterrupt has already been handled
  • Updated run_interactive_session() to set the flag when it handles a KeyboardInterrupt
  • Updated main() to check the flag before printing its own interrupt message

Result

Now only one clean interrupt message is displayed, regardless of how many times Ctrl-C is pressed. The fix maintains existing behavior while eliminating the duplicate message issue.

Changes

  • Modified cli/cli_app.py:
    • Added _interrupt_handled instance variable
    • Updated KeyboardInterrupt handlers in both run_interactive_session() and main()

Testing

The fix can be tested by:

  1. Running the CLI application
  2. Pressing Ctrl-C once or multiple times
  3. Verifying only one interrupt message is displayed

Pull Request opened by Augment Code with guidance from the PR author

…subcommands

- Restructure CLI entry point using Click framework
- Rename main() to run_interactive_cli() for clarity
- Create @click.group() decorator for cli() as main entry point
- Add 'run' subcommand for interactive session (default behavior)
- Add 'config' subcommand placeholder for future configuration management
- Add 'clean' subcommand with --cache, --logs, --all options
- Update cli/__init__.py exports to use new cli and run_interactive_cli
- Update cli_launcher.py to use Click CLI structure
- Add click>=8.0.0 to requirements.txt
- Create CLI_COMMANDS.md documentation with usage examples

Benefits:
- Extensible architecture for adding new subcommands without touching main logic
- Professional CLI using industry-standard Click framework
- Built-in --help and --version support
- Backward compatible with existing workflows
- Self-documenting commands
…t strings

- Add _truncate_result() helper method in CLIWorkflowAdapter
- Truncate repo_result at source (max 1000 chars) before returning
- Remove redundant slicing in cli_app.py display_results()
- Improves memory efficiency by avoiding building large strings only to discard them
- Single source of truth via MAX_RESULT_LENGTH constant
- Added _interrupt_handled flag to track if KeyboardInterrupt was already handled
- Updated run_interactive_session() to set flag when handling interrupt
- Updated main() to check flag before printing duplicate message
- Ensures only one clean interrupt message is displayed regardless of how many times Ctrl-C is pressed
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.

1 participant