Skip to content

fix(client): treat any 4xx on stop as already-stopped, not an error#11

Closed
derencius wants to merge 1 commit into
mainfrom
fix/cancel-workflow-tolerate-4xx-already-stopped
Closed

fix(client): treat any 4xx on stop as already-stopped, not an error#11
derencius wants to merge 1 commit into
mainfrom
fix/cancel-workflow-tolerate-4xx-already-stopped

Conversation

@derencius

@derencius derencius commented May 30, 2026

Copy link
Copy Markdown
Member

Problem

cancel_workflow only treated 404/410 as "already stopped" and re-raised every other client error. The API returns 400 when a run is already in a terminal state — that escaped as a raw Faraday::BadRequestError, which isn't an OutputWorkflows::APIError, so callers that rescue APIError (e.g. when cancelling a concurrent execution before dispatching a new one) missed it and failed.

Fix

Any 4xx on the stop call means the run can't be stopped (terminal, gone, or expired) — functionally "already stopped". Return false instead of re-raising.

Testing

  • New parameterized tests assert 400/404/409/410 all return false (400/409 previously raised — TDD red confirmed).
  • Full client suite: 20 runs, 0 failures.

🤖 Generated with Claude Code

cancel_workflow only swallowed 404/410 and re-raised other client errors.
A 400 (run already terminal on the API) escaped as a raw
Faraday::BadRequestError — which isn't an OutputWorkflows::APIError, so
the caller's rescue missed it and the whole job failed. ATLAS-11Z:
Sitemap::HealthAuditJob died 69 times in 4 days cancelling a concurrent
execution whose run was already done.

Any 4xx on the stop call means the run can't be stopped (terminal, gone,
or expired) — functionally already stopped — so return false instead of
raising.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@derencius

Copy link
Copy Markdown
Member Author

Superseded by #12 — recreated with a clean commit message (this is a public repo; the original message referenced internal infra).

@derencius derencius closed this May 30, 2026
@derencius derencius deleted the fix/cancel-workflow-tolerate-4xx-already-stopped branch May 30, 2026 18:59
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