Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/opencode/test/server/httpapi-exercise/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ process.env.XDG_CONFIG_HOME = path.join(exerciseGlobalRoot, "config")
process.env.XDG_STATE_HOME = path.join(exerciseGlobalRoot, "state")
process.env.XDG_CACHE_HOME = path.join(exerciseGlobalRoot, "cache")
process.env.OPENCODE_DISABLE_SHARE = "true"

/**
* Make this harness's own 500s readable.
*
* The httpapi error middleware already logs the real Cause of every defect-500
* (`Effect.logError("failed", { ref, error, cause })`), but core's observability layer
* installs ONLY a file logger unless OPENCODE_PRINT_LOGS is set -- it builds with
* `Logger.layer(..., { mergeWithExisting: false })`, which replaces the console logger
* rather than adding to it. So the cause was never lost, only written somewhere nobody
* reading exercise output would look, and a failing scenario showed
* `{"name":"UnknownError","ref":"err_xxxxxxxx"}` and nothing else. That cost a full
* diagnosis assignment on TKT-323, where the answer was one line
* (`Unbound layer node: @opencode/InstanceBootstrap`).
*
* Error level only, so the added output is one line per defect and nothing else. A green
* effect-mode run currently prints exactly four, from the integration scenarios that
* deliberately assert 500 (`Key method not found`, `OAuth method not found`, and two
* `OAuth attempt not found`) -- those routes raise plain Errors rather than returning a
* typed 404, which this makes visible rather than causes. Both variables are overridable
* for a noisier local run.
*/
process.env.OPENCODE_PRINT_LOGS ??= "1"
process.env.OPENCODE_LOG_LEVEL ??= "ERROR"
export const exerciseConfigDirectory = path.join(exerciseGlobalRoot, "config", "opencode")
export const exerciseDataDirectory = path.join(exerciseGlobalRoot, "data", "opencode")

Expand Down
Loading