Skip to content

fix(acp): improve Zed integration - #11716

Closed
HenkDz wants to merge 2 commits into
NousResearch:mainfrom
HenkDz:fix/zed-acp-integration
Closed

fix(acp): improve Zed integration#11716
HenkDz wants to merge 2 commits into
NousResearch:mainfrom
HenkDz:fix/zed-acp-integration

Conversation

@HenkDz

@HenkDz HenkDz commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

This improves Hermes ACP behavior for Zed so the editor gets the metadata and structured updates it needs instead of falling back to weak/default UI states.

On the Hermes side, this PR:

  • returns provider-aware ACP model state so Zed can show and switch Hermes models correctly
  • preserves structured diffs for patch and write_file on both tool start and tool completion, instead of degrading into JSON info cards
  • improves ACP session history for Zed with titles, previews, updated_at, cwd filtering, hidden empty threads, and most-recent ordering
  • auto-titles ACP sessions after the first real exchange and keeps provider switching correct when session/set_model changes providers

Why this approach:

  • Zed already knows how to render richer ACP UX when the agent returns proper ACP objects (SessionModelState, SessionInfo, diff content blocks)
  • the main gaps were in Hermes ACP metadata and completion-event rendering, so the fix belongs in Hermes rather than in editor-specific hacks

Related Issue

N/A

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • acp_adapter/server.py
    • return SessionModelState on new/load/resume
    • add provider-aware provider:model resolution for ACP model switching
    • include title and updated_at in ACP session listing
    • auto-title ACP sessions after the first real exchange
  • acp_adapter/session.py
    • filter ACP history by cwd
    • normalize Windows/WSL cwd forms for matching
    • hide empty ACP sessions from history
    • sort sessions by most recent activity
    • provide title/preview fallback logic for Zed session history
  • acp_adapter/tools.py
    • emit structured diff content for patch/write_file
    • preserve structured diffs on completion events instead of downgrading to JSON text cards
  • acp_adapter/events.py
    • capture edit snapshots at tool start
    • thread tool args/snapshot metadata into completion events
  • run_agent.py
    • pass tool arguments through step callback metadata so ACP completion rendering has enough context
  • tests/acp/test_{events,mcp_e2e,server,session,tools}.py
    • add regression coverage for model state, session history metadata, ordering, diff rendering, and completion-event behavior

How to Test

  1. Run the targeted ACP test suite:
    • pytest tests/acp/test_session.py tests/acp/test_server.py tests/acp/test_tools.py tests/acp/test_events.py tests/acp/test_mcp_e2e.py -q
  2. In Zed on a WSL workspace, configure Hermes as a custom ACP agent and start a fresh session.
  3. Verify:
    • model/provider selector shows Hermes models
    • patch and write_file edits render as diffs rather than JSON info cards
    • session history shows titled/non-empty threads with newest first

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: Ubuntu 24.04 (WSL on Windows 11)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

Screenshots / Logs

Zed-side config/workflow notes used during validation (not part of this repo diff):

  • WSL workspaces should use a custom Hermes ACP entry that launches /home/nour/.local/bin/hermes acp
  • Windows workspaces should use a separate custom Hermes ACP entry that launches Hermes through WSL, e.g. wsl bash -lc "/home/nour/.local/bin/hermes acp"
  • Hermes currently behaves best in a single-root Zed workspace, not a multi-root workspace

Those editor-side notes are included here for reviewers reproducing the Zed flow; the actual code changes in this PR are all on the Hermes ACP side.

@teknium1

Copy link
Copy Markdown
Contributor

Merged via #11784#11784

Your branch was 63 commits behind main, so a direct merge would have reverted recent work (release_clients() in run_agent.py, ~22 AUTHOR_MAP entries, test_agent_cache.py, dingtalk_auth.py, cron scheduler, Discord/Weixin changes). Cherry-picked your two commits (444548c + 620d71b) onto current main with your authorship preserved — git log on main shows both commits as Henkey noonou7@gmail.com:

  • cb883f9 fix(acp): improve zed integration
  • d49126b fix(release): map HenkDz contributor email

143 ACP tests pass on the merged result. Thanks for the contribution!

@teknium1 teknium1 closed this Apr 17, 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.

2 participants