Skip to content

Extend WorkOrder as a contextual pre-Run request for managed execution #3186

Description

@eanz17

Summary

Extend the existing WorkOrder resource as a contextual, persistent request that coordinates managed execution before a Run exists.

Do not introduce a separate Goal resource. The durable request semantics that would otherwise belong to a Goal are already owned by WorkOrder.

Per #3107:

  • Run remains the canonical execution resource.
  • Activity remains the canonical surface for observing all Runs.
  • WorkOrder must not become a parallel execution workspace or lifecycle model.

This issue follows #2789 and reuses the narrowed implementation delivered by #2941.

Product semantics

WorkOrder owns:

  • the durable user request;
  • requester and assignment;
  • reassignment, cancellation, and dispatch decisions;
  • optimistic lifecycle concurrency; and
  • the typed WorkOrder-to-Run relationship after dispatch.

A WorkOrder:

  • may exist before a Run;
  • may remain undispatched without a deadline;
  • may be reassigned or cancelled only before dispatch;
  • links to the resulting Run after dispatch; and
  • does not own Run execution state.

Once a Run exists, the following belong exclusively to Run and Activity:

  • execution status and progress;
  • approval and Needs you;
  • failure diagnosis and retry;
  • usage and runtime telemetry; and
  • execution timeline and runtime output.

WorkOrder Detail must link to Run Detail instead of copying or independently deriving those states.

UX scope

Add only contextual WorkOrder access:

  • expose a scoped WorkOrder list or entry from the context that creates or owns the request;
  • allow a scoped direct link to WorkOrder Detail;
  • show the WorkOrder request, assignment, lifecycle state, and applicable management actions; and
  • show Open Run when the existing typed Run reference is available.

Do not:

  • add WorkOrder to the global navigation;
  • create a global WorkOrder inbox or attention queue;
  • mix WorkOrder rows into Activity;
  • duplicate Run status, approval, failure, retry, usage, or Needs you UI; or
  • infer relationships from IDs, prefixes, correlation IDs, or run_origin.

Contract and implementation constraints

  • Reuse the existing create, receipt, dispatch, and observe path delivered by Narrow WorkOrder to durable intent coordination #2941. This is a guardrail, not a request for another execution-entry facade.
  • Reuse the existing typed WorkOrder-to-Run fields: run_id, run_actor_id, command_id, and correlation_id.
  • Do not add Run-to-WorkOrder reverse lineage until a concrete Run Detail or query consumer requires it. If added later, it must be a typed work_order_id; it must not be inferred from run_origin, naming rules, or correlation.
  • Scope-authorized readers may query the scoped WorkOrder read model.
  • Mutations remain protected by requester/Scope authorization and expectedLifecycleVersion.
  • The frontend must not reproduce the WorkOrder lifecycle state machine. If contextual action controls are included, expose their availability using typed Actor-owned current-state semantics; command handling remains the final authority.
  • Do not add Audit navigation in this issue. Audit currently has no typed work_order_id; adding Audit correlation requires a separate concrete consumer and contract change.
  • Continue to use WorkOrderCurrentStateDocument as the query source. Do not add a second store, process-local registry, query-time replay, or projection priming.

Acceptance criteria

  • A WorkOrder can be created and queried before any Run exists.
  • An undispatched WorkOrder remains a durable, addressable request.
  • Authorized users can perform the supported assignment, reassignment, cancellation, and dispatch operations.
  • Dispatch continues to produce the existing typed WorkOrder-to-Run linkage.
  • The contextual WorkOrder surface links to canonical Run Detail after dispatch.
  • Runtime progress, approval, attention, failure, retry, and usage remain owned by Activity/Run Detail.
  • No top-level WorkOrder navigation, global attention queue, or Activity row is introduced.
  • UI authorization and action availability are not inferred from route shape or duplicated client-side lifecycle rules.
  • Accepted receipts do not claim Actor commit, read-model visibility, Run start, or completion.
  • Reassign, dispatch, and cancel use expectedLifecycleVersion; stale commands fail closed and the UI refreshes from the read model.
  • Tests use distinct identity shapes, including workOrderId = "wo-alpha", memberId = "m-alpha", workflowId = "wf-alpha", publishedServiceId = "svc-alpha", and runId = "run-alpha".
  • Relevant contracts, projection behavior, authorization paths, and product semantics are covered by tests and documentation.

Non-goals

  • A new Goal, Project, Initiative, or Campaign aggregate.
  • A second execution lifecycle parallel to Run.
  • A global WorkOrder workspace.
  • WorkOrder-owned approval or Needs you.
  • A WorkOrder-owned post-Run fulfillment or result-acceptance axis. Add orthogonal WorkOrder fulfillment state and evidence references #3200 proposes one separately and requires its own product decision; the contextual surface in this issue does not render or depend on it.
  • Query-time projection priming.
  • Run-to-WorkOrder reverse lineage without a concrete consumer.
  • Scheduled-fire-to-WorkOrder materialization; that belongs in a caller-specific follow-up issue.
  • Forcing every Team, member, service, workflow, channel, tool, or chat invocation through WorkOrder.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions