Repository navigation
fix(server): delete temporary ACP health probe sessions - #25397
juliusmarminge wants to merge 5 commits into
Conversation
Reproduces #25382: probeAcpRegistryConfiguration starts a session for the health check but never sends session/delete, so agents that persist sessions (OpenCode) accumulate empty sessions on every provider refresh. Covers both a successful delete and a failing delete, which must not fail the health result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The provider health probe opened an ACP session and never deleted it, so agents that persist sessions (OpenCode 2.1.4) kept one empty session per provider refresh. When the agent advertises session delete, the probe now registers a best-effort finalizer that deletes that session before the runtime is torn down. The finalizer is bounded at 5s and ignores failures, so the health result is unchanged. The test now uses a scoped temp directory and checks that the delete targets the probe's session. Fixes #25382 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…equest Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OpenCode 2.1.4 negotiates ACP v1 and advertises sessionCapabilities.delete, but deleteSession failed locally with Method not found on every v1 agent. Send the request on both generations; callers already gate on the advertised capability. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a focused ACP health-probe cleanup fix: advertised session/delete support is now used for both v1 and v2 agents, with deletion bounded by a short timeout and ignored on failure. The remaining changes are test coverage and mock-agent support, with no product-default or static-analysis configuration changes. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
ACP v1 session deletion packages/effect-acp/src/client.ts, packages/effect-acp/src/client.test.ts |
deleteSession now sends session/delete for ACP v1. A test verifies the request and successful response. |
Probe session cleanup and validation packages/provider-acp-registry/src/server/probe.ts, packages/provider-acp-registry/src/testing.ts, apps/server/scripts/acp-mock-agent.ts, apps/server/src/provider/AcpRegistryProbe.test.ts |
The probe registers timed, best-effort deletion when the agent advertises the capability. The mock agent can return a deletion error. Tests check readiness, the advertised capability, and one deletion request for both deletion outcomes. |
Priority:
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers: maria-rcks, t3dotgg
Merge Risk: 
Minimal · up to d3983
-
The cleanup is ready to merge after normal checks. A rare timeout during startup could still leave an empty probe session.
Pre-merge checks: 
4
-
Full details: Description check
-
Explanation
The description includes all required sections. It clearly states the problem, explains the cleanup and ACP v1 changes, links the tracked issue and approval context, and provides detailed verification results.
Full details: Linked Issues check
-
Explanation
Issue
#25382requires deletion of probe-created sessions when the agent advertisessessionCapabilities.delete, ignored cleanup failures, and support forsession/deleteafter ACP v1 negotiation.probeAcpRegistryConfigurationregisters scoped deletion after session start, applies a five-second timeout, and ignores errors.AcpClient.agent.deleteSessionnow sends the RPC for v1. Tests cover successful and failed probe cleanup and a v1 agent that advertises deletion.
Full details: Out of Scope Changes check
-
Explanation
All changed files support issue
#25382. The mock-agent failure switch enables cleanup-error testing. The testing re-export enables probe tests. The client change enables the required v1 deletion RPC. No unrelated product behavior or client, wire-schema, or platform changes appear in the reviewed diff.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Problem
ACP Registry health checks create a real session to inspect the agent. With managed OpenCode V2 2.1.4, each uncached provider-status refresh left an untitled, zero-message session in OpenCode's history.
Change
Delete the probe's own session before tearing down the ACP process when the agent advertises session deletion. Cleanup is best effort and bounded to five seconds, so deletion errors do not change provider health.
Allow the existing
session/deleteRPC after ACP v1 negotiation. OpenCode 2.1.4 advertises and implements deletion on v1, but the client previously rejected it locally before sending the request.Scope and approval
Fixes #25382
Triaged bug via the automated issue flow. GitCafe: #25382.
Verification
Method not found: session/delete. Recorded red results.vp run check:changed: format, lint, both knip phases, generated GraphQL, typecheck of eight affected packages, and 41 tests in two files passed. The unrelated untrackedapp.jsonwas excluded from changed-file selection without changing its content. Complete check output.vp run dev --home-dir /tmp/t3-issue-25382-runtime --no-seedand managed OpenCode 2.1.4: provider status remains Available after refresh and two uncached startup probes. Both probes send successful deletion requests. All 13 baseline reproduction sessions and their message counts remain unchanged; the newly created probe session is absent. The preexisting conversation retains its two messages.Implemented and reviewed with Claude Opus 5.5 and GPT-6.1-Sol through T3 Code's Claude and Codex harnesses.