fix(server): delete temporary ACP health probe sessions#25395
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/delete RPC 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 https://github.com/pingdotgg/t3code/issues/25382
Triaged bug via the automated issue flow. GitCafe: #25382.
Verification
- Red first: probe cleanup cases failed because no delete request reached the agent; the v1 compatibility case failed with a local
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.- Real Linux web/server runtime with
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. - Runtime transcript, runtime driver, direct-wire driver. T3 runtime state was isolated; OpenCode used its default provider storage, inspected read-only for the comparisons.
- Server-only change: visual fixture matrix is empty. No client rendering, wire schema, or platform-specific code changed. Cleanup success and failure are covered by subprocess tests, and advertised v1 deletion by an in-memory protocol test.
Implemented and reviewed with Claude Opus 5.5 and GPT-6.1-Sol through T3 Code's Claude and Codex harnesses.
Checks
Added 5 commits
- fix(server): ACP health probe deletes its own session03486af
- test(server): ACP health probe must delete its session3789cf6
- fix(effect-acp): send session/delete to v1 agents4f8dd4e
- test(effect-acp): v1 agents advertising session/delete must get the request6e11cb4
- Merge remote-tracking branch 'origin/main' into fix/issue-25382d3983ee
Approvability
Verdict: Approved at d3983ee
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.
| Provider | Metric | Main baseline | This PR | Impact | PR ceiling | |
|---|---|---|---|---|---|---|
| Codex | Total thread wire | 5.0 KiB | 5.0 KiB | −7 B (−0.1%) | 6.8 KiB | ✅ |
| Codex | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ✅ |
| Codex | Live turn WebSocket wire | 1.2 KiB | 1.2 KiB | −7 B (−0.6%) | 2.0 KiB | ✅ |
| Codex | Live turn WebSocket decoded | 20.9 KiB | 20.9 KiB | 0 B (0.0%) | 29.3 KiB | ✅ |
| Codex | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ✅ |
| Claude | Total thread wire | 5.0 KiB | 5.0 KiB | +7 B (+0.1%) | 6.8 KiB | ✅ |
| Claude | Thread snapshot wire | 3.8 KiB | 3.8 KiB | 0 B (0.0%) | 4.9 KiB | ✅ |
| Claude | Live turn WebSocket wire | 1.2 KiB | 1.2 KiB | +7 B (+0.6%) | 2.0 KiB | ✅ |
| Claude | Live turn WebSocket decoded | 21.2 KiB | 21.2 KiB | 0 B (0.0%) | 29.3 KiB | ✅ |
| Claude | Live turn messages | 2 | 2 | 0 (0.0%) | 8 | ✅ |
Baseline: 1ecb1a0 · PR result: d3983ee · Source CI: success
Scenario and decoded snapshot size
10 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.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
No actionable comments were generated in the recent review.
External image Recent review info
External image Run configuration
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: fix/issue-25382
- File: .coderabbit.config.ts
- Commit: d3983ee
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Team
- Run ID:
40ddb736-5df0-45b9-8146-7f11043bd89a
External image Commits
Reviewing files that changed from the base of the PR and between 1ecb1a0f9346c7902e98d4362cee0ececd93962c and d3983ee410a844fc92a74adbf1713bc72f820d4a.
External image Files selected for processing: 6
apps/server/scripts/acp-mock-agent.tsapps/server/src/provider/AcpRegistryProbe.test.tspackages/effect-acp/src/client.test.tspackages/effect-acp/src/client.tspackages/provider-acp-registry/src/server/probe.tspackages/provider-acp-registry/src/testing.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Walkthrough
The ACP client now sends
session/deletefor ACP v1. The ACP registry probe registers best-effort cleanup for its test session when deletion is advertised, with a five-second timeout. Tests cover successful and failed deletion outcomes.Changes: ACP probe cleanup
Layer / File(s) Summary ACP v1 session deletion
packages/effect-acp/src/client.ts,packages/effect-acp/src/client.test.tsdeleteSessionnow sendssession/deletefor 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.tsThe 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: External image Normal
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix · Severity of issue fixed: Medium
Suggested reviewers:
maria-rcks,t3dotgg
Merge Risk: External image 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: Passed 4
Check name Status Explanation Description check Passed 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… Title check Passed The title clearly and concisely describes the main change: deleting temporary ACP health probe sessions on the server. Linked Issues check Passed Issue #25382requires deletion of probe-created sessions when the agent advertisessessionCapabilities.delete, ignored cleanup failures, and support forsession/deleteafter ACP v1 negotiation. `p…Out of Scope Changes check Passed 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. …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.