Repository navigation
Conversation
|
Closing this draft as superseded by 2397137, which is present in main (checked at bb96afd). The shared xdgConfigHome() now handles empty XDG_CONFIG_HOME consistently for OpenCode's write target and global read layers, resolving #2168. The additional CLI cases here broaden the regression matrix for empty/explicit XDG roots and empty XDG with a custom directory. Main already tests the underlying lifecycle, configuration layering, malformed-global preflight and preservation behavior separately. I found no remaining behavior difference requiring this fix. Path-resolution checks passed for main, 2397137 and this PR (69 cases total). I did not rerun the compiled CLI suite or native OpenCode; this PR's CI has no executed jobs. This PR was not merged. |
Summary
Fixes #2168. With an empty
XDG_CONFIG_HOME, OpenCode setup previously wroteopencode/opencode.jsonunder the working directory and reported readiness.Resolve the default global directory once for both writing and reading, treating
an empty XDG value as unset. Explicit OpenCode and non-empty XDG overrides retain
their existing precedence.
Problem and expected behavior
An isolated CLI run on base
5190843f8f09ac17cbf79561bd1f708c509cda78reproducedthe misplaced registration. The empty and unset cases now both write
HOME/.config/opencode/opencode.json; a non-empty XDG root still selectsXDG_CONFIG_HOME/opencode/opencode.json. All three workspaces remain empty.This matches the XDG specification
and OpenCode 1.18.35's
xdg-basedir5.1.0 dependency.Change and scope
and ordered configuration read sources.
roots, including planning, setup, doctor, idempotence and uninstall.
malformed-global preflight and preservation of unrelated registrations.
Contract and boundary impact
SupportedClients.ts, OpenCode configuration-path resolution.source; existing approval, backup, preflight and owned-registration rules apply.
Evidence and regression coverage
revision (16 other tests passed), then passed with the fix.
before and after the fix with separate temporary homes and working directories.
Validation performed
Linux x64, pinned Node 24.18.0 / npm 11.16.0:
npm run test:focused -- tests/boundary/cli/clientProfileLifecycle.test.ts tests/boundary/cli/clientProfiles.test.ts tests/boundary/filesystem/clientLifecycle.test.ts tests/boundary/filesystem/clientConfigurationDialects.test.ts tests/boundary/filesystem/clientRegistrationStatus.test.ts— 106 passed.npm run check— passed all six tasks and architecture guards; 853 lint warnings,zero lint errors. The first attempt found one formatting issue, corrected with oxfmt.
npm run verify:test-discovery— all 915 test files discovered exactly once.npm pack --dry-run --json— passed; 1,431 files.git diff --checkand pre-commit formatting/lint hooks — passed.npm run verify:package— passed, including packaged CLI/MCP, 173 tools, setup/uninstall, exact-version update, backups, failure recovery, symlink lifecycle,
Skills 1.7.2 repository discovery and verified cleanup with no remaining descendants.
The first run was stopped after its local registry forwarding repeatedly returned
HTTP 500: Node's upstream fetch failed with
EAI_AGAIN. A probe using the existingenvironment proxy returned HTTP 200. The passing run used
NODE_USE_ENV_PROXY=1with loopback destinations excluded from the proxy (
NO_PROXY,no_proxyandnpm_config_noproxy); no repository or network-policy change was needed.Compatibility, safety, and release
No breaking changes, metadata change or version bump. The fix does not migrate an
already misplaced registration. No analysis provider behavior changed, so no real
Hopper/Ghidra run was performed. The full deterministic suite was not run locally.
CI run 38251100446 is
action_required; its page says it is awaiting approval from a maintainer.No jobs have executed yet, so no remote test pass is claimed.
Review checklist