fix(opencode): expose config parse errors over http#29238
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate FoundPR #29208 - Why it might be related: This PR also addresses config parse errors during startup, which is directly related to PR #29238's focus on exposing config parse errors (both JSON/JSONC parsing and schema validation) over HTTP with proper error responses. |
|
Thanks for the duplicate check. This is related to #29208, but it takes a different approach. #29208 changes config loading to swallow parse/schema failures and fall back to defaults. This PR keeps config parse/schema failures intact and only maps The regression coverage is in |
Issue for this PR
Closes #29200
Type of change
What does this PR do?
Config JSON/JSONC parse and schema validation errors can be thrown as defects during startup request fanout. The generic HTTP error middleware was converting those defects into an opaque 500 response, so clients only saw
Unexpected server error.This keeps the generic 500 behavior for unknown and unrelated named defects, but returns structured
ConfigJsonErrorandConfigInvalidErrorresponses with HTTP 400 so the CLI/TUI can render the actual config path and validation issue.How did you verify your code works?
bun test test/server/httpapi-error-middleware.test.tsfrompackages/opencodebun typecheckfrompackages/opencodebun turbo typecheckfrom repo root.husky/pre-pushfrom repo rootScreenshots / recordings
Not applicable.
Checklist