effect(server): typed errors in session/sync handlers, fix concurrency#27146
Merged
Conversation
- session.updatePart: raw throw -> HttpApiError.BadRequest - sync.steal: raw throw -> HttpApiError.BadRequest - instance.vcs: Effect.all concurrency 2 -> "unbounded" - session.ts: extract tryParseJson helper for createRaw/forkRaw
9726181 to
697f4f8
Compare
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
AIALRA-0
pushed a commit
to AIALRA-0/opencode-turn-engine
that referenced
this pull request
Jun 10, 2026
avion23
pushed a commit
to avion23/opencode
that referenced
this pull request
Jun 10, 2026
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
Small server-handler cleanups under
packages/opencode/src/server/routes/instance/httpapi/:handlers/session.ts:376— Part-mismatch rawthrow new Error(...)inupdatePartreplaced withreturn yield* new HttpApiError.BadRequest({}). The endpoint already declaresHttpApiError.BadRequestin its error union, so the wire format is unchanged from the existing 400 convention used by sibling handlers.handlers/sync.ts:62—throw new Error("Cannot steal session without workspace context")replaced withreturn yield* new HttpApiError.BadRequest({}). Thesync.stealendpoint already declaresHttpApiError.BadRequest.handlers/instance.ts:41—Effect.all([vcs.branch(), vcs.defaultBranch()], { concurrency: 2 })changed to{ concurrency: "unbounded" }(two unrelated queries).handlers/session.ts:153,204— Extracted a file-localtryParseJson(text)helper, since bothcreateRawandforkRawhad identicalEffect.tryblocks wrappingJSON.parse(body)with the sameHttpApiError.BadRequestmapping.Test plan
bun run typecheckfrompackages/opencodebun run test test/server/httpapi-session.test.ts test/server/httpapi-sync.test.ts test/server/httpapi-instance.test.ts(17 pass, 1 todo)