Skip to content

Return timeout cleanup in the bounded run observation - #1344

Merged
rmcdaniel merged 2 commits into
mainfrom
general/server-1201-observation
Nov 26, 2026
Merged

rmcdaniel merged 2 commits into
mainfrom
general/server-1201-observation

Conversation

@rmcdaniel

Copy link
Copy Markdown
Member

Follow-up to #1336 for #1201: native's bounded run observation now returns timeout_cleanup, as the portable contract (workflow/docs/architecture/timeout-cleanup.md, "Describe returns…") and embedded RunObservation do.

What changes

  • Observation. GET /api/workflows/{id}/runs/{run}/observation adds a top-level timeout_cleanup for an opted-in run once cleanup is recorded. It follows embedded TimeoutCleanup::observe:

    • Open run with WorkflowTimeoutCleanupStarted: {outcome: "running", cause: "timeout", timeout_kind, started_at, work_deadline_at, cleanup_deadline_at}.
    • Timed out, cancelled or terminated: the terminal event's recorded {outcome, timeout_kind, started_at, cleanup_deadline_at, finished_at, failure_id}, keeping only string fields.
    • Absent while armed, after a completed run, for cancellation_cleanup-only closes, and for runs without the opt-in.

    The new logic is the pure timeout_cleanup::observation_event / observation, plus one indexed history read in run_observation_store.rs.

  • Divergences.

    • describe-timeout-cleanup-state now registers native describe's full shape: the armed and not_entered states where embedded omits the field, and the absent finished_at. It states that the observation is not divergent.
    • Both timeout-cleanup entries cite native 3.14.0 and embedded 2.40.0 instead of the stale "Native opt-in deadline-triggered timeout cleanup (#1201) #1235 (unreleased)" and 2.29.0.

No corpus run opts in, so parity comparators are unchanged.

Tests

  • Unit: the_observation_follows_embedded covers the event choice, the running and terminal shapes, the string filtering, and the outcome-less and unknown-outcome cases.
  • Execution:
    • the_earliest_hard_deadline_names_the_kind_and_describe_follows_the_state asserts the observation is absent while armed, matches the running shape from WorkflowTimeoutCleanupStarted, then equals the terminal timeout_cleanup.
    • Vector 11 asserts a run without the opt-in has no key.
  • Locally on SQLite: the 7 unit tests and both execution tests pass. CI runs the full matrix.

🤖 Generated with Claude Code

The run observation Waterline reads now carries a top-level
timeout_cleanup in the portable shape embedded Workflow 2.40.0 returns:
outcome running with the cause, kind, start and deadlines while cleanup
is open, then the outcome recorded on the terminal event. Nothing is
reported until cleanup is recorded or for a run without the opt-in.

The describe divergence now names native's armed and not_entered states
and the missing finished_at, and the timeout-cleanup divergences cite
native 3.14.0 and embedded 2.40.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The observation returns nothing for a non-object event payload, as
embedded does. The terminate and hard-cancel vectors assert the
observation's preempted outcome through the database, the unit test
covers every status, and the divergence entry dates the running outcome
and the observation shape to the release after 3.29.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rmcdaniel

Copy link
Copy Markdown
Member Author

Independent review: PASS at 131e1ff95ee5ef1900355abd1504926dcb482921. The reviewer saw only this PR and #1201, and read the embedded TimeoutCleanup::observe and RunObservation at 2.40.0.

  • First pass at ced89334: PASS.
    • The status-to-event mapping (including continued-as-new runs stored as completed), the latest-event choice, string filtering and the opt-in gate match embedded.
    • Runs without the opt-in make no extra query.
    • The divergence text matches timeout_cleanup_view, and since: native 3.14.0 is right.
  • Delta at 131e1ff9: PASS. It takes the non-blocking notes:
    • A non-object payload returns nothing.
    • The unit test covers every status.
    • The terminate and hard-cancel vectors assert the preempted observation through the database.
    • The divergence dates the running outcome and the observation shape to the release after 3.29.0.

🤖 Generated with Claude Code

@sonarqubecloud

Copy link
Copy Markdown

@rmcdaniel
rmcdaniel added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit d42989e Nov 26, 2026
64 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant