Skip to content

docs(workflow): document JF execution policies and platform concurrency limits#166

Merged
anukiransolur merged 4 commits into
mainfrom
execution-policy
Jul 15, 2026
Merged

docs(workflow): document JF execution policies and platform concurrency limits#166
anukiransolur merged 4 commits into
mainfrom
execution-policy

Conversation

@k1LoW

@k1LoW k1LoW commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

The workflow service now supports per-key concurrency control for workflow job function (JF) dispatches: workflow scripts pass executionPolicyKey on .trigger() / tailor.workflow.triggerJobFunction(), and workspace-scoped policies declared via defineWorkflowExecutionPolicies cap how many dispatches with a matching key run at once. SDK-side coverage in docs/sdk/services/workflow.md and docs/sdk/configuration.md is auto-synced from tailor-platform/sdk#1679 by the sdk-docs-sync workflow, but the guide pages and platform-limits reference had no coverage of the new capability yet. This PR fills those gaps.

Changes

docs/guides/workflow/index.md

Add a new Concurrency Control section under How Workflow Execution Works. Structured as:

  • Workflow-level Concurrency PolicyconcurrencyPolicy.maxConcurrentExecutions on createWorkflow (scheduler-level; excess executions stay PENDING). Includes a createWorkflow snippet.
  • Job Function Execution PoliciesdefineWorkflowExecutionPolicies + executionPolicyKey (runner-level; excess dispatches suspend to PENDING_RESUME). Includes snippets for declaring policies, registering them on tailor.config.ts, and routing dispatches with .key (exact) vs. .keyFor(suffix) (wildcard).
  • Matching modes — table contrasting matchType: "exact" (one shared pool) and matchType: "prefix" (one independent pool per resolved key).
  • AND-of-caps — a wildcard one*, a narrower wildcard one.two*, and an exact one.two.three all apply simultaneously to a dispatch keyed one.two.three; each covering policy contributes a cap and the tightest one blocks. This corrects the "longest-prefix wins" mental model that the initial rollout implied.

docs/reference/platform/platform-limits.md

  • Extend the Service Limits table with two rows: Workspace Concurrent Job Functions (100 dispatches) and Per-Key Concurrent Job Functions fallback (50 dispatches).
  • Add a new Workflow Job Function Concurrency Limits section explaining the two platform hard limits, when the per-key fallback kicks in (only when the matching execution policy has no user-defined maxConcurrentExecutions), and the PENDING_RESUME + retry-after behavior when a cap is hit.

docs/guides/function/builtin-interfaces.md

  • Update the tailor.workflow.triggerJobFunction sample and API table to include the new options.executionPolicyKey argument, with an example dispatching through a wildcard policy and a link to the SDK reference for policy declaration.

Verification

  • pnpm build ✅ (232 URLs in sitemap, no schema errors, new anchors #concurrency-control, #workflow-level-concurrency-policy, #job-function-execution-policies, #workflow-job-function-concurrency-limits generated).
  • pnpm lint ✅ (only the pre-existing sitemap.ts unused-param warning).
  • Manually verified all new internal links (/sdk/services/workflow#concurrency-policy, /sdk/services/workflow#execution-policies, /reference/platform/platform-limits#workflow-job-function-concurrency-limits, /guides/workflow/#job-function-execution-policies) resolve on pnpm dev.

@k1LoW k1LoW self-assigned this Jul 14, 2026
@k1LoW
k1LoW requested a review from Copilot July 14, 2026 07:55

This comment was marked as outdated.

k1LoW added a commit that referenced this pull request Jul 14, 2026
…eference

Two Copilot review findings on #166:

- The Concurrency Control intro implied both policies hold excess work
  in PENDING, but the job function execution policy suspends the running
  workflow to PENDING_RESUME (not PENDING). Rewrite the intro to
  distinguish the two states.
- The SDK reference still said "longest matching prefix wins" for
  overlapping wildcard policies, contradicting the AND-of-caps behavior
  documented in the guide (matches the current platform implementation).
  Update the SDK page to describe the stacking behavior. The auto-sync
  from tailor-platform/sdk will need a matching upstream fix; this edit
  keeps the two pages consistent in the meantime.
@k1LoW
k1LoW requested a review from Copilot July 14, 2026 08:32

This comment was marked as outdated.

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread docs/guides/workflow/index.md
@k1LoW
k1LoW marked this pull request as ready for review July 14, 2026 09:19
@k1LoW
k1LoW requested a review from a team as a code owner July 14, 2026 09:19
k1LoW added 4 commits July 15, 2026 09:41
…cy limits

The workflow service now supports per-key concurrency control for job
function dispatches: workflow scripts pass `executionPolicyKey` on
`.trigger()` / `tailor.workflow.triggerJobFunction()`, and workspace-scoped
policies declared via `defineWorkflowExecutionPolicies` cap how many
dispatches with a matching key run at once. The SDK reference pages
(`docs/sdk/services/workflow.md`, `docs/sdk/configuration.md`) are
auto-synced from tailor-platform/sdk#1679, but the guide pages and
platform-limits reference had no coverage of the new capability yet.

- `docs/guides/workflow/index.md`: new "Concurrency Control" section that
  contrasts the scheduler-level per-workflow `concurrencyPolicy` with the
  runner-level `executionPolicyKey` mechanism, shows the exact- and
  wildcard-match modes with runnable SDK snippets, and explains how
  overlapping policies stack (AND-of-caps) so a broad wildcard cannot be
  silently disabled by a narrower policy.
- `docs/reference/platform/platform-limits.md`: add the two platform hard
  limits enforced by the workflow runner — workspace-wide 100 dispatches
  and the per-key fallback of 50 that applies when a policy has no
  user-defined cap — and describe the `PENDING_RESUME` retry behavior.
- `docs/guides/function/builtin-interfaces.md`: update the
  `tailor.workflow.triggerJobFunction` signature and table to include the
  new `options.executionPolicyKey` argument, with a link to the SDK
  reference for policy declaration.
…eference

Two Copilot review findings on #166:

- The Concurrency Control intro implied both policies hold excess work
  in PENDING, but the job function execution policy suspends the running
  workflow to PENDING_RESUME (not PENDING). Rewrite the intro to
  distinguish the two states.
- The SDK reference still said "longest matching prefix wins" for
  overlapping wildcard policies, contradicting the AND-of-caps behavior
  documented in the guide (matches the current platform implementation).
  Update the SDK page to describe the stacking behavior. The auto-sync
  from tailor-platform/sdk will need a matching upstream fix; this edit
  keeps the two pages consistent in the meantime.
- `docs/guides/workflow/index.md`: replace the awkward "unaffected by every declared policy" with "unaffected by all declared policies".
- `docs/reference/platform/platform-limits.md`: spell out `concurrencyPolicy.maxConcurrentExecutions` (both in the Service Limits table row and in the "Per-key fallback limit" description) so it is unambiguous where the user-defined cap is configured. Matches how the SDK reference names the setting.
…urn type

- `docs/sdk/services/workflow.md`: revert the local AND-of-caps rewrite. This file is regenerated by the `sdk-docs-sync` workflow, so hand edits here get overwritten on the next sync. The durable fix belongs upstream in `tailor-platform/sdk`; a follow-up PR there will bring the corrected wording back in through sync.
- `docs/guides/function/builtin-interfaces.md`: `triggerJobFunction` returns `Promise<any>` (the surrounding table already spells that out for `triggerWorkflow`, and the code sample `await`s the call).
@k1LoW
k1LoW force-pushed the execution-policy branch from 3da7827 to 88715b4 Compare July 15, 2026 00:42
@anukiransolur
anukiransolur merged commit c038e04 into main Jul 15, 2026
3 checks passed
@anukiransolur
anukiransolur deleted the execution-policy branch July 15, 2026 03:52
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.

3 participants