Skip to content

fix(server): delete temporary ACP health probe sessions - #25397

Open
juliusmarminge wants to merge 5 commits into
mainfrom
fix/issue-25382
Open

juliusmarminge wants to merge 5 commits into
mainfrom
fix/issue-25382

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

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 #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 untracked app.json was 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-seed and 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.

juliusmarminge and others added 5 commits October 26, 2026 07:40
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>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 26, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions

Copy link
Copy Markdown
Contributor

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.

@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 1ecb1a0 and d3983ee.

Files selected for processing: 6
  • apps/server/scripts/acp-mock-agent.ts
  • apps/server/src/provider/AcpRegistryProbe.test.ts
  • packages/effect-acp/src/client.test.ts
  • packages/effect-acp/src/client.ts
  • packages/provider-acp-registry/src/server/probe.ts
  • packages/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/delete for 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.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: Normal

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: 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 #25382 requires deletion of probe-created sessions when the agent advertises sessionCapabilities.delete, ignored cleanup failures, and support for session/delete after 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 #25382 requires deletion of probe-created sessions when the agent advertises sessionCapabilities.delete, ignored cleanup failures, and support for session/delete after ACP v1 negotiation. probeAcpRegistryConfiguration registers scoped deletion after session start, applies a five-second timeout, and ignores errors. AcpClient.agent.deleteSession now 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.

This branch has not been deployed

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

Labels

bugfix Fix PR opened by an issue lead; enters the PR loop pr:gate-failed A land gate failed size:S 10-29 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ACP provider health probe creates a persistent empty OpenCode session on every refresh

1 participant