Skip to content

refactor: migrate shell to persistent PTY architecture#85

Merged
F16shen merged 21 commits intoAI-Shell-Team:mainfrom
F16shen:bash
Apr 2, 2026
Merged

refactor: migrate shell to persistent PTY architecture#85
F16shen merged 21 commits intoAI-Shell-Team:mainfrom
F16shen:bash

Conversation

@F16shen
Copy link
Copy Markdown
Collaborator

@F16shen F16shen commented Mar 30, 2026

Summary

  • switch the default shell flow to the persistent PTY implementation
  • remove legacy shell and TUI code paths and consolidate shell logic under src/aish/shell
  • reorganize shell tests under tests/shell and fix the Makefile test entry to use python -m pytest

Testing

  • make test
  • python -m pytest tests/shell -q

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for the pull request. A maintainer will review it when available.

Please keep the PR focused, explain the why in the description, and make sure local checks pass before requesting review.

Contribution guide: https://github.com/AI-Shell-Team/aish/blob/main/CONTRIBUTING.md

@github-actions
Copy link
Copy Markdown
Contributor

This pull request description looks incomplete. Please update the missing sections below before review.

Missing items:

  • User-visible Changes
  • Compatibility
  • Change Type
  • Scope

@github-actions github-actions Bot added dependencies Pull requests that update a dependency file docs pty PTY or interactive process issue packaging Packaging or installation issue core config cli tests builtin i18n size: XL experienced-contributor tools labels Mar 30, 2026
- Fix prompt ANSI escape sequences with \[...\] for correct readline width
- Add last command to AISH_EXIT marker for better exit tracking
- Improve PTY manager with enhanced process control
- Refine error correction flow in AI handler and shell app
- Update code execution tool with improved output handling
- Fix mypy errors in _add_entry_sync calls
F16shen and others added 8 commits March 31, 2026 10:43
- Extract _execute_ai_operation() to deduplicate AI state management,
  history recording, and async execution with cancellation across
  handle_error_correction and handle_question
- Add _trigger_prompt_and_wait() to consolidate prompt redraw logic
- Add atomic interrupt dedup (try_acquire_interrupt) to prevent
  signal handler and input router from both processing the same Ctrl+C
- Support Ctrl+C interruption during AI operations with polling-based
  cancellation in _run_async_in_thread
- Add Esc key handling for clearing input mid-line
- Fix _set_raw_mode always called via finally blocks for reliable
  terminal state restoration
- Move request_choice from PTYUserInteraction to prompt_io module
- Add error hint suppression for clean Ctrl+C exit (no stray hints)
- Add terminal size and UI calculation helpers for modal display
- Fix history command format to remove internal sequence prefix
…mprovements

- Resolve merge conflicts in pty/manager.py (keep command_seq support)
- Resolve merge conflicts in test_shell_pty_core.py (keep extended tests)
- Retain ask_user modal UI wiring (INTERACTION_REQUIRED -> prompt_toolkit)
- Retain backend error suppression for programmatic commands
- Pass shared Console from PTYAIShell to AIHandler for consistent styling
- Replace raw ANSI escape codes with rich markup in error correction display
- Rename loop variable to fix mypy "Assignment outside except block" error
When the user presses 'q' to exit a pager like less/git-diff, the shell
receives exit code 141 (128+SIGPIPE). This is normal, not an error, so
don't show the error hint.
F16shen and others added 4 commits April 2, 2026 13:36
Move prompt rendering from bash RC to Python frontend. Theme scripts
receive git status and exit code via env vars. Includes caching to
avoid repeated git subprocess calls.
@jexShain jexShain force-pushed the bash branch 2 times, most recently from 04ab062 to 18533dd Compare April 2, 2026 05:40
@github-actions github-actions Bot added the agent Agent or LLM workflow issue label Apr 2, 2026
@F16shen F16shen requested a review from jexShain April 2, 2026 06:56
@F16shen F16shen merged commit 6e394ef into AI-Shell-Team:main Apr 2, 2026
9 checks passed
@F16shen F16shen deleted the bash branch April 14, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Agent or LLM workflow issue builtin cli config core dependencies Pull requests that update a dependency file docs experienced-contributor i18n packaging Packaging or installation issue pty PTY or interactive process issue size: XL tests tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants