Skip to content

Fix enclave forwarder backpressure and disconnect cleanup - #916

Open
AnthonyRonning wants to merge 12 commits into
masterfrom
codex/forwarder-io-stack
Open

AnthonyRonning wants to merge 12 commits into
masterfrom
codex/forwarder-io-stack

Conversation

@AnthonyRonning

@AnthonyRonning AnthonyRonning commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

An enclave forwarding helper can drop unsent bytes when a slow downstream write hits its polling timeout. Pin the fix from OpenSecretCloud/nitro-toolkit#13 and run its offline socket regression suite as part of the backend Nix checks.

The toolkit change preserves pending bytes across partial writes/timeouts, maintains TCP half-close responses, and coordinates cleanup when either forwarding direction fails. Disconnect logs now identify the process and VSOCK service with bounded metadata. EPIPE/ECONNRESET indicate peer disconnects at INFO; unexpected errors remain ERROR. The recent dev EPIPE records are still not proven to be application failures or consequences of the timeout bug.

This PR is stacked on #873 (codex-session-v2-cutover). Its own diff is only the toolkit gitlink and the new Nix check; #873 remains unchanged. Merge the toolkit PR first, then reconcile this pin with its final merged commit. After #873 merges, retarget this PR to master and run the normal backend CI before merging.

Validation on macOS:

  • 11 forwarder tests pass using the pinned backend Python and through the backend Nix derivation, including actual socket backpressure, loopback TCP half-close, worker startup/cleanup, cancellation and sanitized logs.
  • Root and backend current-host Nix flake checks pass.
  • Backend default application package build passes.
  • Maple pre-commit formatting/build and 886 frontend tests pass.
  • Independent source review found no remaining material issues.

Toolkit Linux and macOS CI passes on the pinned commit. Backend CI only automatically targets PRs whose base is master; it is not an automatic gate while this PR is stacked. Local sockets do not establish actual VSOCK, EIF/PCR or deployed behavior. Adopting the runtime fix later requires the usual backend EIF/PCR rollout; this PR does not deploy, update PCR approvals, migrate data or release an SDK.

Keep the configured total deadline through non-streaming body completion while preserving incremental SSE idle-timeout behavior. Mirror requested CORS headers so browser callers can send the required Authorization header without saved-key fallback.

Validated with the pinned full proxy gate: 35 tests, formatting, strict Clippy and rustdoc, and dependency checks.
Keep hosted Apple confirmation across the anonymous-to-authenticated root transition. Require native credential persistence before publishing the account, with failure tests covering delayed storage recovery and fallible readback.

Validated with actual-root integration regressions, the full frontend gate, and SDK persistence regressions.
Allow one captured-operation resend after a verified replacement handshake for exact outer 400 contract-1 session_not_found or request_decryption_failed hints. Preserve the selected credentials, logical bytes, cache root, cancellation and account fences. Exclude session-bound OAuth/native completion and all ambiguous response or network failures.

The hints remain unauthenticated: this is the selected V1-equivalent best-effort policy and cannot guarantee cross-session at-most-once execution against a forged hint.

Validated with both SDK regression suites, proxy and Maple gates, independent source review, and a local real-backend restart test showing zero writes before recovery and one after the resend.

Pin SDK integration CI to the tested backend recovery-contract commit e488430.
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