Skip to content

chore: Remove deprecated dead code from Rust runtime - #244

Merged
F16shen merged 2 commits into
AI-Shell-Team:mainfrom
F16shen:chore/remove-deprecated-dead-code
Jun 15, 2026
Merged

chore: Remove deprecated dead code from Rust runtime#244
F16shen merged 2 commits into
AI-Shell-Team:mainfrom
F16shen:chore/remove-deprecated-dead-code

Conversation

@F16shen

@F16shen F16shen commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Remove LiteLLMClient and the litellm-rs dependency; production uses LlmClient.
  • Remove legacy SystemDiagnoseAgent, create_diagnose_subsession, and ToolRegistry::default_tools.
  • Delete superseded state_capture module and unused stubs (mark_prompt_ready, hostname).

Codex/provider/oauth code is intentionally left for a follow-up wiring PR.

Test plan

  • make format-check
  • make lint
  • cargo test -p aish-llm -p aish-tools --lib --tests

Summary by CodeRabbit

  • Refactor

    • Consolidated LLM client implementations to use single OpenAI-compatible interface.
    • Removed legacy diagnostic agent and associated system prompts.
    • Simplified internal shell state tracking removal.
    • Streamlined session interceptor by removing unused prompt-ready hooks.
    • Cleaned up tool registry API for improved consistency.
  • Chores

    • Removed deprecated dependencies and internal utilities.
    • Updated internal module exports to reflect API simplifications.

@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
  • Testing
  • Change Type
  • Scope

@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@F16shen, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 19 minutes and 7 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 57aa41ed-5e8e-4f1f-9447-643eac5d2c94

📥 Commits

Reviewing files that changed from the base of the PR and between 4e3b91d and 82c2c19.

📒 Files selected for processing (1)
  • crates/aish-llm/tests/llm_integration_test.rs
📝 Walkthrough

Walkthrough

This PR removes deprecated and legacy APIs across three crates. In aish-llm, the litellm-rs dependency, LiteLLMClient, SystemDiagnoseAgent, and LlmSession::create_diagnose_subsession are deleted, with re-exports and integration tests updated for LlmClient. In aish-pty, the entire state_capture module and SessionInterceptor::mark_prompt_ready are removed. In aish-shell, the hostname() helper is dropped. In aish-tools, ToolRegistry::default_tools is replaced with drain_tools.

Changes

aish-llm: LiteLLM → LlmClient and legacy agent removal

Layer / File(s) Summary
LlmClient replaces LiteLLMClient; re-exports narrowed
crates/aish-llm/Cargo.toml, crates/aish-llm/src/client.rs, crates/aish-llm/src/lib.rs
Drops the litellm-rs dependency, removes LiteLLMClient and a stale streaming comment from client.rs, keeps LlmClient, and narrows lib.rs pub use to remove LiteLLMClient and SystemDiagnoseAgent.
Remove SystemDiagnoseAgent and create_diagnose_subsession
crates/aish-llm/src/agent.rs, crates/aish-llm/src/session.rs
Deletes SystemDiagnoseAgent (constructors and diagnose method) from agent.rs and removes LlmSession::create_diagnose_subsession from session.rs.
Integration tests updated for LlmClient
crates/aish-llm/tests/llm_integration_test.rs
Replaces LiteLLMClient imports and tests with LlmClient construction, API-base trimming, and model-prefix-stripping tests; retains provider detection, DiagnoseAgent, SubSessionConfig, dashboard URL, and tool-support coverage with inline comments removed.

aish-pty state_capture removal, mark_prompt_ready removal, hostname and ToolRegistry cleanup

Layer / File(s) Summary
Remove state_capture module from aish-pty
crates/aish-pty/src/lib.rs, crates/aish-pty/src/state_capture.rs
Removes pub mod state_capture and the StateChanges re-export from lib.rs; state_capture.rs (with StateChanges, create_state_file, detect_changes, apply_changes, and related helpers) is deleted entirely.
Remove mark_prompt_ready from SessionInterceptor and PersistentPty
crates/aish-pty/src/session_interceptor.rs, crates/aish-pty/src/persistent.rs
Deletes SessionInterceptor::mark_prompt_ready and removes its call site in PersistentPty::send_command_interactive's idle-threshold branch.
Remove hostname helper and replace ToolRegistry::default_tools with drain_tools
crates/aish-shell/src/ai_handler.rs, crates/aish-tools/src/registry.rs
Deletes pub(crate) fn hostname() from ai_handler.rs. Removes ToolRegistry::default_tools() and adds drain_tools(&mut self) which extracts all registered tools as (String, Box<dyn Tool>) pairs, clearing the registry.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • AI-Shell-Team/aish#131: Directly modifies SystemDiagnoseAgent behavior and prompts in crates/aish-llm/src/agent.rs, the same struct this PR removes entirely.
  • AI-Shell-Team/aish#152: Works on SessionInterceptor and PersistentPty::send_command_interactive, overlapping with this PR's removal of mark_prompt_ready from those same components.
  • AI-Shell-Team/aish#233: Adds Tool::prompt() and centralized prompt metadata, directly related to the tool registration path affected by the ToolRegistry::default_toolsdrain_tools replacement.

Poem

🐇 Hop, hop, away with the old!
LiteLLMClient? Gone, I'm told.
state_capture dust, swept from the floor,
mark_prompt_ready knocks no more.
The warren grows tidy, the code runs clear—
A leaner shell, that's why I'm here! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main objective of removing deprecated dead code from the Rust runtime, which aligns with all the changes shown.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@F16shen F16shen changed the title Remove deprecated dead code from Rust runtime chore: Remove deprecated dead code from Rust runtime Jun 15, 2026
Drop LiteLLMClient, legacy SystemDiagnoseAgent, state_capture, and other
unused APIs left behind after the Rust migration. Codex/provider/oauth
code is intentionally unchanged for a follow-up wiring PR.
@F16shen
F16shen force-pushed the chore/remove-deprecated-dead-code branch from 8a53ed3 to 4e3b91d Compare June 15, 2026 08:01

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/aish-llm/tests/llm_integration_test.rs`:
- Around line 84-86: Rename the variable `ollama_provider` to `mistral_provider`
in the test function. The variable is incorrectly named since it actually
contains the result of detecting the Mistral provider (as confirmed by the
assertions checking for "mistral" and "Mistral AI"), not the Ollama provider.
Update the variable name in the assignment and in all subsequent uses within the
assertions to match the consistent naming pattern used for other provider
variables in the test like `openai_provider`, `anthropic_provider`, and
`google_provider`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4cd26463-e874-4f5b-85ff-0a8bf4220165

📥 Commits

Reviewing files that changed from the base of the PR and between f1b4061 and 4e3b91d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • crates/aish-llm/Cargo.toml
  • crates/aish-llm/src/agent.rs
  • crates/aish-llm/src/client.rs
  • crates/aish-llm/src/lib.rs
  • crates/aish-llm/src/session.rs
  • crates/aish-llm/tests/llm_integration_test.rs
  • crates/aish-pty/src/lib.rs
  • crates/aish-pty/src/persistent.rs
  • crates/aish-pty/src/session_interceptor.rs
  • crates/aish-pty/src/state_capture.rs
  • crates/aish-shell/src/ai_handler.rs
  • crates/aish-tools/src/registry.rs
💤 Files with no reviewable changes (9)
  • crates/aish-shell/src/ai_handler.rs
  • crates/aish-pty/src/session_interceptor.rs
  • crates/aish-pty/src/state_capture.rs
  • crates/aish-llm/src/session.rs
  • crates/aish-pty/src/persistent.rs
  • crates/aish-tools/src/registry.rs
  • crates/aish-pty/src/lib.rs
  • crates/aish-llm/src/agent.rs
  • crates/aish-llm/Cargo.toml

Comment thread crates/aish-llm/tests/llm_integration_test.rs Outdated
Use mistral_provider instead of ollama_provider to match llama3 detection.
@F16shen
F16shen merged commit 6ace9e1 into AI-Shell-Team:main Jun 15, 2026
7 checks passed
@F16shen
F16shen deleted the chore/remove-deprecated-dead-code branch June 15, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant