You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sync-models user service fails from Nix store layout: resolves opencode config to /nix/.opencode/opencode.jsonc #591
The sync-models systemd user service on amd (Framework laptop) fails on every run. Latest journal evidence (2026-10-22 00:44:49 CDT, journalctl --user -u sync-models):
[sync-models] Discovered 22 models from Antigravity Language Server
[sync-models] Discovering Codex models...
[sync-models] Discovered 9 models from Codex cache
[sync-models] Error: /nix/.opencode/opencode.jsonc does not exist!
sync-models.service: Main process exited, code=exited, status=1/FAILURE
Discovery works fine — the failure is purely in resolving the config file the script syncs models into.
Root cause
bin/sync-models.mjs resolves the config relative to its own location:
That assumption holds in a repo checkout (<repo>/bin → <repo>/.opencode/opencode.jsonc). But the home-manager unit (home/common/default.nix, systemd.user.services.sync-models) runs the file from the Nix store: node ${../../bin/sync-models.mjs} interpolates to a lone store file (/nix/store/<hash>-sync-models.mjs), so import.meta.dirname is /nix/store, ROOT_DIR becomes /nix, and the script looks for /nix/.opencode/opencode.jsonc — which never exists.
(POLICY_PATH has the same store-layout problem, but its loader already tolerates a missing file and falls back to empty defaults, so it degrades silently instead of failing.)
Fix
Resolve the config path in this order:
$OPENCODE_CONFIG_PATH env override, if set.
The repo-local .opencode/opencode.jsonc when it exists (in-checkout runs keep today's behavior).
The deployed user config ~/.config/opencode/opencode.jsonc — the file the service actually maintains, and the same file the opencode-config-normalize path unit already watches.
Acceptance
Installed (store-layout) run no longer dies at the config-exists check; it targets ~/.config/opencode/opencode.jsonc.
In-repo run behavior unchanged.
Verified by a dry-run from a store-like layout (script copied alone into a bare directory) passing the config resolution step.
Activity