Skip to content

Add compilation cancel for stuck Compilations - #54

Merged
raghubetina merged 1 commit into
mainfrom
compilation-cancel
Oct 5, 2026
Merged

raghubetina merged 1 commit into
mainfrom
compilation-cancel

Conversation

@raghubetina

@raghubetina raghubetina commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A Project allows one active Compilation. When one never finishes (its Render One-Off died, a database hiccup), every later plan push and plan compile fails with 409 compilation_active, and CLI 0.8.1 has no way to cancel it. Recovery needed a facilitator calling the Service with the attendee's token, or a worker shell.

firstdraft compilation cancel <compilation-id> calls the Service's existing POST /v1/projects/{project_id}/compilations/{compilation_id}/cancel for the Project pinned in .firstdraft/state.json, with that origin's environment or saved token, and prints the cancelled Compilation in the same JSON shape as compilation status.

  • No Service change. The route, its responses, and its problem codes are already part of the API 0.7.x contract. Production's cancel controller and service are identical to service main.
  • Errors. A validated refusal is compilation_cancel_rejected and carries the Service problem (409 compilation_not_cancellable, 404 compilation_not_found, or 404 project_not_found). A 401 is authentication_required. A transport failure, 408, 5xx, or unvalidated response is compilation_cancel_unavailable, which is safe to repeat: the Service answers a repeated cancel with the same result and never changes a succeeded or failed Compilation. An invalid 200 is invalid_compilation_status.
  • Version. 0.8.2 with its CHANGELOG entry, per docs/commands.md#add-a-command step 7. No new src/ file, so the packed file list is unchanged. A merge releases nothing; the tag and publication wait for owner approval.
  • Skills follow-up when bundling 0.8.2. The CLI pin and requires.cli, the startup version probe, the root-help regex in script/cli-contract/local-commands.mjs, and recovery guidance that points compilation_active at compilation cancel.

Docs: updated docs/commands.md, docs/errors.md, README.md, and CHANGELOG.md

Review: codex-review 0.7.3, max effort, session 3381a7fd-97d5-4fae-8e66-d2b98d97d98b, needs attention; its one finding is accepted and fixed in this commit

Validation

At 80fb2ea, after npm ci --ignore-scripts:

  • npm audit: found 0 vulnerabilities
  • npm run check: passed; 274 tests, 274 pass, 0 fail, then pack:check and pack:smoke passed

A Project allows one active Compilation. When one never finishes,
for example because its Render One-Off died, every later plan push
and plan compile fails with 409 compilation_active. The Service has
a cancel route, and its compilation_active detail tells the caller
to cancel, but the CLI could not call it. Recovery needed someone
calling the API with the user's token, or a worker shell.

compilation cancel finds the Project and origin in local state, as
compilation status does, sends one POST with no precondition, and
prints the cancelled Compilation. The Service answers a repeated
cancel with the same result and never changes a succeeded or failed
Compilation, so an unconfirmed outcome is reported as
compilation_cancel_unavailable, which is safe to repeat, rather than
as request_outcome_unknown. A validated refusal keeps the Service
problem under compilation_cancel_rejected, the way a rejected
Compilation start does.

