mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 06:04:43 +00:00
7.7 KiB
7.7 KiB
Concrete Migration Steps
Phase Progression Rule
- Do not start the next phase until the current phase validation gate is green in local runs and CI.
- If a gate fails, log the issue in
research/acp/friction.mdbefore proceeding. - “Green” means required tests pass end to end, not just unit tests.
Consolidated Test Suites (Authoritative)
The migration test plan is intentionally collapsed to avoid duplicate coverage.
- ACP protocol conformance
- Transport contract (
/v1/rpc) - End-to-end agent process matrix (core flow + cancel + HITL + streaming)
- Installer suite (explicit + lazy + registry/fallback provenance)
- Security/auth isolation
- TypeScript SDK end-to-end (embedded + server, embedding
@agentclientprotocol/sdk) - v1 removal contract suite (
/v1/*returns HTTP 410 + stable payload) - Inspector ACP suite (mandatory
agent-browserend-to-end automation) - OpenCode <-> ACP bridge suite (dedicated phase)
Inspector ACP suite requirements:
- Must run through real browser automation with
agent-browseragainst/ui/. Current script:frontend/packages/inspector/tests/agent-browser.e2e.sh. - Must not rely only on mocked component tests for pass criteria.
- Must cover one simple flow: spawn agent/session, send message, verify response renders.
- Must run in CI and block phase progression on failures.
Phase 1: Teardown
- Delete in-house protocol crates and docs listed in
research/acp/00-delete-first.md. - Remove workspace dependencies on deleted crates from
Cargo.toml. - Remove all
/v1route registration and mount a unified/v1/*removed-handler (HTTP 410 +application/problem+json). - Remove/disable CLI
apicommands that target/v1. - Comment out/disable
/opencode/*compat routes during ACP core bring-up.
Exit criteria:
- Project builds with v1 protocol code removed.
- No references to
sandbox-agent-universal-agent-schemaremain. - Any
/v1/*request returns explicit "v1 removed" error. /opencode/*is disabled (known broken) until Phase 7.
Validation gate:
- Build/test sanity after teardown compiles cleanly.
- Static checks confirm removed modules/types are no longer referenced.
/v1/*returns HTTP 410 + stable error payload./opencode/*returns disabled/unavailable response.
Phase 2: ACP Core Runtime
- Add ACP transport module in server package (
acp_runtime.rs+ router integration). - Implement agent process process manager (spawn, supervise, reconnect policy).
- Implement JSON-RPC bridge: HTTP POST/SSE <-> agent process stdio.
- Add connection registry keyed by
X-ACP-Connection-Id. - Include unstable ACP methods in the v1 profile (
session/list,session/fork,session/resume,session/set_model,$/cancel_request).
Exit criteria:
- End-to-end
initialize,session/new,session/promptworks through one agent process.
Validation gate:
- End-to-end ACP flow test over
/v1/rpc(request/response + streamed notifications). - Cancellation test (
session/cancel) with proper terminal response behavior. - HITL request/response round-trip test (
session/request_permissionpath). - SSE ordering and reconnection behavior test (
Last-Event-IDreplay path). - Explicit close test (
DELETE /v1/rpc) including idempotent double-close behavior. - Unstable ACP methods validation (
session/list,session/fork,session/resume,session/set_model,$/cancel_request) for agent processes that advertise support.
Phase 3: Installer Refactor
- Replace agent-specific spawn contracts in
server/packages/agent-management/src/agents.rswith agent process-centric spawn. - Add agent process install manifests and downloader logic.
- Keep native agent install where agent process depends on local CLI.
- Add install verification command per agent process.
- Add ACP registry integration for install metadata + fallback sources.
- Generate install instructions from manifest and expose provenance (
registryorfallback) in API/CLI. - Implement lazy install path on first
/v1/rpcinitialize (with per-agent install lock and idempotent results). - Add config to disable lazy install for preprovisioned environments.
Exit criteria:
installprovisions both required binaries (agent + agent process) for supported agents.
Validation gate:
- Explicit install command tests for each supported agent.
- Lazy install on first ACP
initializetest. - Reinstall/version/provenance assertions.
Phase 4: v1 HTTP API
- Mount
/v1/rpcPOST and SSE endpoints. - Add
/v1/health,/v1/agents,/v1/agents/{agent}/install. - Add auth integration on connection lifecycle.
- Keep
/ui/inspector route and migrate inspector backend calls to ACP v1 transport. - Remove v1 OpenAPI generation from default docs build.
Exit criteria:
- v1 endpoints documented and passing integration tests.
Validation gate:
- Contract tests for all
/v1endpoints (/v1/rpc,/v1/health,/v1/agents, install). - Auth tests (valid, missing, invalid token).
- Error mapping tests (bad envelope, unknown connection, timeout paths).
/v1/*removal contract test (HTTP 410 + stable payload).- Inspector ACP
agent-browserflow tests pass. DELETE /v1/rpcclose contract tests pass.
Phase 5: SDK and CLI v1
- Add ACP transport client in
sdks/typescriptby embedding@agentclientprotocol/sdk(no in-house ACP reimplementation). - Implement custom ACP-over-HTTP transport agent process in our SDK (official ACP client SDK does not provide required Streamable HTTP behavior out of the box).
- Add inspector frontend client wiring to use ACP-over-HTTP transport primitives.
- Add CLI commands for sending raw ACP envelopes and streaming ACP messages.
- Remove v1-only SDK/CLI methods (or hard-fail with "v1 removed").
- Regenerate docs to v1 ACP contract.
Exit criteria:
- SDK can complete a full ACP prompt turn over
/v1/rpc.
Validation gate:
- TypeScript SDK end-to-end tests in both embedded and server modes.
- Parity tests ensuring SDK uses upstream ACP SDK primitives (no duplicate protocol stack).
- Inspector end-to-end
agent-browsertests using ACP-over-HTTP transport.
Phase 6: Test and Rollout
- Replace v1 HTTP/session tests with ACP transport contract tests.
- Add smoke tests per supported agent process.
Current deterministic matrix:
server/packages/sandbox-agent/tests/v1_agent_process_matrix.rs. - Add canary rollout notes directly in
docs/quickstart.mdx,docs/cli.mdx, anddocs/sdks/typescript.mdx. - Update docs for v1 ACP,
/v1/*removal, inspector ACP behavior, and SDK usage. - Keep v1 endpoints hard-removed (
410) until/unless a separate compatibility project is approved.
Exit criteria:
- CI is green on ACP-native tests only.
Validation gate:
- Full matrix run across all supported agent processes.
- Smoke tests for install + prompt + stream for each supported agent process.
- Inspector
agent-browsersuite passes in CI for ACP mode (.github/workflows/ci.yaml). - Docs updates are published with the rollout.
Phase 7: OpenCode <-> ACP Bridge (Dedicated Step)
- Keep
/opencode/*commented out/disabled through Phases 1-6. - Implement OpenCode <-> ACP bridge on top of v1 ACP runtime.
- Re-enable
server/packages/sandbox-agent/src/opencode_compat.rsroutes/tests at full capability. - Add dedicated integration tests that validate OpenCode SDK/TUI flows through ACP v1 internals.
Exit criteria:
- OpenCode compatibility works through ACP internals (no fallback to legacy in-house protocol).
Validation gate:
- OpenCode compatibility suite passes against ACP-backed implementation.
- Regression tests ensure no dependency on removed in-house protocol runtime.
Compatibility Layer (optional future project)
- No compatibility layer is in the current v1 scope.
- If later approved, it should be a separate project with a dedicated spec and test matrix.