Skip to content

ACP: route file I/O through client fs/* delegation #2

Closed

Description

@JAORMX

What's missing

The ACP adapter uses mecatl's own osfs Workspace and never delegates file I/O to the editor. It does not call the client's fs/read_text_file / fs/write_text_file, so edits hit disk directly rather than flowing through the editor's buffers/undo — the editor's unsaved buffers and mecatl's on-disk view can diverge.

Validated (independent cross-check):

  • The session roots on osfs via Service.CreateSession(ctx, req.Cwd, …) (internal/adapter/acp/agent.go); no fs/read_text_file/fs/write_text_file strings exist anywhere in internal/adapter/acp/ (only the deferral note in doc.go).
  • ClientCapabilities is decoded as opaque json.RawMessage and never inspected (internal/adapter/acp/types.go).

Proposed approach

A JSON-RPC-backed tool.Workspace implementation that routes reads/writes through ACP fs/* client requests (the adapter is already a JSON-RPC client for session/request_permission), injected as the per-session Workspace in ACP mode when the client advertises fs.readTextFile/writeTextFile (the capability is the client's, not agent-advertised).

Caveats from review:

  • The seam is tool.Workspace (it deliberately lives in internal/tool, not internal/port — see CLAUDE.md).
  • Workspace also exposes Grep and the Edit read-ledger (RecordRead/WasReadUnchanged), which ACP fs/* does not provide — a JSON-RPC Workspace must synthesize those. So it's more than a read/write shim. Large / behavioral.

Part of ACP Phase 3 long-tail (docs/adr/0001-acp-adapter.md).

Activity

  1. JAORMX commented on Jun 1, 2026

    @JAORMX
    ContributorAuthor

    Done in 941646b. Hybrid: file Read/Write + the Edit read-ledger now delegate through the client's fs/read_text_file/fs/write_text_file when it advertises both fs capabilities; Grep/Glob/Stat stay on a consistent local view (the mutation path is buffer-consistent because read-before-edit forces a re-read through fs/* before any write). Per-session workspace override seam mirrors the #7 sessionEngines pattern (WorkspaceFactory unchanged → gRPC/HTTP untouched). Panel caught and fixed a real write-clobber (unsaved buffer misclassified as new), symlink-escape, and unbounded-call issues — all now fail closed. grep-over-buffers and fs/* on session/load are documented residuals/deferrals (the latter mirrors the MCP-on-load asymmetry, tracked alongside #9).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions