Files
openmotion/skills/openmotion-media
open-design-crew[bot] f9054f9108 fix(cloud): persist saving failure state and harden retry_save recovery (#1119)
* Fix cloud media save retry after CAS write failure

* Address review feedback on retry_save state transition, cancellation, requestId, and docs

- Transition retry_save rows atomically from failed to queued (stage=saving) before enqueuing so cancel before worker pickup marks the row cancelled and prevents worker claim.
- Require and propagate caller requestId for BullMQ jobId deduplication (clearing stale terminal BullMQ entries on explicit re-retry).
- Finalize cancelling rows cleanly to cancelled when CAS throws after a missed Redis cancel notification instead of stranding in cancelling or publishing a false failed event.
- Update skills/openmotion-media/references/jobs.md to document Cloud gateway recovery for retry_save.

* Harden cancel/retry_save concurrency, claim-epoch dedupe, and gateway docs

- Guard cancelJob transitions with optimistic state checks and check cancelled state in the worker commit transaction.
- Scope retry_save BullMQ jobId by claimToken epoch and record retrySaveRequestId so same-requestId retries recover cleanly after API restarts and Studio repeated retries never collide with a still-finishing BullMQ active job.
- Guard upstream failed poll transitions against overwriting cancelling rows.
- Update docs/model-gateway.md retry_save Cloud recovery guidance.

* Guard retry_save enqueue-failure rollback against racing replays

* fix(cloud): guard retry_save rollback by state/stage and clear failureStage on resume/completion

* fix(cloud): return 400 for retry_save missing requestId and align timeout hint

---------

Co-authored-by: 罗高 <luogao@users.noreply.github.com>
2026-11-26 08:37:10 +08:00
..