Skip to content

fix(sdk): release completed embedded request signals - #51012

Closed
opencode-agent[bot] wants to merge 1 commit into
v2from
owned-fetch-retention
Closed

opencode-agent[bot] wants to merge 1 commit into
v2from
owned-fetch-retention

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Status: diagnostic disproved this as the Agent memory fix — do not merge

The source change makes a synthetic OwnedFetch handler release abort listeners, but a real embedded Effect SDK run still retains one Request per fully consumed request. The identical growth occurs through HttpEffect.toWebHandler alone, without the SDK transport. The proposed SDK change does not fix the reported Agent path.

In a local 300-call run on Bun 1.3.14, after full GC and while the host remained alive:

  • Plain async handler: 0–1 additional Request objects.
  • Minimal Effect Web handler: 299–300 additional Request objects.
  • Embedded OpenCode.create() + client.server.info(): 300 additional Request objects.

The result is unchanged with or without this PR's OwnedFetch change. Its response finish callback runs on all 300 requests, the internal signal is aborted, and the real handler still retains the objects. Disabling or removing the Effect request abort listener in a local diagnostic also did not remove the retention. The cause within Effect/Bun has not been established, and the production profile's full RSS/array-buffer amount has not been attributed. The exact local red-capable diagnostic is bun test --timeout 30000 test/retention-repro.temp.test.ts from packages/sdk in the task worktree; this scratch test is not part of the PR.

This PR has been converted to draft. Keep production unchanged; investigate the minimal Effect/Bun reproduction before proposing a replacement fix. Related: anomalyco/anomaly#260 and anomalyco/anomaly#623 (independent Agent fleet worker fix).

Requested by: @kitlangton (Kit via Slack)

@kitlangton

Copy link
Copy Markdown
Contributor

Superseded by #53613.

@kitlangton kitlangton closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant