Skip to content

fix(server): isolate rejected parallel history reads - #5115

Merged
benjaminshafii merged 1 commit into
devfrom
fix/thread-read-failure-isolation
Sep 18, 2026
Merged

benjaminshafii merged 1 commit into
devfrom
fix/thread-read-failure-isolation

Conversation

@reachjalil

Copy link
Copy Markdown
Collaborator

Problem

The V1 session proxy starts an upstream history read alongside its workspace-ownership proof. If the upstream transport rejects while that proof is still pending, the read has no rejection observer yet. This produces an unhandled rejection instead of keeping the failure scoped to the request. The concurrency path was introduced in #5075.

Change

  • Observe the upstream rejection immediately while retaining the original promise and its eventual error.
  • Continue withholding the response until workspace ownership is verified; foreign sessions remain inaccessible.
  • Preserve parallel reads, cancellation, and the existing scoped error response. No global exception suppression, additional retries, UI changes, or persistence changes.
  • Add four regression cases covering both V1 proxy mounts and owned/foreign sessions in the existing proxy test file.

The production change is one rejection observer plus an explanatory comment.

Validation

Focused local proxy checks: passed with Bun 1.3.14, synthetic workspaces, and a local mock engine:

corepack pnpm --package=bun@1.3.14 dlx bun --conditions=development test apps/server/src/opencode-proxy.e2e.test.ts --test-name-pattern "history transport rejection|v1 session reads dispatch|v1 history disconnect"
  • Final candidate on current dev: 7 passed, 0 failed, 20 filtered out; 44 assertions.
  • The four new cases failed before the fix, with four unhandled transport-rejection errors.
  • Fixed cases assert no unhandled rejection, pending ownership still withholding the response, request-scoped 502 for the owned session, 404 for the foreign session, and healthy /health responses.
  • Existing adjacent tests cover foreign-body withholding and V1 disconnect cancellation.
  • git diff --check passed.

Scope and limitations

Hosted Web end-to-end proof is incomplete: no browser/Daytona run or deployment verification. The reproduced rejection bug is fixed, but it is not confirmed as the cause of a particular live outage. The test observes unhandled rejections in the test process; it is not proof of default-runtime process termination.

This does not change V2 routing, conversation storage/expiration, sandbox lifecycle, or frontend history-recovery behavior. No visual change; screenshots are not applicable.

@vercel

vercel Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Actions Updated
openwork-app Skipped Skipped Sep 17, 2026 5:17pm UTC
openwork-den Skipped Skipped Sep 17, 2026 5:17pm UTC
openwork-diagnostics Skipped Skipped Sep 17, 2026 5:17pm UTC
openwork-landing Skipped Skipped v0 Sep 17, 2026 5:17pm UTC

@github-actions

Copy link
Copy Markdown
Contributor

Selected evidence: Incomplete · 12/12 tests · 18/18 assertions · 8 images

Commit 845ed9f0bebebd90eb3aa38517dea371efe1e60a · selected evidence
Required verification is reported separately by the current-head Required verification check.

Open review report

Coverage gaps: Required verification: incomplete. Selected evidence does not satisfy all required specs. No authenticated current-head required plan is available.

@benjaminshafii
benjaminshafii merged commit 0c47698 into dev Sep 18, 2026
26 checks passed

This branch was previously deployed

4 inactive deployments
Preview – openwork-landing — 845ed9f0 Deployed Sep 17, 2026 by vercel[bot]
Preview – openwork-app — 845ed9f0 Deployed Sep 17, 2026 by vercel[bot]
Preview – openwork-diagnostics — 845ed9f0 Deployed Sep 17, 2026 by vercel[bot]
Preview – openwork-den — 845ed9f0 Deployed Sep 17, 2026 by vercel[bot]
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.

2 participants