Skip to content

feat(core): manage session websocket channels - #41564

Open
nexxeln wants to merge 1 commit into
session-http-eligibilityfrom
session-websocket-manager
Open

feat(core): manage session websocket channels#41564
nexxeln wants to merge 1 commit into
session-http-eligibilityfrom
session-websocket-manager

Conversation

@nexxeln

@nexxeln nexxeln commented Aug 10, 2026

Copy link
Copy Markdown
Member

Issue for this PR

N/A

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a Location-scoped Session WebSocket manager for OpenAI Responses. It reuses one physical connection per Session, serializes same-Session exchanges, isolates different Sessions, rotates on connection age or handshake-affinity changes, and closes poisoned or interrupted connections.

Only provably not-sent failures can use the existing HTTP fallback. Ambiguous sends are never replayed. Bounded reader queues poison instead of dropping frames, and Session move/delete plus Location shutdown close owned sockets. Node uses the header-capable ws constructor.

Execution is disabled by default and requires OPENCODE_EXPERIMENTAL_OPENAI_RESPONSES_WEBSOCKET=true, provider openai, route openai-responses, and no active Session HTTP middleware. This PR does not add previous_response_id continuation.

How did you verify your code works?

  • cd packages/core && bun typecheck
  • cd packages/core && bun test test/session-model-transport.test.ts test/session-runner.test.ts test/session-execution.test.ts test/location-layer.test.ts test/session-remove.test.ts
  • cd packages/ai && bun typecheck && bun run build && bun test test/executor.test.ts
  • bun typecheck from the workspace root

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant