Every promise loopd makes about a background goal is either enforced in code and
covered by a test, or it is not claimed. This document is the human-readable
half; scripts/smoke-v2-lifecycle.ts is the executable half.
- Separate worker. A goal never runs in the owner session. It gets its own child session, so the owner stays responsive while the worker turns.
- Explicit completion. A worker cannot mark itself complete on its say-so.
complete_goalruns the configuredchecksunder the same lock that guards writes. Failed checks returncompletion_rejectedwith the failing output and the worker continues. - One owner notification. The owner session is told once when a goal finishes, with the worker's summary and evidence.
- Ordered steering. Owner input for a busy worker is queued, not raced against the in-flight turn. It is delivered on the next permitted turn.
- Manual means manual.
interactive: truenever auto-continues. No idle recovery, no retries, no tick-forced turns. Every turn comes fromsend_goal_input,nudge_goal,resume_goal, orretry. - Pause is durable. Pause fences new writes, persists, and survives host restart. A paused goal stays paused after the process that created it dies.
- Clear is final. Clear aborts the worker and removes goal, runtime, and
ledger. A late turn from a cleared worker cannot resurrect it, and a
subsequent
nudge_goalwith that ID fails as unknown. - Scoped writes are exact. Under
write_scope/claim_goal_scopea structured write outside the claim is denied before execution, and a denied or failed call releases its reservation.
bun run smoke:v2-lifecycle starts a real opencode serve on loopback with:
- private
XDG_CONFIG_HOME/XDG_DATA_HOME/XDG_STATE_HOME/XDG_CACHE_HOME - a private OpenCode database, so no session or config of the developer's is read
- the built
dist/server.jsloaded as a real plugin - a local OpenAI-compatible fixture model with no network or provider quota
- the tested host version pinned via
LOOPD_SMOKE_HOST_VERSION(default2.0.32)
It then drives the plugin the way an agent would — over HTTP prompts and
loopd_* tools, through CodeMode — and asserts each guarantee above. It also
kills and respawns the host mid-goal to prove pause durability.
What it asserts, by name:
| Coverage | Asserts |
|---|---|
plugin-activation |
The plugin loads in a real host process |
CodeMode-create |
Goal creation works through execute/CodeMode, not just direct tools |
separate-worker |
The worker is a different session from the owner |
automatic-continuation |
The loop engine continues the worker without owner input |
reject-failed-check |
A premature complete_goal is rejected exactly once, with failing output |
native-write |
The worker writes through the host's native write tool |
host-checked-completion |
Completion is host-checked, not self-reported |
owner-notification |
Exactly one completion notification reaches the owner |
busy-native-steering |
Steering a busy worker queues instead of racing |
manual-no-auto-continue |
An interactive goal never turns on its own |
pause / restart-preserves-paused-goal |
Pause persists across a real host restart |
resume |
Resume restarts turns on the retained goal |
clear-during-execution / cleared-ID-nudge |
Clear during a live turn is final |
scoped-claim / out-of-scope-write-denied / owned-write |
Scope claims hold on a real host, and unclaimed writes are denied pre-execution |
failed-tool-fence-cleanup |
A rejected tool call releases its reservation |
The run writes result.json with the coverage list, and a notCovered list for
what it deliberately does not assert.
Stated plainly so the gate is not read as broader than it is:
- Real provider quota exhaustion and retry budgets. The fixture cannot spend money or hit rate limits.
- The interactive TUI. The gate drives tools and HTTP, not a terminal.
- Native child-bridge topology. The gate runs where the host falls back to a
root worker; it asserts
workerTopologyinresult.jsonrather than assuming. - Power loss. The gate kills the host gracefully; it does not simulate a corrupted write or a torn transaction.
- Main-session behavior while a workspace reservation is held under lock contention.
These need their own suites. Until then, do not claim them.
bun run build:server # the gate loads dist/server.js
bun run smoke:v2-lifecycle # real OpenCode v2 host, disposable stateTo test a specific host build:
OPENCODE_V2_BIN=/path/to/opencode \
LOOPD_SMOKE_HOST_VERSION=2.0.32 \
bun run smoke:v2-lifecycleCI runs this gate before npm publish, with @opencode/cli pinned to the tested
version. Failures upload the private artifact directory, including per-model-call
request dumps, so a red gate is diagnosable without reproducing it locally.
If you add a promise to the table above, add the assertion to
scripts/smoke-v2-lifecycle.ts in the same change. A promise that only exists in
the fixture is a promise nobody gets.