Repository navigation
Carry the timeout cleanup outcome in the run summary (#863) - #1313
Merged
Merged
Conversation
Run lists now show what describe returns under run.timeout_cleanup (#863). The run summary gains a nullable timeout_cleanup JSON column, written from TimeoutCleanup::observe() whenever the whole run is projected. Cleanup entry and every close project the whole run, so the summary holds outcome running while cleanup is open and the recorded completed, failed, expired or preempted outcome after close; it is null for ordinary, armed, not-entered and completed runs. Bounded projections leave the column as it is. The model casts the column, so Waterline's serialized summaries carry it, and RunListItemView returns timeout_cleanup (null when absent) in its declared field list. The migration follows the task_attention column: outside the migrator transaction, under the schema lock budget, repeatable, no backfill. The additive-column rollback guard now covers both summary columns: the cached column check is shared, and a write that hits a dropped column retries without either one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The summary projector and RunListItemView sit under the replay corpus guard, so the change carries a regression fixture. The corpus test starts an opted-in run, checks the list item is null while armed, outcome running after the watchdog enters cleanup, and the recorded completed outcome after the cleanup turn closes the run. The summary migration iterates tables that have or lack the column through one helper instead of repeating the lost-lease migration's loops. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review notes on the run-summary change: - assertTimedOutAfterCleanup, shared by the executor-entry, same-turn, signal, selection, late activity result and worker-loss tests, now also checks describe, observation, detail, the projected summary and the list item against the recorded outcome. - A cleanup turn that runs a compensation activity: after the activity outcome, the bounded open-workflow-task projection is the summary's last writer, and the listed value is still outcome running. - The summary column and list field have their own constant, TimeoutCleanup::SUMMARY_COLUMN, instead of reusing STARTED_KEY. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Member
Author
|
Independent review: PASS at
🤖 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.



Part of #863: run lists carry the timeout cleanup outcome, matching describe (
run.timeout_cleanup), run detail and the bounded run observation.Shape
workflow_run_summaries.timeout_cleanup(TimeoutCleanup::SUMMARY_COLUMN). It holds exactly whatTimeoutCleanup::observe()returns:{outcome: "running", cause: "timeout", timeout_kind, started_at, work_deadline_at, cleanup_deadline_at}while cleanup is open, then the terminal event's recorded{outcome, timeout_kind, started_at, cleanup_deadline_at, finished_at, failure_id}. It is null for ordinary, armed, not-entered and completed runs.WorkflowRunSummarycasts it, so Waterline's serialized summaries include it.RunListItemViewreturnstimeout_cleanupin its declared field list, null when absent. This follows thetask_attentionprecedent: list items have a fixed key set, while describe and observation omit the key.timeout_cleanup_outcomecolumn. Nothing filters on it yet, and the JSON column keeps one source of truth. A scalar column with an index can be added if list filtering is needed later.When it is written
The column is written by the full
RunSummaryProjector::project()path. Cleanup entry (watchdog and executor) and every close (WorkflowTimedOutcompleted/failed/expired, and terminate/cancel preempted) project the whole run. The bounded projections (claim, activity/child groups, fresh-run fast path) leave the column as it is. Ordinary runs cost nothing:observe()returns early when there is no work deadline and no opt-in. The full path already loadsWorkflowStartedand the relevant events.Migration / backfill
2026_11_26_000100_add_timeout_cleanup_to_workflow_run_summariesfollows the lost-lease migration. It runs outside the migrator transaction, under the schema lock budget, is repeatable, and has no backfill. Existing rows stay null. A summary gains the value the next time its run is projected. An opted-in run that closed before the upgrade (workflow_runs.timeout_cleanup_work_deadline_at IS NOT NULL) keeps null untilworkflow:v2:rebuild-projections --run-id=...rebuilds it. Describe, detail and observation read history and are unaffected. I did not bumpRunSummaryProjector::SCHEMA_VERSION, because that would mark every summary in every fleet as needing a rebuild for a field only opted-in runs use.The schema-rollback guard used for
task_attentionnow covers both additive summary columns. The cached column check is shared (WorkflowTaskLeaseLoss::summaryHasColumn), and a write that hits a dropped column retries without the additive columns.Native Server: durable-workflow/server#1379. It needs no schema change, because its lists read
workflow_runsand history.Tests
V2TimeoutCleanupTest::assertVisibleTimeoutCleanupnow also checks the projected summary, its serialized form and the list item against describe/observation. That covers armed (null), running, completed, failed, expired, preempted (terminate and cancel), and a run without the option (null). Removing the projector line fails these assertions.timeout-cleanup-summary-listedwith a dedicated corpus test, required because the guardedsrc/V2/Support/*.phpchanged. The list item is null while armed,runningright after the watchdog enters cleanup, and the recordedcompletedoutcome after the cleanup turn closes the run.assertTimedOutAfterCleanupalso checks the summary and list item, together with describe, observation and detail. That covers executor entry, same-turn completion, the signal and selection waits, the late activity result and worker loss.testABoundedProjectionAfterACleanupActivityKeepsTheListedValue: after a cleanup compensation activity, the bounded open-workflow-task projection is the summary's last writer, and the listed value is stillrunning.V2TimeoutCleanupSummaryMigrationTest: runs outside the transaction, has no backfill, adds the nullable column to a populated table, and can run again. Its weights are added to.github/feature-test-timings.json;verify-feature-shards.phppasses.Run locally on SQLite:
V2TimeoutCleanupTest,V2TimeoutCleanupSummaryMigrationTest,V2LostLeaseTrackingMigrationTest,V2WorkflowTaskLostLeaseTest,RunListItemViewTest,MigrationsTest,V2RebuildProjectionsCommandTest, ECS on the changed files, and PHPStan (src tests, no errors). CI runs the MySQL/PostgreSQL matrix.🤖 Generated with Claude Code