Skip to content

fix: replace removed acp.TerminalHandle with local adapter#1524

Closed
Br1an67 wants to merge 1 commit intoMoonshotAI:mainfrom
Br1an67:fix/acp-terminal-handle-removed
Closed

fix: replace removed acp.TerminalHandle with local adapter#1524
Br1an67 wants to merge 1 commit intoMoonshotAI:mainfrom
Br1an67:fix/acp-terminal-handle-removed

Conversation

@Br1an67
Copy link
Copy Markdown

@Br1an67 Br1an67 commented Mar 20, 2026

Related Issue

Resolve #1380

Description

Since agent-client-protocol >= 0.8.0, the acp.TerminalHandle convenience class was removed from the SDK (migration guide). This causes:

Error running tool: module acp has no attribute TerminalHandle

when Kimi CLI is used as an ACP agent (e.g. in Zed IDE) and the shell tool attempts to run a command.

Root cause: tools.py and kaos.py reference acp.TerminalHandle for type annotations and runtime assertions, but the class no longer exists in the current ACP SDK.

Fix: Added acp/terminal.py with a lightweight TerminalHandle dataclass adapter that wraps the raw acp.Client terminal methods (wait_for_terminal_exit, terminal_output, kill_terminal, release_terminal) behind the same interface. Both tools.py and kaos.py now import from this local adapter instead of from the acp package.

Changes:

  • New file: src/kimi_cli/acp/terminal.pyTerminalHandle adapter + create_terminal() factory
  • Modified: src/kimi_cli/acp/tools.py — uses new adapter, removes broken assertion
  • Modified: src/kimi_cli/acp/kaos.py — updated type annotation

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open with Devin

acp.TerminalHandle was removed in agent-client-protocol >= 0.8.0,
causing 'module acp has no attribute TerminalHandle' when the shell
tool runs under ACP (e.g. Zed IDE).

Adds acp/terminal.py with a lightweight TerminalHandle dataclass that
wraps the raw Client.{wait_for_terminal_exit, terminal_output,
kill_terminal, release_terminal} methods behind the same interface.
Updates tools.py and kaos.py to use the new adapter.
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

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.

ACP terminal tool fails with 'module acp has no attribute TerminalHandle' in v1.17 & v1.18

2 participants