Why
Running /init through headless entrypoints (opencode run, opencode serve + HTTP API) writes AGENTS.md but never stamps project.time_initialized in the DB, so MEMORY stays fail-closed inert forever with no hint. Interactive TUI stamps correctly. Verified on released v1.0.29 and v1.0.28 binaries (not a 1.0.29 regression; long-standing headless gap).
Repro (verified on darwin-arm64 release binaries)
- Fresh git repo, then:
opencode run "/init" twice → AGENTS.md written, but sqlite3 ~/.local/share/opencode/opencode.db "SELECT time_initialized FROM project WHERE worktree LIKE '%<repo>%''" stays empty
opencode serve + POST /session/:id/message with /init → same result
- Interactive TUI on same repo → stamp lands
Suspected mechanism
packages/opencode/src/project/project.ts (~L418-428) initState listens for Command.Event.Executed and matches event.location?.directory === ctx.directory. The EventV2 bridge (src/event-v2-bridge.ts) injects location from InstanceRef; when headless runs publish without a location (InstanceRef absent or a different fiber context), the listener silently drops the event.
Evidence
- DB row exists with NULL stamp after headless /init (both run and serve paths)
git log -S 'Command.Default.INIT' shows the listener predates 1.0.29
- v1.0.28 binary reproduces identically
Acceptance
Why
Running
/initthrough headless entrypoints (opencode run,opencode serve+ HTTP API) writes AGENTS.md but never stampsproject.time_initializedin the DB, so MEMORY stays fail-closed inert forever with no hint. Interactive TUI stamps correctly. Verified on released v1.0.29 and v1.0.28 binaries (not a 1.0.29 regression; long-standing headless gap).Repro (verified on darwin-arm64 release binaries)
opencode run "/init"twice → AGENTS.md written, butsqlite3 ~/.local/share/opencode/opencode.db "SELECT time_initialized FROM project WHERE worktree LIKE '%<repo>%''"stays emptyopencode serve+POST /session/:id/messagewith/init→ same resultSuspected mechanism
packages/opencode/src/project/project.ts(~L418-428) initState listens forCommand.Event.Executedand matchesevent.location?.directory === ctx.directory. The EventV2 bridge (src/event-v2-bridge.ts) injects location fromInstanceRef; when headless runs publish without a location (InstanceRef absent or a different fiber context), the listener silently drops the event.Evidence
git log -S 'Command.Default.INIT'shows the listener predates 1.0.29Acceptance
opencode run "/init"on a fresh repo stampstime_initialized/initstamps as well