feat(acp): integrate ACP harness for agent communication - #4072
Conversation
- Added new `acp` package for handling ACP session lifecycle. - Implemented provider-neutral Agent Client Protocol (ACP) harness. - Created `acp.go`, `acp_session.go`, `acp_turn.go`, and `acp_client.go` for structuring ACP tool logic and session management. - Extracted opencode session export functionality into `ExportSession` method for reusability. - Updated imports to add support for ACP logic and made necessary code refactoring for cleaner management. - Removed redundant session export logic from `artifacts.go`. - Updated `go.sum` with new dependencies for ACP SDK integration.
Soffi AI SummaryThis PR integrates the Agent Client Protocol (ACP) as a provider-neutral harness for AI agent communication in the deployment operator. The motivation is to decouple agent session management from any specific AI provider (e.g., opencode) by implementing the ACP SDK — a structured, protocol-level interface for session lifecycle, prompting, tool output, and message routing. This allows the harness to support multiple coding agents (opencode today, others tomorrow) through a single, well-tested abstraction layer. Key changes:
ChangesACP harness for provider-neutral agent communication
opencode version bump in CI/CD
Updated: 2026-08-31 14:07 UTC |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
plural deploy to dev |
Greptile SummaryThe PR introduces a provider-neutral ACP harness for agent session lifecycle, messaging, configuration, usage tracking, and artifact export.
Confidence Score: 5/5The PR appears safe to merge because the previously reported unbounded ACP file-read failure is now bounded. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| go/deployment-operator/pkg/agentrun-harness/tool/acp/acp_client.go | Adds ACP filesystem callbacks and fixes the previously reported unbounded-read path with regular-file validation, a 16 MiB byte cap, and context checks. |
| go/deployment-operator/pkg/agentrun-harness/tool/acp/acp_session.go | Implements ACP initialization, session creation and resumption, prompt execution, cancellation, and bounded process shutdown. |
| go/deployment-operator/pkg/agentrun-harness/tool/acp/acp.go | Defines the provider-neutral ACP tool, configuration hooks, message delivery, session state, and artifact upload behavior. |
| go/deployment-operator/pkg/agentrun-harness/tool/acp/acp_client_test.go | Covers normal file operations, invalid paths and sessions, canceled reads, and oversized-file rejection. |
| go/deployment-operator/pkg/agentrun-harness/tool/acp/opencode.go | Adapts OpenCode process launch, configuration, and session export to the ACP harness. |
| go/deployment-operator/pkg/harness/exec/exec_stdio.go | Adds stdio-oriented process lifecycle handling used by ACP connections. |
Reviews (3): Last reviewed commit: "feat(acp): improve session handling and ..." | Re-trigger Greptile
- Add context cancellation checks in `ReadTextFile` for robustness. - Introduce a limit on text file read size with `maxTextFileBytes`. - Implement `contextReader
- Bump OPENCODE_VERSION from 1.17.3 to 1.18.23 for deployment compatibility.
- Add `TestNewOpenCodeSelectsConfiguredAgentForRunMode` to verify agent selection based on run mode. - Update `opencode_args_test.go` to use `Default*Agent` constants. - Change `opencode_types.go` to export `Default*Agent` constants. - Modify `opencode.go` files to utilize exported `Default*Agent` constants.
|
plural deploy to dev |
- Introduce `sessionAttempt` and `sessionDetails` structs for clearer separation of attempts and session configurations - Implement session attempt lifecycle methods: `startAttempt`, `run`, `stop`, `initialize`, `openSession`, `createSession`, `resumeSession` - Add error handling improvements: `fail`, `promptFailure` - Consolidate process rejection logic into `rejectProcess` - Refine session configuration with `setModelConfig` and `setModeConfig` functions for cleaner configuration flow
- Bump `opencode` version from 1.17.3 to 1.18.23 in deployment workflow file for compatibility.
- Add test `TestToolOutputPrefersContentOverRawOutput` to prioritize content over raw output in tool messages. - Add test `TestToolOutputFallsBackToRawOutputWithoutContent` to ensure raw output is used when content is unavailable. - Simplify `normalizeUsage` function logic to use `max` for total token calculation. - Refactor `acp_turn.go` to improve tool output handling by checking and formatting content and raw output effectively.
…-consider-moving-agent-harness-to-use-agent-client-protocol
- Update `ConfigureSystemPrompt` and `systemPromptInput` methods to use pointer receivers in `tool/v1/tool.go` - Modify `ConfigureSkills` and related methods to use pointer receivers in `v1/skills.go` - Change test functions in `acp_test.go` to test new tool behaviors - Simplify tool management logic by removing redundant flusher handlers in `acp.go` and `acp_turn.go` - Enhance cumulative cost tracking by introducing a new `RecordCumulativeCost` method
- Introduced `newSessionUpdates` to handle pre-response session updates - Enhanced `NewSession` to process updates using `SessionUpdate` - Added test `TestRunPromptHandlesUpdatesSentBeforeNewSessionResponse` to verify update handling order - Added test `TestRunPromptRejectsMismatchedInitialSessionUpdate` to ensure proper session update matching - Added test `TestSessionUpdateRejectsEmptySessionIDBeforeBinding` to enforce session ID validation - Refactored session config functions into methods: `setSessionConfig`, `setModelConfig`, `setModeConfig` - Introduced `startAttempt` for clearer session initiation logic - Created `validate` method for comprehensive tool configuration checks - Updated error messages for consistency with lowecase conventions - Reorganized `toolCall` and `toolUpdateEvents` to streamline tool communication logic
acppackage for handling ACP session lifecycle.acp.go,acp_session.go,acp_turn.go, andacp_client.gofor structuring ACP tool logic and session management.ExportSessionmethod for reusability.artifacts.go.go.sumwith new dependencies for ACP SDK integration.Test Plan
Test environment: https://console.plrl-dev-aws.onplural.sh/
Checklist
Plural Flow: console