Skip to content

docs: opencode reports waiting for any prompt, not one event - #223

Merged
omartelo merged 1 commit into
mainfrom
docs/opencode-asked-contract
Aug 11, 2026
Merged

omartelo merged 1 commit into
mainfrom
docs/opencode-asked-contract

Conversation

@omartelo

Copy link
Copy Markdown
Collaborator

The opencode column of the state table named permission.asked — which was the whole client, until an opencode session asking an interactive question turned up waiting behind a card that showed a spinner. A question rides an event of its own (question.asked), and enumerating names is how it went unreported.

lich-plugin#14 fixed the client (shipped in v0.9.1); this writes the rule where the contract is canonical.

Why a rule instead of two names

opencode asks in four spellings today — permission.asked, question.asked, and a .v2. variant of each — and its catalogue is not exhaustive enough to enumerate against: a real opencode serve 1.18.16 run emits server.heartbeat, which appears in none of the 94 event schemas its own /doc publishes.

Measured on that run, and why the answer needs no event of its own:

ask     + 1665ms question.asked   …then 45s of silence, no status at all
reply   question.replied  → session.status busy   (+129ms)
reject  question.rejected → session.status idle   (+81ms)

No contract change

waiting is an existing state, the payload is unchanged, fixtures/ is untouched — so per the versioning rule in README.md this is a change within a contract: plugin-only release, no lich code. That is also why the plugin release could land first without breaking the lockstep the rule reserves for changes to a contract.

One ceiling the audit turned up

Two waiting reports for one prompt are two toasts and two desktop notifications. The toast reads the raw event deliberately (projects.tsx — a repeat state is no change to the store, which would swallow the second one), and decideStatusNotice (session-events.ts:346) weighs previous for done but never for waiting.

Nothing raises it today — every harness sends one event per prompt — but the suffix rule makes a duplicate cheaper to hit than a named list did, so the ceiling names where it has to be dropped: the client, not here. No behaviour change in this PR.

Gate

gofmt -l clean · go vet ./... clean · go test ./... green (30 packages). Docs-only, no frontend file touched.

The opencode column of the state table named `permission.asked`, which
was the whole client until a session asking an interactive question was
found waiting behind a card that showed a spinner: a question rides an
event of its own, and enumerating names is how it went unreported.

The plugin (v0.9.1) now matches any type ending in `.asked` — four
spellings today, and the catalogue is not exhaustive enough to enumerate
against: a real run emits types the 94 event schemas opencode publishes
do not list. The contract is canonical here, so the rule is written here.

Nothing about the contract itself moves: `waiting` is an existing state,
the payload is unchanged, and the fixtures are untouched. Per the
versioning rule in README.md this is a change *within* a contract — a
plugin-only release, which is why lich needs no code change.

Also records a ceiling the audit turned up. Two `waiting` reports for one
prompt are two toasts and two desktop notifications: the toast reads the
raw event on purpose, and decideStatusNotice weighs `previous` for `done`
but never for `waiting`. Harmless while a harness raises one event per
prompt, which they all do — but it names where a duplicate has to be
dropped, which is the client, not here.
@omartelo
omartelo merged commit 9118d14 into main Aug 11, 2026
2 checks passed
@omartelo
omartelo deleted the docs/opencode-asked-contract branch August 11, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant