Repository navigation
[ENG-22434] fix(heartbeat): background result sent with the message tool is lost in Boon Web chats - #344
Merged
Conversation
…in Boon Web chats When a background command exits in a chat, the exec-event wake now starts a heartbeat turn in that chat. If the agent sends the output with the message tool, Boon Web does not post it directly: it stages the send as an internal source reply, and the reply pipeline is expected to deliver it. On a normal inbound turn the dispatcher delivers every final payload, so the staged reply shows. The heartbeat runner instead sends a single payload, the last one with content. When the turn ends with any text after the message send (for example "Done."), the staged output is dropped and the chat shows only that text. A token-only final (HEARTBEAT_OK) or a duplicate final also dropped it, because those branches return before any send. Send the staged message-tool replies of a heartbeat turn on their own, right after the turn's reply is resolved and before the skip branches, to the run's own delivery target. Only replies staged for the run's session are sent, only from a chat session (not the heartbeat session or an isolated heartbeat run), only to a real channel target, and only when the channel shows heartbeat alerts. The send has no transcript mirror, because the message tool already wrote the text to the transcript. After staged replies went out, a token-only final is treated as an ack and is not posted as literal text, and the owned pending-final record is cleared. The duplicate-final check no longer drops a final that is itself a staged reply, so a repeated identical result still shows. Turns without staged replies, the normal inbound path, and channels that send message-tool replies directly (Slack, Microsoft Teams) are unchanged. Related: ENG-22434
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Turn on auto-fix | Re-trigger cubic
orswn
added a commit
that referenced
this pull request
Nov 24, 2026
Cuts the fork release carrying #344 (ENG-22434), merged to boon after the v2026.7.35-boon.4 tag. Without a tagged release the fix cannot be pinned in the fleet, so Boon Web chats on running hosts still lose a background command's result that the agent sent with the message tool. Version-only bump, same pattern as #343: upstream base stays 2026.7.35; fork increment moves boon.4 -> boon.5. Bumps root package.json/npm-shrinkwrap.json, packages/ai, all 142 bundled plugin manifests (pnpm plugins:sync, which also adds the matrix changelog entry), and every extension npm-shrinkwrap.json, version strings only. Adds the 2026.7.35-boon.5 CHANGELOG.md section. Refs: ENG-22434
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.
Related: ENG-22434 (Linear). Follow-up to #342.
What Problem This Solves
Fixes an issue where a user in a Boon Web chat who asked the agent to run a background command saw only "Done." (or nothing) when the command finished. The agent got its turn right after the exit (since #342), read the output and sent it with the
messagetool, but that message never reached the chat. A second background result in the same chat could disappear entirely.Seen on a production test org running
2026.7.35-boon.4: the completion turn started 0.8 s after the exit, sent the output with themessagetool, ended with "Done.", and the chat received only "Done.".Why This Change Was Made
Boon Web does not post a
messagesend to the current conversation itself. It stages it as an internal source reply, and the reply pipeline delivers it. On a normal inbound turn the dispatcher sends every final payload, so the staged reply shows. The heartbeat runner sends one payload, the last one with content. So a staged reply was lost whenever the turn ended with other text, aHEARTBEAT_OKack, or a final that matched the previous heartbeat text (duplicate suppression).Changes:
messagereplies, in order, to the run's own delivery target. Then the existing final-text path runs unchanged.showAlerts). Not on the heartbeat-response-tool path.HEARTBEAT_OK) is treated as an ack and skipped, instead of being relayed as the exec result.heartbeat: delivered staged source replies.Not changed: heartbeat turns without staged replies, the normal inbound reply path, and channels whose
messagetool sends directly (Slack, Microsoft Teams). Upstream retired this heartbeat runner, so there is no upstream change to port.Known limits, not changed here:
ok-token.User Impact
In a Boon Web chat, when the agent reports a background command's result with the
messagetool, the user now sees that result, followed by the agent's closing text if any. A second result in the same chat also shows. Slack, Microsoft Teams and turns without amessagesend behave as before.Evidence
Tests written first. The new behavior tests fail on
boonand pass with this change:src/infra/heartbeat-runner.source-reply-delivery.test.ts(new, 16 tests):[staged output, "Done."]sends the output, thenDone.. Onboon:expected [ 'Done.' ].[staged output, HEARTBEAT_OK]sends the output and no literal token. Onboon:expected [ 'HEARTBEAT_OK' ].Done.both deliver their output. Onboon:expected [ 'Done.' ].boon:expected ['same output'] to equal ['same output','same output'].mirror.target: none,showAlerts: false, an isolated run, a scheduled heartbeat in the heartbeat session, a channel that is not ready, and a suppressed staged send. Each sends nothing new, and each guard test fails when its gate is removed.src/auto-reply/heartbeat-reply-payload.source-replies.test.ts(new, 5 tests): selection order, exclusion of the final, other sessions, reasoning and failure notices skipped.Local runs (Node 22.23.5): all heartbeat suites (
src/infra/heartbeat-*.test.ts,src/auto-reply/heartbeat-reply-payload*.test.ts): 395 passed, existing tests unchanged.tsgocore and core test,oxlint,oxfmt --check,git diff --check: clean.pnpm build: ok.Local smoke (before vs after)
Local gateway with the fleet heartbeat and session settings (
heartbeat.every: "1h",session.dmScope: "per-channel-peer",messages.queue.mode: "collect", emptyHEARTBEAT.md), Boon Web chat through the same anychat plugin release as production, Claude Sonnet 5.5 on Bedrock, current fleet persona. Before =boonate654143e4c7(2026.7.35-boon.4). After = this branch. A heartbeat had run before each scenario.messagetool, then replies "Done."messageNo chat row in any after run contains
HEARTBEAT_OKorNO_REPLY. Each staged delivery logged{"count": 1, "channel": "anychat-boon-web"} heartbeat: delivered staged source replies.Not covered locally: Slack, Microsoft Teams and Google Chat delivery (no local channel; their
messagesends do not stage), a staged reply with media, and the out-of-turn reply in Boon Web still carries no suggested-reply chips (the heartbeat delivery path; not changed here).Summary by cubic
Fixes background command results being lost in Boon Web chats when the agent sent them with the
messagetool, with only "Done." or nothing appearing in the chat.Boon Web doesn't post
messagetool sends directly; it stages them as source replies that a later pipeline delivers. Normal inbound turns deliver these staged replies, but the heartbeat runner didn't, so a staged result was dropped whenever the turn ended with other text, aHEARTBEAT_OKack, or a repeated final.messagereplies on their own, in order, before the ack and duplicate-skip branches.HEARTBEAT_OK) is treated as an ack and not relayed as literal text.Known limits, unchanged here: staged payloads carry only text and media (no cards or suggested replies), staged media lacks the inbound turn's media access rules, and if the staged send succeeds but the final send fails, the completion event stays queued for a later turn.
Written for commit b2232ec. Summary will update on new commits.