Skip to content

Goose acp doesn't display diff for edit. #569

@Gavinok

Description

@Gavinok

Checklist

  • I agree to communicate with the author myself (not AI-generated).
  • I've read the README's Filing issues section.
  • I'm running the latest versions (fill in below).
    • agent-shell version:0.50.1
    • acp.el version: 0.11.3
    • ACP package (e.g. claude-agent-acp) version: Goose version 1.33.1
  • For issues, I'm including ACP traffic (as per README).

When using goose edits do not provide a diff. This seems to be due to the before and after rather then the standard diff method. I have whipped up some advice that works around it. I will try to make a PR to fix this when I have some spare time but figured I'd put this here for others who need it.

(define-advice agent-shell--make-diff-info (:around (orig-fn &rest args) make-diff-info-goose)
    "Handle Goose-style before/after rawInput in diff info construction.

Goose sends edits as `before'/`after' text fields in rawInput rather than
the standard ACP `content' diff format.  When detected, maps them directly
to :old/:new/:file without further parsing.  Falls through to ORIG-FN for
all other formats."
    (let* ((acp-tool-call (plist-get args :acp-tool-call))
           (raw-input (map-elt acp-tool-call 'rawInput)))
      (if (and raw-input (map-elt raw-input 'after))
          (let ((old-text (or (map-elt raw-input 'before) ""))
                (new-text (map-elt raw-input 'after))
                (path (map-elt raw-input 'path)))
            (append (list (cons :old old-text)
                          (cons :new new-text))
                    (when path (list (cons :file path)))))
        (apply orig-fn args))))

09:09:53.790 ← request session/request_permission

:direction incoming
:kind      request
:object
           jsonrpc 2.0
           method  session/request_permission
           params
                   sessionId e5a326c8-9a1d-4bd9-8623-98072a079ecd
                   toolCall
                             toolCallId call_00_V4KrtiLeRIZmcsNhVY2P9032
                             kind       other
                             status     pending
                             title      edit
                             rawInput
                                        file_path /home/gavinok/.emacs.d/elpa/agent-shell/agent-shell.el
                                        before    ;;; agent-shell.el --- Native agentic integrations for Claude Code, Gemini CLI, etc  -*- lexical-binding: t; -*-
                                        after     ;;; agent-shell.el --- Hello, World!  -*- lexical-binding: t; -*-
                   options
                             optionId allow_always
                             name     allow_always
                             kind     allow_always

                             optionId allow_once
                             name     allow_once
                             kind     allow_once

                             optionId reject_once
                             name     reject_once
                             kind     reject_once

                             optionId reject_always
                             name     reject_always
                             kind     reject_always
           id      61feb69d-7ecb-427a-ac92-f48d642f166b

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions