fix(api): report a finished run's real status once its pauses have settled; show the request id in the CLI

Merged
WA
3d ago
+453-56

Summary

  • Run status after a failed resume. A run whose resume ran and failed was still reported as paused (with error: null) by Get workflow run and in the run list, because any open pause record overrode the finished log. When a resume fails, the run's log is marked failed and the point failed in the same transaction, and admission refuses any point that isn't paused, so nothing can resume it again. The run is now reported as paused only while a point can still be resumed. Once the log has finished and every point has resumed or failed, it reports the finished status, its error, and the failing block, like any other failed run. Seen in production on a run whose time pause resumed and then a later block failed.
  • Runs with a waiting human or time pause still read paused, including partially_resumed runs and finished runs that still have a waiting point. Cancellation's rollback of a failed point happens while the log is still running, so it's unaffected. The workspace paused-runs list and the approval link already required a waiting point.
  • The run list's status column applies the same rule through a shared PAUSE_POINT_ROWS SQL helper (both pause-point storage shapes), which the paused-runs list now also uses.
  • The paused status description is updated to match.
  • CLI request id. The server's requestId (or x-request-id when the body has none) is now shown on CLI errors: in the JSON error object and as a request id: line in human output. Rewritten errors also keep their exit code, which was previously reset to 1.

Test plan

  • Unit: a settled failed run reports failed with its error and failing block (fails with the old rule); runs with a waiting human or time pause still read paused
  • CLI: request id shown in JSON and human output (fails without the fix)
  • execution-status, projection, v2 workflow route and list tests pass; sim-cli type-check clean
  • generate/check: openapi, mcp-operations, cli-api, cli-docs; api-validation:strict, boundaries, comment-hygiene, file-names
  • CI integration: a settled failed run reads failed in the run detail and the run list; a finished run with a waiting point still reads paused