Skip to content

Commit 8fba7e8

Browse files
feat(agent-runner): wire isRunCurrent fence to live block reply path
Pass `() => replyOperation.isCurrent()` into createBlockReplyDeliveryHandler so the stale-output fence is now active in the real runtime, not just in tests. A block reply from a superseded run (after /stop or a new user message) is silently dropped before hitting the channel. This is the first site where the generation registry actually changes runtime behavior. All 1174 auto-reply tests continue to pass.
1 parent e031fdc commit 8fba7e8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎src/auto-reply/reply/agent-runner-execution.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ export async function runAgentTurnWithFallback(params: {
833833
// notice) and the onBlockReply field share the same instance. This
834834
// ensures replyToId threading (replyToMode=all|first) is applied to
835835
// compaction notices just like every other block reply.
836+
const replyOperation = params.replyOperation;
836837
const blockReplyHandler = params.opts?.onBlockReply
837838
? createBlockReplyDeliveryHandler({
838839
onBlockReply: params.opts.onBlockReply,
@@ -844,6 +845,10 @@ export async function runAgentTurnWithFallback(params: {
844845
blockStreamingEnabled: params.blockStreamingEnabled,
845846
blockReplyPipeline,
846847
directlySentBlockKeys,
848+
// Drop late block replies from a superseded run (user /stop or
849+
// new-message takeover). When the captured generation no longer
850+
// matches, this op is stale and its output must not land in chat.
851+
isRunCurrent: replyOperation ? () => replyOperation.isCurrent() : undefined,
847852
})
848853
: undefined;
849854
const onToolResult = params.opts?.onToolResult;

0 commit comments

Comments
 (0)