fix(httpapi): expose v2 request errors#28495
Merged
Merged
Conversation
3 tasks
kitlangton
added a commit
to kitlangton/opencode
that referenced
this pull request
May 20, 2026
Two problems surfaced when anomalyco#28495 + the follow-up `chore: generate` populated previously-empty v2 error response unions. 1. `@hey-api/openapi-ts` codegen passes the endpoint's `TError` into the second generic of `ServerSentEventsResult`, which is the underlying `AsyncGenerator`'s `TReturn` slot — not an error channel. The SSE implementation's own signature uses `ServerSentEventsResult<TData>`, so it's only the public `SseFn` wrapper that's wrong. Latent for ~9 months; harmless while error unions were unknown, but breaks every `.return(undefined)` call and every mock async generator the moment an SSE endpoint declares a concrete error response. Patch the generated `client/types.gen.ts` and add a post-gen step in `script/build.ts` so every future `chore: generate` reapplies it. 2. `experimental.workspace.warp` now returns `InvalidRequestError` in its 400 union, which uses `_tag` rather than `name` as its discriminator. Narrow the error before reading `.name` in `dialog-workspace-create.tsx`. Verified end-to-end: `bun run build` in `packages/sdk/js` wipes and regenerates v2/gen, then re-applies the SseFn patch automatically; full monorepo typecheck and stream.transport tests are green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
testing