Skip to content

feat(backend): a decision request accepts several resume actions - #195

Draft
dawidaksamski wants to merge 4 commits into
mainfrom
feat/WB-681-backend-several-resume-actions
Draft

dawidaksamski wants to merge 4 commits into
mainfrom
feat/WB-681-backend-several-resume-actions

Conversation

@dawidaksamski

Copy link
Copy Markdown
Contributor

What

A decision request may now offer one or more resume actions, each routed on its own port. A step can have several normal outcomes, such as a review that is complete or incomplete, and none of them counts as a rejection. Until now the second outcome had to be reject, which records rejected on the run, and a run keeps the first outcome it declares.

  • reject and rerun-source stay at most one each. reject is still the only action that records an outcome. A request still needs at least one resume (resume_required).
  • Every routed action has its own port. A port two actions share is refused on publish and execute as duplicate_port, on the later action's port. It replaces reject_port_equals_resume_port: with several resume actions there is no one pair to compare. A blank port still answers port_empty alone.
  • The decision route is unchanged. It already finds the action by name and routes on that action's port, and edits work on any resume action. New tests pin this.
  • A reason stays optional on resume; reasonRequired is honoured on reject only. No client can ask a decider for a note on a resume action yet, and the flag can be added later without touching stored requests (follow-up: decision-resume-reason-required).
  • The schema only loosens, so a run parked under the old rule still decides.

Docs

  • Backend README: "Decision request on a node" and "Deciding" describe the new rules. A new section, "Trying several resume actions on the local stack", walks through a review with two resume actions and a reject, using only the API.
  • apps/backend/decision-request.decision-log.md: a new section, "Several resume actions", items 27 to 30.
  • The JSDoc on DecisionRequest and its action types says "one or more". It reaches the published types of @workflowbuilder/temporal through BaseNode.decisionRequest, but only as comment wording, so there is no changeset. pr-check.yml may warn about that.

Not in this PR

  • The AI Studio decision form still offers only the first resume action. The canvas already draws one handle per routed action. Offering every action, and a Review node with several resume actions, are the next two changes.
  • Settled values after a decision, and a per-action outcome.

Testing

  • Backend: 507 tests in 25 files pass; tsc, eslint and prettier are clean. New tests cover:
    • several resume actions accepted beside one reject and one rerun-source;
    • a shared port refused in either order, and three actions on one port giving one issue per later action;
    • blank ports giving only port_empty;
    • a two-resume request publishing although no edge leaves its ports;
    • a decision on the second resume action routing on its port with no outcome, with and without edits.
  • The route tests passed without a source change, as expected. To prove they can fail, the validator was broken on purpose so every resume decision snapped to the first resume action: all five new tests failed.
  • AI Studio: 595 tests in 42 files pass, including the contract test that parses the shipped requests with the backend schema.
  • Manual, the README walkthrough on the local stack:
    • Decide incomplete: the run continues on that port, the other branch is skipped, and the run ends completed with no outcome.
    • Decide complete: the other branch runs, again with no outcome.
    • Decide reject without a reason: 400 invalid_decision with reason_required. With a reason: the run ends with outcome: 'rejected'.
    • Publish a copy whose two resume actions share a port: 400 invalid_snapshot with duplicate_port at actions.1.port.

@dawidaksamski dawidaksamski self-assigned this Oct 2, 2026
@dawidaksamski
dawidaksamski added this pull request to stack #199 October 2, 2026 15:24
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