You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Converge Data Machine's portable workflow contract, canonical dispatch surface, and generic run envelope on the current Agents API workflow substrate while retaining Data Machine as the durable domain runtime for jobs, packets, retries, recovery, persisted flows, and undo.
This is not a request to replace the Data Machine engine wholesale. A fresh cross-repository audit shows that Agents API has advanced substantially since the original bridge in #2339, but it still does not provide the durability protocol Data Machine requires.
Audited revisions
Data Machine: 92601c36d (main, current with origin/main)
Agents API: 5f89329 (main, current with origin/main)
Current Agents API ships ability, agent, foreach, and parallel, supports consumer step types, and includes real asynchronous suspension/resume.
The bridge's restriction was correct when #2339 shipped, but it no longer describes the substrate.
Recorder wiring is request-local
Data Machine has the right persistence seam:
inc/Core/AgentsApiWorkflowJobRecorder.php:17-235
It records Agents API runs in the Jobs table and implements start, update, find, and recent. However, ExecuteAgentWorkflowAbility constructs it locally at :130-152; it is not registered through the global recorder/resume seam used by asynchronous branch reconciliation.
Consequently, simply allowing parallel in the current bridge would be unsafe: a later Action Scheduler process could not reliably resolve the same recorder and resume the suspended run.
Parallel contract ownership is split
ParallelMapFanoutAdapter explicitly says Agents API owns the parallel contract while Data Machine reconstructs the gate and output envelope and dispatches through PipelineBatchScheduler:
This is the clearest long-term convergence candidate, but the current Data Machine backend also owns packet claims, child jobs, durable worklists, and terminal rollup. Those semantics must not be discarded to remove an adapter.
Generic-looking runtime surface is large, but not generically removable
The following current files alone are about 5,100 lines:
ExecuteStepAbility.php — 1,563
ScheduleNextStepAbility.php — 350
PipelineBatchScheduler.php — 734
BatchScheduler.php — 1,077
JobRetryPolicy.php — 781
DirectJobEnqueuer.php — 282
RunLifecycleStore.php — 340
Most of those lines enforce Data Machine domain durability, not generic workflow syntax. The goal is to delete duplicated contracts and dispatch surfaces while preserving that behavior.
Target ownership
Agents API owns
portable WP_Agent_Workflow_Spec syntax and structural validation;
${inputs.*}, ${steps.*}, and ${vars.*} bindings;
canonical agents/run-workflow dispatch;
generic step-handler and executor extension seams;
canonical run statuses and result envelope;
generic foreach and parallel orchestration contracts;
run-control, suspension/resume, and evidence/replay carrier contracts;
substrate-level Action Scheduler execution when its guarantees are sufficient.
Data Machine owns
persisted pipelines and flows as product/domain configuration;
datamachine_jobs as the authoritative operational ledger and workflow recorder;
user/agent authority, idempotency keys, parent-child jobs, and operation generations;
per-step durable Action Scheduler receipts and stale-generation fencing;
DataPacket persistence and processed-item claim/disposition accounting;
retries, backoff, poison-item isolation, checkpoint recovery, and stuck-job repair;
terminal accounting, metrics, notifications, artifacts, retention, and operator tooling;
system-task effect ledgers and undo.
Agents API deliberately leaves stores and recorders to consumers. Data Machine's tables are therefore the correct consumer backend, not duplication to remove.
Why wholesale replacement is unsafe
Current Agents API ordinary steps run in one PHP request; only parallel branches cross an Action Scheduler boundary. Data Machine schedules each step durably and persists ownership before and after effects.
Agents API currently lacks equivalents for:
delayed whole-run enqueue with Data Machine's idempotency and operation-generation protocol;
general per-step retry/backoff/checkpoint semantics;
general durable waits beyond the parallel suspension shape;
DataPacket storage and processed-item dispositions;
parent/child pipeline job rollup;
durable leased batch worklists;
flow admission, pause, queue, and backpressure policy;
terminal accounting and undo.
Migrating those responsibilities directly would be a correctness regression, not simplification.
Upstream blockers discovered by the fresh audit
Before Data Machine uses the Agents API Action Scheduler executor for side-effecting packet workflows, these current substrate issues must be resolved:
Register Data Machine as a runtime handler behind agents/run-workflow using wp_agent_workflow_handler.
Route the currently supported simple ability/agent subset through WP_Agent_Workflow_Runner.
Resolve a Jobs-backed recorder through the canonical recorder seam rather than constructing an isolated request-local instance.
Preserve Data Machine job provenance and authority checks.
Inventory actual consumers of datamachine/execute-agent-workflow; migrate them to agents/run-workflow, then remove the duplicate ability rather than retaining an indefinite alias.
Phase 2: canonical result projection
Store and return the Agents API canonical run-result envelope directly.
Keep Data Machine status projection only at the Jobs boundary.
Remove duplicate result/status carriers that become unreachable, with grep and test evidence.
compare Agents API branch execution against PipelineBatchScheduler under realistic Events workloads;
preserve Data Machine child jobs, packet claim transfer, worklist durability, cancellation, and terminal rollup;
either register Data Machine's durable pipeline backend behind the Agents API executor contract or adopt the substrate backend where measured semantics match;
remove ParallelMapFanoutAdapter only when no behavior is lost.
Phase 5: delete proven duplication
Delete only code made unreachable by the converged path. Do not measure success by replacing Data Machine domain behavior with weaker generic behavior.
Acceptance criteria
One canonical portable workflow entry point: agents/run-workflow.
Data Machine registers as a consumer runtime rather than exposing a competing generic workflow ability.
Data Machine Jobs remain the authoritative recorder and can resolve runs across requests/processes.
Simple ability and agent workflows execute through the canonical path with preserved job provenance.
Suspended/resumed runs use a globally resolvable, durable recorder before parallel support is enabled.
Persisted flows, packets, claims, retries, recovery, waiting states, batching, and undo retain current semantics.
No in-flight legacy job is switched to a different execution model.
Every deletion is backed by consumer inventory, grep evidence, and regression coverage.
Architecture tests enforce that Agents API remains domain-agnostic and Data Machine-specific names do not move upstream.
The issue is split into bounded implementation issues/PRs by phase; no all-at-once runtime rewrite.
Non-goals
Replacing datamachine_jobs with Agents API's option-backed run control.
Converting all persisted flows into plain workflow specs.
Moving DataPacket, claim, retry, recovery, batching, or undo behavior into Agents API.
Enabling Agents API parallel execution for side-effecting Data Machine workloads before the upstream blockers are fixed.
Maintaining two permanent public workflow abilities for compatibility without an identified consumer.
Used for: Fresh cross-repository architecture audit, current-source verification, migration boundary design, and issue drafting. Chris remains responsible for prioritization and implementation review.
Summary
Converge Data Machine's portable workflow contract, canonical dispatch surface, and generic run envelope on the current Agents API workflow substrate while retaining Data Machine as the durable domain runtime for jobs, packets, retries, recovery, persisted flows, and undo.
This is not a request to replace the Data Machine engine wholesale. A fresh cross-repository audit shows that Agents API has advanced substantially since the original bridge in #2339, but it still does not provide the durability protocol Data Machine requires.
Audited revisions
92601c36d(main, current withorigin/main)5f89329(main, current withorigin/main)Since June, Agents API added or hardened:
parallelmap/roles contracts (workspace write: support @file syntax for --content flag #389, fix: Multisite activation and new site support (#382) #395);The original Data Machine bridge predates most of that substrate.
Current overlap and drift
Duplicate workflow execution entry points
Data Machine exposes
datamachine/execute-agent-workflowin:inc/Abilities/Job/ExecuteAgentWorkflowAbility.php:28-87Agents API already owns canonical workflow dispatch through
agents/run-workflowand thewp_agent_workflow_handlerruntime seam:src/Workflows/register-agents-workflow-abilities.php:207-266Data Machine currently does not register that runtime seam. Consumers must know which of two workflow abilities to call.
The bridge subset is stale
ExecuteAgentWorkflowAbilityaccepts only top-levelabilityandagentsteps:inc/Abilities/Job/ExecuteAgentWorkflowAbility.php:21inc/Abilities/Job/ExecuteAgentWorkflowAbility.php:189-229Current Agents API ships
ability,agent,foreach, andparallel, supports consumer step types, and includes real asynchronous suspension/resume.The bridge's restriction was correct when #2339 shipped, but it no longer describes the substrate.
Recorder wiring is request-local
Data Machine has the right persistence seam:
inc/Core/AgentsApiWorkflowJobRecorder.php:17-235It records Agents API runs in the Jobs table and implements
start,update,find, andrecent. However,ExecuteAgentWorkflowAbilityconstructs it locally at:130-152; it is not registered through the global recorder/resume seam used by asynchronous branch reconciliation.Consequently, simply allowing
parallelin the current bridge would be unsafe: a later Action Scheduler process could not reliably resolve the same recorder and resume the suspended run.Parallel contract ownership is split
ParallelMapFanoutAdapterexplicitly says Agents API owns theparallelcontract while Data Machine reconstructs the gate and output envelope and dispatches throughPipelineBatchScheduler:inc/Abilities/Engine/ParallelMapFanoutAdapter.php:7-63inc/Abilities/Engine/ParallelMapFanoutAdapter.php:120-160inc/Abilities/Engine/ParallelMapFanoutAdapter.php:182-247This is the clearest long-term convergence candidate, but the current Data Machine backend also owns packet claims, child jobs, durable worklists, and terminal rollup. Those semantics must not be discarded to remove an adapter.
Generic-looking runtime surface is large, but not generically removable
The following current files alone are about 5,100 lines:
ExecuteStepAbility.php— 1,563ScheduleNextStepAbility.php— 350PipelineBatchScheduler.php— 734BatchScheduler.php— 1,077JobRetryPolicy.php— 781DirectJobEnqueuer.php— 282RunLifecycleStore.php— 340Most of those lines enforce Data Machine domain durability, not generic workflow syntax. The goal is to delete duplicated contracts and dispatch surfaces while preserving that behavior.
Target ownership
Agents API owns
WP_Agent_Workflow_Specsyntax and structural validation;${inputs.*},${steps.*}, and${vars.*}bindings;agents/run-workflowdispatch;foreachandparallelorchestration contracts;Data Machine owns
datamachine_jobsas the authoritative operational ledger and workflow recorder;Agents API deliberately leaves stores and recorders to consumers. Data Machine's tables are therefore the correct consumer backend, not duplication to remove.
Why wholesale replacement is unsafe
Current Agents API ordinary steps run in one PHP request; only
parallelbranches cross an Action Scheduler boundary. Data Machine schedules each step durably and persists ownership before and after effects.Agents API currently lacks equivalents for:
Migrating those responsibilities directly would be a correctness regression, not simplification.
Upstream blockers discovered by the fresh audit
Before Data Machine uses the Agents API Action Scheduler executor for side-effecting packet workflows, these current substrate issues must be resolved:
Further gaps that should be tracked separately before broad convergence:
Migration plan
Phase 1: canonical dispatch, existing simple subset
agents/run-workflowusingwp_agent_workflow_handler.ability/agentsubset throughWP_Agent_Workflow_Runner.datamachine/execute-agent-workflow; migrate them toagents/run-workflow, then remove the duplicate ability rather than retaining an indefinite alias.Phase 2: canonical result projection
Phase 3: explicit Data Machine step integration
Phase 4: evaluate fanout backend convergence
Only after #531, #532, and #533 are resolved:
PipelineBatchSchedulerunder realistic Events workloads;ParallelMapFanoutAdapteronly when no behavior is lost.Phase 5: delete proven duplication
Delete only code made unreachable by the converged path. Do not measure success by replacing Data Machine domain behavior with weaker generic behavior.
Acceptance criteria
agents/run-workflow.abilityandagentworkflows execute through the canonical path with preserved job provenance.parallelsupport is enabled.Non-goals
datamachine_jobswith Agents API's option-backed run control.Related
parallelworkflow step handler (agent fanout) Automattic/agents-api#389AI assistance