Skip to content

incorrect status after user cancels a job. #9281

Closed as not planned
Closed as not planned
@spikecurtis

Description

@spikecurtis

I feel like our Status computation between Canceled and Failed is wrong

https://github.com/coder/coder/blob/31ffb566d0cedbf1d80f140bc9de36049dc1fe0a/coderd/database/db2sdk/db2sdk.go#L78C1-L85C39

We only return Canceled if there is no Error, but the terraform provisioner generally returns an Error when it is canceled, so the Status ends up Canceling -> Failed.

I don't think its a good idea for provisioners to not return an Error when canceled, because then we can't tell the difference between something that was genuinely canceled and a job that completed before the cancel was processed.

So, in practice, we never see the Canceled state.

I did some digging, and it was me that complained about not being able to get to the "failed" state after cancel in the first place: #1374

Perhaps we need to distinguish 3 cases in the response from the provisioner after you send the cancel.

  1. Job completed successfully before we processed the cancel
  2. Job canceled
  3. Job failed for a reason unrelated to the cancel

Metadata

Metadata

Assignees

Labels

s2Broken use cases or features (with a workaround). Only humans may set this.staleThis issue is like stale bread.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions