@@ -1459,12 +1459,10 @@ export class Worker {
14591459 // When processing workflows through runReplayHistories, Core may still send non-replay
14601460 // activations on the very last Workflow Task in some cases. Though Core is technically exact
14611461 // here, the fact that sinks marked with callDuringReplay = false may get called on a replay
1462- // worker is definitely a surprising behavior. For that reason, we extend the isReplaying flag in
1463- // this case to also include anything running under in a replay worker.
1464- const isReplaying = activation . isReplaying || this . isReplayWorker ;
1465-
1462+ // worker is definitely a surprising behavior. For that reason, processSinkCalls checks
1463+ // this.isReplayWorker to suppress all non-callDuringReplay sinks on replay workers.
14661464 const calls = await workflow . workflow . getAndResetSinkCalls ( ) ;
1467- await this . processSinkCalls ( calls , isReplaying , workflow . logAttributes ) ;
1465+ await this . processSinkCalls ( calls , workflow . logAttributes ) ;
14681466 }
14691467 this . logger . trace ( 'Completed activation' , workflow . logAttributes ) ;
14701468 }
@@ -1572,6 +1570,7 @@ export class Worker {
15721570 unsafe : {
15731571 now : ( ) => Date . now ( ) , // re-set in initRuntime
15741572 isReplaying : activation . isReplaying ,
1573+ isReplayingHistoryEvents : activation . isReplaying ,
15751574 } ,
15761575 priority : decodePriority ( priority ) ,
15771576 } ;
@@ -1597,11 +1596,7 @@ export class Worker {
15971596 * This function does not throw, it will log in case of missing sinks
15981597 * or failed sink function invocations.
15991598 */
1600- protected async processSinkCalls (
1601- externalCalls : SinkCall [ ] ,
1602- isReplaying : boolean ,
1603- logAttributes : Record < string , unknown >
1604- ) : Promise < void > {
1599+ protected async processSinkCalls ( externalCalls : SinkCall [ ] , logAttributes : Record < string , unknown > ) : Promise < void > {
16051600 const { sinks } = this . options ;
16061601
16071602 const filteredCalls = externalCalls
@@ -1619,8 +1614,15 @@ export class Worker {
16191614 } ) ;
16201615 return false ;
16211616 } )
1622- // If appropriate, reject calls to sink functions not configured with `callDuringReplay = true`
1623- . filter ( ( { sink } ) => sink ?. callDuringReplay || ! isReplaying ) ;
1617+ // If appropriate, reject calls to sink functions not configured with `callDuringReplay = true`.
1618+ // Use per-call isReplayingHistoryEvents (which is false during queries and update validators)
1619+ // rather than per-activation isReplaying, so that logging is permitted during live read-only operations.
1620+ // Replay workers still suppress all non-callDuringReplay sinks regardless.
1621+ . filter ( ( { call, sink } ) => {
1622+ if ( sink ?. callDuringReplay ) return true ;
1623+ if ( this . isReplayWorker ) return false ;
1624+ return ! call . workflowInfo . unsafe . isReplayingHistoryEvents ;
1625+ } ) ;
16241626
16251627 // Make a wrapper function, to make things easier afterward
16261628 await Promise . all (
0 commit comments