The new command takes the version to 0.8.2.
@raghubetina
raghubetina merged commit 92f2771 into main Oct 5, 2026
7 checks passed
raghubetina added a commit to firstdraft/skills that referenced this pull request Oct 5, 2026
A Project allows one active Compilation. When one never finishes,
every later plan push and plan compile fails with 409
compilation_active, and CLI 0.8.1 had no way out short of an
operator. CLI 0.8.2 (firstdraft/cli#54, merged as 92f2771) adds
compilation cancel.

Pin the bundled CLI to that merge, require CLI 0.8.2, and give the
recovery reference the order: read the Compilation with compilation
status <id> --wait, cancel it with compilation cancel <id> if it is
still queued or running, then rerun the failed command. The ID
appears only in the problem's response.detail, so SKILL.md allows
that one detail as an ID source when it is a lowercase UUIDv7.
Cancelling a --github Compilation also cancels the Project's
Publication singleton, so the agent asks first. The reference lists
the cancel errors and the Service's 409 and 404 refusals, and the
contract check expects cancel in both help texts. SKILL.md shrinks
by 5 bytes.

Depends on the CLI 0.8.2 release, which needs owner approval and
must publish before the plugin. Drop this commit if 0.8.2 does not
ship with plugin 0.8.4; the release commit's digest already covers
the tree without it.
raghubetina added a commit to firstdraft/skills that referenced this pull request Oct 5, 2026
A Project allows one active Compilation. When one never finishes,
every later plan push and plan compile fails with 409
compilation_active, and CLI 0.8.1 had no way out short of an
operator. CLI 0.8.2 (firstdraft/cli#54, merged as 92f2771) adds
compilation cancel.

Pin the bundled CLI to that merge, require CLI 0.8.2, and give the
recovery reference the order: read the Compilation with compilation
status <id> --wait, cancel it with compilation cancel <id> if it is
still queued or running, then rerun the failed command. The ID
appears only in the problem's response.detail, so SKILL.md allows
that one detail as an ID source when it is a lowercase UUIDv7.
Cancelling a --github Compilation also cancels the Project's
Publication singleton, so the agent asks first. The reference lists
the cancel errors and the Service's 409 and 404 refusals, and the
contract check expects cancel in both help texts. SKILL.md shrinks
by 5 bytes.

Depends on the CLI 0.8.2 release, which needs owner approval and
must publish before the plugin. Drop this commit if 0.8.2 does not
ship with plugin 0.8.4; the release commit's digest already covers
the tree without it.
raghubetina added a commit to firstdraft/skills that referenced this pull request Oct 5, 2026
A Project allows one active Compilation. When one never finishes,
every later plan push and plan compile fails with 409
compilation_active, and CLI 0.8.1 had no way out short of an
operator. CLI 0.8.2 (firstdraft/cli#54, merged as 92f2771) adds
compilation cancel.

Pin the bundled CLI to that merge, require CLI 0.8.2, and give the
recovery reference the order: read the Compilation with compilation
status <id> --wait, cancel it with compilation cancel <id> if it is
still queued or running, then rerun the failed command. The ID
appears only in the problem's response.detail, so SKILL.md allows
that one detail as an ID source when it is a lowercase UUIDv7.
Cancelling a --github Compilation also cancels the Project's
Publication singleton, so the agent asks first. The reference lists
the cancel errors and the Service's 409 and 404 refusals, and the
contract check expects cancel in both help texts. Tighter retained
status wording keeps SKILL.md 1 byte smaller.

Depends on the CLI 0.8.2 release, which needs owner approval and
must publish before the plugin. Drop this commit if 0.8.2 does not
ship with plugin 0.8.4; the release commit's digest already covers
the tree without it.
raghubetina added a commit to firstdraft/skills that referenced this pull request Oct 5, 2026
A Project allows one active Compilation. When one never finishes,
every later plan push and plan compile fails with 409
compilation_active, and CLI 0.8.1 had no way out short of an
operator. CLI 0.8.2 (firstdraft/cli#54, merged as 92f2771) adds
compilation cancel.

Pin the bundled CLI to that merge, require CLI 0.8.2, and give the
recovery reference the order: read the Compilation with compilation
status <id> --wait, cancel it with compilation cancel <id> if it is
still queued or running, then rerun the failed command. The ID
appears only in the problem's response.detail, so SKILL.md allows
that one detail as an ID source when it is a lowercase UUIDv7.
Cancelling a --github Compilation also cancels the Project's
Publication singleton, so the agent asks first. The reference lists
the cancel errors and the Service's 409 and 404 refusals, and the
contract check expects cancel in both help texts. Tighter retained
status wording keeps SKILL.md 1 byte smaller.

Depends on the CLI 0.8.2 release, which needs owner approval and
must publish before the plugin. Drop this commit if 0.8.2 does not
ship with plugin 0.8.4; the release commit's digest already covers
the tree without it.
raghubetina added a commit to firstdraft/skills that referenced this pull request Oct 5, 2026
A Project allows one active Compilation. When one never finishes,
every later plan push and plan compile fails with 409
compilation_active, and CLI 0.8.1 had no way out short of an
operator. CLI 0.8.2 (firstdraft/cli#54, merged as 92f2771) adds
compilation cancel.

Pin the bundled CLI to that merge, require CLI 0.8.2, and give the
recovery reference the order: read the Compilation with compilation
status <id> --wait, cancel it with compilation cancel <id> if it is
still queued or running, then rerun the failed command. The ID
appears only in the problem's response.detail, so SKILL.md allows
that one detail as an ID source when it is a lowercase UUIDv7.
Cancelling a --github Compilation also cancels the Project's
Publication singleton, so the agent asks first. The reference lists
the cancel errors and the Service's 409 and 404 refusals, and the
contract check expects cancel in both help texts. Tighter retained
status wording keeps SKILL.md 1 byte smaller.

Depends on the CLI 0.8.2 release, which needs owner approval and
must publish before the plugin. Drop this commit if 0.8.2 does not
ship with plugin 0.8.4; the release commit's digest already covers
the tree without it.
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