fix(cron): mirror synthesized text back to session transcript on direct delivery#11
Open
suboss87 wants to merge 51 commits into
Open
fix(cron): mirror synthesized text back to session transcript on direct delivery#11suboss87 wants to merge 51 commits into
suboss87 wants to merge 51 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes openclaw#74743
Problem
When a cron job targets a session via
--session session:<sessionId>, the agent turn runs inside that session and delivers its output to the configured channel. However, the delivered text is never written back to the session transcript. On the next turn the agent has no memory of what it last said -- effectively losing the conversation history for cron-driven sessions.Root cause
deliverViaDirectinsrc/cron/isolated-agent/delivery-dispatch.tscalleddeliverOutboundPayloadswithout themirrorparameter. Themirrorparam is what triggersappendAssistantMessageToSessionTranscriptinsrc/infra/outbound/deliver.ts(line 819). Without it, delivery succeeds but the session transcript is never updated.Fix
Pass
mirror: { sessionKey: params.agentSessionKey, agentId: params.agentId, text: synthesizedText }todeliverOutboundPayloadswhensynthesizedTextis non-empty. WhensynthesizedTextis empty no delivery occurs at all (thepayloadsForDelivery.length === 0guard returns early), somirroris correctly omitted in that case.Tests
Added two tests to
delivery-dispatch.double-announce.test.ts:passes mirror param with agentSessionKey and synthesizedText so transcript is updated-- verifiesdeliverOutboundPayloadsreceivesmirror: { sessionKey, agentId, text }with the correct valuesskips delivery entirely when synthesizedText is empty (no spurious transcript write)-- verifies that an emptysynthesizedTextresults in zerodeliverOutboundPayloadscalls (the early-return guard is hit first)All 13 tests in the file pass.
Generated by Claude Code