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
{{ message }}
Repository navigation
Add replay-aware workflow logging to embedded PHP, the PHP SDK and Rust #227
Workflow code is replayed every time a run wakes up. In embedded mode, the engine replays history on each wake-up, so a log line in workflow code is written again for every completed step. A workflow with 50 steps logs its opening line 50 times.
Users then either get duplicate, misleading log lines, or write workflow logs through a side effect or activity just to avoid them.
Source-verified, not reproduced.
Acceptance criteria
Embedded PHP, the PHP SDK and the Rust SDK provide a workflow logger that writes only when code runs for the first time, not during replay. It routes through the host's normal logger and adds run identity.
Tests show one log line per step across a multi-step run, including after a worker restart and a cold replay.
The workflow constraints page and each SDK guide explain logging from workflow code. They cover the replay-aware logger, why ordinary loggers duplicate lines, and keeping log handlers non-blocking so they don't stall the worker.
General open-item pass, November 4. Owner: Workflow, sdk-php and sdk-rust; sdk-python as reference; General for coordination.
Next action: Map replay-aware logging source and add controls proving no duplicate replay emission while preserving new execution/error observations.
Action taken in this pass: Asked all relevant SDK/Core owners for implemented evidence or the next source slice; ordinary logging suppression must not be claimed as durable external-effect semantics.
General retains the cross-repository follow-through. Existing operator stops and exact source/release/production gates remain binding; the item stays open until its actual acceptance is evidenced.
Python reference audit (owner sdk-python): _ReplayLogger suppresses calls during committed replay; _ReplayLifetime and generator-lifecycle controls keep reconstruction/disposal quiet (tests). ctx.logger is the author-facing adapter over normal Python logging. These are shipped source boundaries, not a new published cold-restart run.
Two limits must remain explicit in the portable reference: the internal replay flag is not currently a public WorkflowContext.is_replaying accessor, and this adapter forwards to the host logger without itself guaranteeing attached run identity. General owns the portable public-state/identity contract; sdk-python owns the corresponding additive accessor/logger-context slice if required. durable-workflow-github-io owns the guide/constraint wording; PHP/Rust/workflow retain their logger implementations. Next proof must cover multi-step live/cold replay and non-blocking host logging against published artifacts. Advanced today: mapped the precise guard/lifetime source and recorded the identity/public-state gaps, so the central issue cannot be closed from a Python-only reference or source test.
Rust acceptance map / complete owner pass: Rust source owner sdk-rust; shared replay-boundary coordination General with sdk-python reference. Current4.12.0 uses host tracing for worker/client diagnostics but has no replay-aware workflow logger. I checked the public context and source surface; ordinary tracing is not a delivered replacement for this requirement.
Next action is a workflow-scoped logger using the host logger and immutable run identity, emitting only across new execution boundaries and suppressing already-replayed steps. Coordinate its replay-state boundary with the clock/interceptor work; I requested Python's accepted reference rather than guessing from wall time or total history length. Source acceptance must show one log per step across multiple activations, restart and cold replay, with nonblocking handlers and no command/history mutation. SDK/constraints guides and qualified publication remain separate completion gates. No runtime or new implementation is claimed by this inventory.
PHP owner sdk-php has confirmed that current WorkflowContext exposes neither a supported replay-aware logger nor public replay-state control. Host diagnostics/worker logging and the metrics recorder do not satisfy workflow-code log suppression.
Next PHP source slice: a host/PSR logger adapter driven by the replayer's committed-prefix versus fresh-execution boundary, carrying original run identity and suppressing committed replay/query observations. Tests must include multi-step, fresh worker/cold replay, repeat task attempt, exception and logger-failure behavior; source handling must preserve commands and deadlines. This follows the current P2 client/identity work rather than being treated as an external runtime dependency.
sdk-python owner: please return the exact current published logger boundary and its cold-replay controls. General: please confirm the portable claim remains suppression of replayed committed code, not durable exactly-once log delivery for an uncommitted/crashed attempt. Workflow owner owns embedded integration; Website owner owns the constraints/all-locale guidance, including non-blocking log handlers. These requests settle the shared semantics without claiming a PHP implementation, package or live acceptance.
General's portable logger contract uses the same live replay-state boundary as226. Route observations to the host logger with exact namespace/workflow/run identity; suppress committed-history replay, including cold replay and completed-step worker replacement, without letting log callbacks alter durable commands. Keep handlers bounded/non-blocking and logging failures from manufacturing task success or new history.
A log emitted in an uncommitted task region may repeat if the task crashes/retries; a replay-aware process logger is not an exactly-once durable outbox. Tests must separately prove one line for each committed step across restart/cold replay and expose the uncommitted crash window honestly. Do not close this accepted issue from a logger facade or source-only sample; the original cross-runtime tests, normally published behavior and guides remain required. Python is the current reference owner; Workflow/PHP/Rust prepare their owned source slices and automatic identity/replay-state controls. No new runtime cohort is admitted here.
Workflow owns the embedded replay-aware logger source; PHP/Rust SDKs own their wrappers and Python is the reference. Next is the precise consumed/new-execution boundary and normal host logger/run identity adapter, with multi-step/cold-replay/error controls. Existing ordinary logger calls and tracing lifecycle events do not satisfy one authored log per first execution.
Coordinate the replay flag with #226's worker context and #215's consumed-event clock; do not infer it from latest poll totals or an arbitrary history scan. Preserve original workflows and make delivery guarantees truthful: suppressing replay duplicates does not make logging exactly once across crashes or authorize durable external effects. I asked the SDK owners for their existing reference vectors; no producer, logger side-effect marker or runtime allocation is assigned here.
PHP follow-through: General's contract at6642366435 is received. The previous portable-semantics question is answered: suppress committed replay using a live authoritative cursor; do not promise exactly-once logs in the uncommitted crash/retry region. I inspected PHP's normalized-step cursor and completed-history handling as the candidate shared foundation for #226/#227. A new-run/partial-prefix/completed-history/cold-replacement/query test set must distinguish those regions without changing captured commands.
sdk-php owns the separate logger/accessor source after the current ready metrics slice. Automatic exact namespace/workflow/run identity must come from the bound worker context, and user log context must not override it. Bounded host-handler failures must not manufacture task success/history. Python owns the reference vectors and Workflow its embedded adapter. Published behavior, original cross-runtime tests and all-locale guidance remain before parent closure; no new runtime cohort is started.
Workflow: not started. An embedded replay-aware logger (first run only, host logger, run identity), after the replay-cursor contract it shares with the PHP SDK. Owner: workflow.
Replay-aware workflow logging is merged in embedded PHP and the PHP SDK. Rust already shipped it in 4.17.0. The embedded and PHP SDK changes are not released yet.
workflow (embedded)#1296, merged as 52461f7. The code was reviewed at ae5b0d1, and main was then merged in without conflicts.
$this->logger(?string $channel) returns a PSR-3 logger that writes through the Laravel logger. Each line carries workflow_instance_id, workflow_run_id, workflow_type and namespace.
$this->replayState() returns Replaying, Executing or Unavailable, and isReplaying() is the boolean form.
The executor records the committed step boundary for each task. Lines are written after the task's transaction commits.
If the workflow parks on a pending select() handle without recording a step, those lines are written by the task that moves past the park.
A live-continuation fallback doesn't repeat lines. Queries and update validators never log.
sdk-php#490, merged as 4e645e6 (reviewed head 1ec3ddc).
WorkflowContext::logger(), replayState() and isReplaying().
The final replay's lines go through the Worker's PSR-3 logger, and only after the Server accepts the workflow-task completion.
Superseded, speculative and declined, or refused passes write nothing.
Code parked on a pending child or handle logs once, in the task that moves past it.
Tests show one line per step:
Embedded: cold replays with a restart before every task, real worker processes, live fallback, one or two losing select() handles, rollback, and logger failure.
PHP SDK: replays by fresh Replayers, Worker restarts, a cold replay of the completed run, a two-child fan-out, and a failed task followed by an update task.
Both PRs passed independent review after fixes: four rounds for embedded and three for the PHP SDK.
Remaining:
Docs-site guides: durable-workflow.github.io#617, which covers the constraints page and the PHP guide in all 8 locales. Its version numbers need confirming at release.
Known gaps, non-blocking:
In the PHP SDK, cancel_selection_operation counts as progress, so a narrow select → cancel → await path can still repeat one line.
The embedded bridge runner never sets a boundary, so the logger is silent there.
Embedded workflows that already define logger(), replayState() or isReplaying() must rename them. The CHANGELOG says so.
Released: the replay-aware workflow logger ships in Workflow 2.42.0 (embedded $this->logger() / replayState()) and PHP SDK 3.32.0 (WorkflowContext::logger()). Rust shipped it earlier in 4.17.0. The guides are merged in durable-workflow.github.io#617 (all 7 locales). The acceptance is met, so I'm closing this.
Activity
rmcdaniel commentedon Nov 4, 2026
General open-item pass, November 4. Owner: Workflow, sdk-php and sdk-rust; sdk-python as reference; General for coordination.
Next action: Map replay-aware logging source and add controls proving no duplicate replay emission while preserving new execution/error observations.
Action taken in this pass: Asked all relevant SDK/Core owners for implemented evidence or the next source slice; ordinary logging suppression must not be claimed as durable external-effect semantics.
General retains the cross-repository follow-through. Existing operator stops and exact source/release/production gates remain binding; the item stays open until its actual acceptance is evidenced.
rmcdaniel commentedon Nov 4, 2026
Python reference audit (owner sdk-python):
_ReplayLoggersuppresses calls during committed replay;_ReplayLifetimeand generator-lifecycle controls keep reconstruction/disposal quiet (tests).ctx.loggeris the author-facing adapter over normal Python logging. These are shipped source boundaries, not a new published cold-restart run.Two limits must remain explicit in the portable reference: the internal replay flag is not currently a public
WorkflowContext.is_replayingaccessor, and this adapter forwards to the host logger without itself guaranteeing attached run identity. General owns the portable public-state/identity contract; sdk-python owns the corresponding additive accessor/logger-context slice if required. durable-workflow-github-io owns the guide/constraint wording; PHP/Rust/workflow retain their logger implementations. Next proof must cover multi-step live/cold replay and non-blocking host logging against published artifacts. Advanced today: mapped the precise guard/lifetime source and recorded the identity/public-state gaps, so the central issue cannot be closed from a Python-only reference or source test.rmcdaniel commentedon Nov 4, 2026
Rust acceptance map / complete owner pass: Rust source owner sdk-rust; shared replay-boundary coordination General with sdk-python reference. Current4.12.0 uses host tracing for worker/client diagnostics but has no replay-aware workflow logger. I checked the public context and source surface; ordinary tracing is not a delivered replacement for this requirement.
Next action is a workflow-scoped logger using the host logger and immutable run identity, emitting only across new execution boundaries and suppressing already-replayed steps. Coordinate its replay-state boundary with the clock/interceptor work; I requested Python's accepted reference rather than guessing from wall time or total history length. Source acceptance must show one log per step across multiple activations, restart and cold replay, with nonblocking handlers and no command/history mutation. SDK/constraints guides and qualified publication remain separate completion gates. No runtime or new implementation is claimed by this inventory.
rmcdaniel commentedon Nov 4, 2026
PHP owner sdk-php has confirmed that current WorkflowContext exposes neither a supported replay-aware logger nor public replay-state control. Host diagnostics/worker logging and the metrics recorder do not satisfy workflow-code log suppression.
Next PHP source slice: a host/PSR logger adapter driven by the replayer's committed-prefix versus fresh-execution boundary, carrying original run identity and suppressing committed replay/query observations. Tests must include multi-step, fresh worker/cold replay, repeat task attempt, exception and logger-failure behavior; source handling must preserve commands and deadlines. This follows the current P2 client/identity work rather than being treated as an external runtime dependency.
sdk-python owner: please return the exact current published logger boundary and its cold-replay controls. General: please confirm the portable claim remains suppression of replayed committed code, not durable exactly-once log delivery for an uncommitted/crashed attempt. Workflow owner owns embedded integration; Website owner owns the constraints/all-locale guidance, including non-blocking log handlers. These requests settle the shared semantics without claiming a PHP implementation, package or live acceptance.
rmcdaniel commentedon Nov 4, 2026
General's portable logger contract uses the same live replay-state boundary as226. Route observations to the host logger with exact namespace/workflow/run identity; suppress committed-history replay, including cold replay and completed-step worker replacement, without letting log callbacks alter durable commands. Keep handlers bounded/non-blocking and logging failures from manufacturing task success or new history.
A log emitted in an uncommitted task region may repeat if the task crashes/retries; a replay-aware process logger is not an exactly-once durable outbox. Tests must separately prove one line for each committed step across restart/cold replay and expose the uncommitted crash window honestly. Do not close this accepted issue from a logger facade or source-only sample; the original cross-runtime tests, normally published behavior and guides remain required. Python is the current reference owner; Workflow/PHP/Rust prepare their owned source slices and automatic identity/replay-state controls. No new runtime cohort is admitted here.
rmcdaniel commentedon Nov 4, 2026
Workflow owns the embedded replay-aware logger source; PHP/Rust SDKs own their wrappers and Python is the reference. Next is the precise consumed/new-execution boundary and normal host logger/run identity adapter, with multi-step/cold-replay/error controls. Existing ordinary logger calls and tracing lifecycle events do not satisfy one authored log per first execution.
Coordinate the replay flag with #226's worker context and #215's consumed-event clock; do not infer it from latest poll totals or an arbitrary history scan. Preserve original workflows and make delivery guarantees truthful: suppressing replay duplicates does not make logging exactly once across crashes or authorize durable external effects. I asked the SDK owners for their existing reference vectors; no producer, logger side-effect marker or runtime allocation is assigned here.
rmcdaniel commentedon Nov 4, 2026
PHP follow-through: General's contract at6642366435 is received. The previous portable-semantics question is answered: suppress committed replay using a live authoritative cursor; do not promise exactly-once logs in the uncommitted crash/retry region. I inspected PHP's normalized-step cursor and completed-history handling as the candidate shared foundation for #226/#227. A new-run/partial-prefix/completed-history/cold-replacement/query test set must distinguish those regions without changing captured commands.
sdk-php owns the separate logger/accessor source after the current ready metrics slice. Automatic exact namespace/workflow/run identity must come from the bound worker context, and user log context must not override it. Bounded host-handler failures must not manufacture task success/history. Python owns the reference vectors and Workflow its embedded adapter. Published behavior, original cross-runtime tests and all-locale guidance remain before parent closure; no new runtime cohort is started.
rmcdaniel commentedon Nov 11, 2026
Workflow: not started. An embedded replay-aware logger (first run only, host logger, run identity), after the replay-cursor contract it shares with the PHP SDK. Owner: workflow.
24 remaining items
Write workflow log lines after commit, once per committed step
Tag workflow log lines with durable progress and drop leftovers
Cancel parked workflow log lines by step, not by resume
Add a replay-aware workflow logger
Add the workflow logger test to the feature timing profiles
Add a replay corpus fixture for the workflow logger
Move the workflow logger entry under Unreleased
Write workflow log lines after commit, once per committed step
Cancel parked workflow log lines by step, not by resume
Let the cold rerun own the lines at a live fallback's call
Describe the committed-write logger semantics
Tighten the validator and logger guidance after review
rmcdaniel commentedon Nov 25, 2026
Replay-aware workflow logging is merged in embedded PHP and the PHP SDK. Rust already shipped it in 4.17.0. The embedded and PHP SDK changes are not released yet.
52461f7. The code was reviewed atae5b0d1, and main was then merged in without conflicts.$this->logger(?string $channel)returns a PSR-3 logger that writes through the Laravel logger. Each line carriesworkflow_instance_id,workflow_run_id,workflow_typeandnamespace.$this->replayState()returnsReplaying,ExecutingorUnavailable, andisReplaying()is the boolean form.select()handle without recording a step, those lines are written by the task that moves past the park.4e645e6(reviewed head1ec3ddc).WorkflowContext::logger(),replayState()andisReplaying().Tests show one line per step:
select()handles, rollback, and logger failure.Workerrestarts, a cold replay of the completed run, a two-child fan-out, and a failed task followed by an update task.Both PRs passed independent review after fixes: four rounds for embedded and three for the PHP SDK.
Remaining:
cancel_selection_operationcounts as progress, so a narrow select → cancel → await path can still repeat one line.logger(),replayState()orisReplaying()must rename them. The CHANGELOG says so.rmcdaniel commentedon Nov 26, 2026
Released: the replay-aware workflow logger ships in Workflow 2.42.0 (embedded
$this->logger()/replayState()) and PHP SDK 3.32.0 (WorkflowContext::logger()). Rust shipped it earlier in 4.17.0. The guides are merged in durable-workflow.github.io#617 (all 7 locales). The acceptance is met, so I'm closing this.