Repository navigation
Description
Summary
opencode2 debug config reports the shared service's cached configuration, not
what is on disk, so immediately after editing a config file the command returns
the previous value for roughly 1–3 seconds. There is no way to force a fresh
read: debug subcommands reject --standalone, which the troubleshooting
guidance otherwise recommends for isolating shared-service state. Callers that
edit config and then verify it (scripts, agents) can read a stale result.
Environment
- opencode version: 0.0.0-beta-19271
- OS: Darwin 25.5.0 (darwin arm64)
- Terminal: TERM=xterm-256color, COLORTERM=truecolor (running inside a Herdr 0.8.2 pane)
- Shell: /bin/zsh
- Install/channel: beta (
bun add -g @opencode-ai/[email protected]) - Active plugins: none (
opencode2 plugin list→ "No plugins found")
Reproduction
- Create a scratch project with
.opencode/opencode.jsoncontaining{"model":"probe/A"}and let the service load it. - Run
opencode2 debug config→ reportsprobe/A. - Rewrite the file to
{"model":"probe/B"}. - Immediately run
opencode2 debug config→ still reportsprobe/A. - Wait ~1–3 s and run it again → reports
probe/B.
Measured (disk value read directly; service value from debug config):
20.83s disk=probe/A svc=probe/A
# write probe/B
20.94s disk=probe/B svc=probe/A <- stale
21.80s disk=probe/B svc=probe/B
# write probe/C
23.61s disk=probe/C svc=probe/B <- stale
26.82s disk=probe/C svc=probe/C
The --standalone escape hatch does not work:
$ opencode2 --standalone debug config
ERROR Unrecognized flag: --standalone in command opencode2 debug
$ opencode2 debug config --standalone
ERROR Unrecognized flag: --standalone in command opencode2 debug config
Expected Behavior
debug config should report the configuration effective at the moment it runs,
or clearly label the snapshot it is reporting so callers know it may lag. If the
shared service caches config by design, there should be a way to request a fresh
read (--standalone, --server, or a --reload flag).
Actual Behavior
debug config returns the shared service's cached config for ~1–3 s after a
change, and no flag bypasses or refreshes that cache. An automation that edits
opencode.json and immediately verifies it reads a stale result.
Additional Context
Workaround used: sleep a few seconds between the edit and the verification, or
restart the service (opencode2 service restart) to force a reload.
Proposed Solution
- Prefer a fresh on-disk read for
debug config, or invalidate the cached
config when the source file mtime/etag changes. - Accept
--standalone/--serverondebug(and its subcommands) so callers
can query a freshly started private server instead of the shared service. - Optionally add
opencode2 debug config --reloadand/or include the snapshot
generation or loaded-at timestamp in the output.
Activity
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report and the timings!
Your report has two parts:
--standalone/--serverondebug config: this was reported in cli: mcp/plugin/debug subcommands reject --standalone and spawn a detached service #53878 and has since been fixed ondev(fix(cli): accept --server and --standalone in any position #58505). The v2.2.0 tag already accepts these flags ondebug config, soopencode debug config --standaloneshould work once you're on a build that includes the fix.debug configshows the config the running service currently has loaded. The service picks up file edits through a file watcher, so it can lag briefly after a write. To force a refresh before checking, runopencode reload(it also accepts--standalone/--server) instead of sleeping, then rundebug config.I've marked the rest as a feature request: a way for
debug configto always reflect what is on disk, either by doing a fresh read or adding a--reloadflag, or by including a loaded-at timestamp or snapshot number in its output so callers can tell whether it is out of date. Maintainers will consider it.Related issues:
debug(and other) subcommands rejecting--standalone/--server, now fixed