mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-23 21:16:06 +00:00
Two related divergences from Hono are fixed in one move:
1. Status: many session handlers (todo, diff, summarize, fork, abort,
init, deleteMessage, command, shell, revert, unrevert) didn't wrap
with mapNotFound, so a thrown NotFoundError surfaced as a 500 defect
instead of a 404. The fork/diff endpoints also lacked OpencodeNotFound
in their declared error union, so handlers couldn't surface 404 even
if they wanted to.
2. Body shape: the existing mapNotFound rebrand to HttpApiError.NotFound
produced an empty 404 response. Hono returns the NamedError envelope
`{ name: "NotFoundError", data: { message } }`. SDK consumers reading
`error.data.message` got undefined.
The fix introduces OpencodeNotFound — a Schema.ErrorClass annotated with
`httpApiStatus: 404` and a body schema matching the legacy NamedError
shape. mapNotFound now rebrands NotFoundError to OpencodeNotFound,
preserving the underlying error message. All session endpoints that take
a sessionID now wrap their service calls with mapNotFound.
A TODO in the handler notes the long-term direction: services should
fail with typed errors directly (Effect<T, SessionNotFound>) and let
HttpApi auto-route status + body via schema annotations, eliminating
mapNotFound entirely. This PR is the pragmatic middle: small surface,
no service-layer changes, fixes the user-visible parity bug.
Unskips the two .todo parity reproducers in httpapi-parity.test.ts.
|
||
|---|---|---|
| .. | ||
| app | ||
| console | ||
| containers | ||
| core | ||
| desktop | ||
| desktop-electron | ||
| docs | ||
| enterprise | ||
| extensions/zed | ||
| function | ||
| identity | ||
| opencode | ||
| plugin | ||
| script | ||
| sdk | ||
| slack | ||
| storybook | ||
| ui | ||
| web | ||