Description
packages/protocol/openapi.json is committed, and packages/protocol has a drift check ("check:generated": "bun run script/generate-openapi.ts --check"). CI never runs it. In .github/workflows/test.yml (same lines at v2.0.22 and on v2, ~164-172), the check:generated steps run only in packages/client and services/www:
packages/client generates from ClientApi in source, so it never reads openapi.json.
services/www/script/generate-openapi.ts only copies packages/protocol/openapi.json to services/www/openapi.json and services/www/public/openapi.json, so its check compares the copies with the committed file, not with the source.
So the committed document can drift from packages/protocol/src without any check failing. The published API reference serves the same file, so it carries the same drift.
On tag v2.0.22 (527f0b9):
- The committed document has 136 operations. Regenerating gives 140. Missing from the committed file:
server.pair (POST /api/pair)
server.connect (GET /auth/connect/{code})
credential.list (GET /api/credential)
credential.create (POST /api/credential)
- The optional
message query parameter added to session.form.cancel in feat(core): let form cancellation carry a message #52137 (02c3891) is listed under session.form.reply in the committed file. The regenerated output puts it on session.form.cancel (DELETE /api/session/{sessionID}/form/{formID}). That matches packages/protocol/src/groups/session.ts and SessionFormCancelInput in the generated promise client.
- At
v2.0.18 the source already defined server.pair / server.connect, but the committed document did not list them.
On v2, 41516c7 (#51455) later regenerated the document, and session.form.cancel now carries message. The CI gap remains, so the drift can come back.
Proposal: add a step to the same set in test.yml, for example:
- name: Check generated protocol document
if: runner.os == 'Linux'
working-directory: packages/protocol
run: bun run check:generated
Put it before "Check generated documentation", so a stale source document fails before its copies are compared.
Context: we consume this document to build a .NET SDK (opencode-dotnet/opencode-sdk-dotnet).
Plugins
None
OpenCode version
v2.0.22 (tag), also checked v2 at 077444b
Steps to reproduce
git clone https://github.com/anomalyco/opencode && cd opencode && git checkout v2.0.22
bun install --frozen-lockfile (bun 1.4.2)
cd packages/protocol && bun run script/generate-openapi.ts --check
- Output:
Generated OpenAPI document is stale. Run `bun run generate` from packages/protocol., exit code 1.
bun run generate, then diff openapi.json: 4 operations are added and message moves from session.form.reply to session.form.cancel.
Screenshot and/or share link
N/A
Operating System
Windows 11 (the check is platform-independent; CI would run it on the Linux leg)
Terminal
Git Bash