Repository navigation
Carry the timeout cleanup outcome in native run lists (workflow#863) - #1379
Merged
Merged
Conversation
GET /api/workflows and GET /api/workflows/{workflow_id}/runs now return
the bounded run observation's timeout_cleanup on each listed run that
recorded cleanup, and omit it otherwise, as embedded Workflow's run
summary does (workflow#863): outcome running with the cause, kind,
start and deadlines while cleanup is open, then the outcome recorded on
the terminal event.
Native lists read workflow_runs and history, not the summary table, so
this needs no schema change. The value comes from the same event the
observation reads (newest of the type observation_event chooses), now
one shared helper. Reads stay bounded per page: a closed run's
terminal event is its newest, so its lookup stops at once; an open run
can only be in cleanup while it holds a cooperative request, which one
query checks for the whole page; completed runs read nothing.
The describe divergence notes that, like the observation, the lists
return embedded's shape from the release after 3.30.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of the run-list change: every failed, cancelled or terminated run on a page read its history for the observation's event, and with no index on event_type an ordinary WorkflowFailed run scanned its whole history looking for WorkflowTimedOut. One query per page now selects the candidates. It joins each run's WorkflowStarted (unique (run, sequence) seeks: it is the first event, or the second after StartAccepted), keeps runs whose payload carries a timeout_cleanup object (per-backend JSON type predicates), and of those the closed runs and the open runs holding a cooperative request or imported (an embedded import does not copy the request). Only the candidates read the observation's event. This is the observation's own opt-in gate, so lists equal it exactly. A new test lists an ordinary failed run and an opted-in run cancelled before its work deadline without the key, on the same page as a run in cleanup. The port document describes the reads as they are, and the divergence entry says lists omit the key when absent, unlike their task_attention: null. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Member
Author
|
Independent review: PASS at
🤖 Generated with Claude Code |
Member
Author
|
The operator-dashboard follow-up mentioned in the body and in the review comment is won't do. The published PHP Server is frozen and its pinned Workflow version won't move, so the dashboard rows keep its summary shape. Lists, describe and the run observation carry 🤖 Generated with Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Native half of durable-workflow/workflow#863 (embedded: durable-workflow/workflow#1313). Run lists now carry the timeout cleanup outcome in the same portable shape as the bounded run observation (server#1344) and embedded describe.
API
GET /api/workflowsitems andGET /api/workflows/{workflow_id}/runsentries gaintimeout_cleanupwhen the run recorded cleanup:{outcome: "running", cause: "timeout", timeout_kind, started_at, work_deadline_at, cleanup_deadline_at}.{outcome, timeout_kind, started_at, cleanup_deadline_at, finished_at, failure_id}, keeping string fields only.No schema change
Native's run lists don't read
workflow_run_summaries.list_workflowsandlist_runsselect fromworkflow_runs, and only join the summary table to order imported Waterline projections. Native does write and read that table elsewhere (terminal_summary.rs,active_summary.rs,operator_metrics.rs), but none of those paths serve these lists. So the value is read at list time, the same waytask_attentionis, and there is no schema version bump, step file or catalog churn. The embedded PR stores the value in a summary column because its lists (Waterline,RunListItemView) read the summary table. Neither side needs the other's migration first.Operator dashboard: won't do. The dashboard rows that copy
WorkflowRunSummary::toArray()(operator_metrics.rs~137-160 and 391-393) keep the frozen published PHP Server's shape. That server's pinned Workflow version won't move, so native will not addtimeout_cleanupthere. Lists, describe and the run observation carry the field. No follow-up is open.Bounded reads
The opt-in check runs once per page. One query (
id INthe page, using the same JSON id-list form astask_attention) joins each run'sWorkflowStartedrow by unique(workflow_run_id, sequence IN (1,2))seeks.WorkflowStartedis the first event, or the second afterStartAccepted, on every native and embedded start, child, retry, continuation and redrive. It keeps runs whose payload carries atimeout_cleanupobject, using per-backend JSON type predicates. Of those, it keeps closed runs (failed, cancelled, terminated) and open runs that hold a cooperative cancellation request or were imported: cleanup entry sets the engine's request, nothing clears it while open, and an embedded import does not copy it. Only these candidates read the observation's event. That is the newest event of the typeobservation_event(status)chooses, via the sharedobserved_timeout_cleanup_eventhelper the run observation also uses. When a closed candidate's terminal event is the wanted type, it is the newest event and the lookup stops at once. An opted-in run that failed without timing out scans its own history once, exactly as its observation does. Ordinary runs (for example aWorkflowFailedrun), armed runs and completed runs read nothing beyond the page query. Lists apply the same opt-in gate as the observation.Tests
tests/execution/timeout_cleanup.rsgainsassert_listed. It checks that both lists equal the observation'stimeout_cleanup, or that the key is absent where the observation omits it. It runs for a run without the option, armed, running, completed, failed, completed-via-marker, expired (in cleanup and before detection), and preempted by terminate and by cancel. A mixed-page test lists an ordinary failed run and an opted-in run cancelled before its work deadline without the key, next to an opted-in run in cleanup. Locally on SQLite,timeout_cleanup::(15),visibility,continuation,run_observationandoperator_metricsexecution tests pass. CI runs the MySQL, MariaDB and PostgreSQL matrices.The
describe-timeout-cleanup-statedivergence anddocs/rust-server-port.mdnow say that lists, like the observation, return embedded's shape from the release after 3.30.0. The divergence also says lists omit the key when absent, unlike their always-presenttask_attention: null, so clients should treat absent and null alike.🤖 Generated with Claude Code