Skip to content

Add workflow scoped drain await helper#409

Merged
chubes4 merged 2 commits into
mainfrom
fix/fanout-foreground-drain
Jul 5, 2026
Merged

Add workflow scoped drain await helper#409
chubes4 merged 2 commits into
mainfrom
fix/fanout-foreground-drain

Conversation

@chubes4

@chubes4 chubes4 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a generic WP_Agent_Workflow_Scoped_Drain::drain_suspended_run() helper for foreground await/status callers.
  • Reuses the existing scoped Action Scheduler drain while centralizing the suspended-run terminal callback.
  • Keeps product code responsible for choosing a safe foreground context.

Root cause

Fanout consumers had a generic scoped drain primitive, but no generic helper that binds a suspended workflow run plus recorder to that drain. Callers had to wire branch/resume hook scope and terminal-state polling themselves, which left status/await paths easy to miss on runtimes where no WP-Cron runner pumps Action Scheduler.

Verification

  • php -l src/Workflows/class-wp-agent-workflow-scoped-drain.php
  • php tests/workflow-scoped-drain-smoke.php
  • php tests/workflow-parallel-async-smoke.php

Related

  • Supports chubes4/wp-build#1028 / chubes4/wp-build#962 by providing the upstream generic drain contract.

AI assistance

  • AI assistance: Yes
  • Tool(s): GPT-5.5 via opencode
  • Used for: Diagnosed the fanout drain ownership layer, implemented the helper, and ran focused verification.

@chubes4 chubes4 merged commit 24be217 into main Jul 5, 2026
2 checks passed
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