Skip to content

[Brook] Added the previous completed and failed Workflow Tasks to the interceptor info. - #199

Closed
moetemp wants to merge 4 commits into
moe/brook/v3/c1-workflow-task-interceptorfrom
moe/brook/v3/c2-history-facts
Closed

moetemp wants to merge 4 commits into
moe/brook/v3/c1-workflow-task-interceptorfrom
moe/brook/v3/c2-history-facts

Conversation

@moetemp

@moetemp moetemp commented Oct 21, 2026

Copy link
Copy Markdown
Owner

What changed?

This PR adds two History facts to WorkflowTaskCompletionInfo.

  • previous_completed is the last completed task of the run. Its id comes from the poll response's previous_started_event_id (field 4), its attempt from that task's WorkflowTaskScheduled event, and its start time from its WorkflowTaskStarted event.
  • failed_tasks has the started event ids of all WorkflowTaskFailed and WorkflowTaskTimedOut events of the run, oldest first. A schedule-to-start timeout has no started event, so it is not there. A reset run lists the task that the reset failed.

The machines collect both in the loop that already applies each event. The test history builder now sets started_event_id on the failed and timed-out events, as the server does.

Why?

A plugin that withdraws the output of failed task attempts needs these facts, and Core already has them. A failed task's output may be withdrawn many completed tasks later, so the list covers the whole run. A superset is always safe, and continue-as-new keeps it short.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

Canned histories with a failed attempt, a start-to-close and a schedule-to-start timeout, an UnhandledCommand refusal and its retry, a reset, a failure before an earlier completion, and a sticky partial history after a timeout. The speculative-drop and heartbeat tests now also check previous_completed.

A plugin that withdraws the output of failed workflow task attempts needs these History facts. Core already applies the events, so it hands them on.
…ok/v3/c2-history-facts

# Conflicts:
#	crates/sdk-core/src/core_tests/workflow_task_interceptor.rs
A plugin withdraws a failed task's output at its next write to the same stream, which can come many completed tasks later. A superset of the failed tasks is always safe.
@moetemp moetemp changed the title [Brook] Added the previous completed and failed tasks to the interceptor info. [Brook] Added the previous completed and failed Workflow Tasks to the interceptor info. Oct 21, 2026
@moetemp

moetemp commented Oct 25, 2026

Copy link
Copy Markdown
Owner Author

Closing as stale. This layer is folded into the v5 tip, #209, and the upstream review uses one fresh PR instead. Plan: https://www.notion.so/4048fc567738814990b7c796ac28fe3f

@moetemp moetemp closed this Oct 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant