Fix heartbeat async exec delivery leaks#67273
Conversation
Greptile SummaryThis PR closes three exec-completion delivery leak paths in the heartbeat runner: the prompt is now always internal-only (ignoring Confidence Score: 5/5Safe to merge; changes are tightly scoped to exec-completion silencing with no behavioral change to regular heartbeat or cron paths. All findings are P2 style suggestions. The logic for the three new guards is consistent — since includeReasoning is already false for exec completions, reasoningPayloads is always empty, so shouldSkipMain short-circuits cleanly. The only nit is a dead deliverToUser argument at the call site. No files require special attention.
|
|
Closing this as duplicate or superseded after Codex automated review. Close as superseded. This PR proposes making all async exec completion delivery internal-only, but current main still intentionally preserves user-relayable exec completions, and the newer related PR #72253 is the active, narrower implementation candidate for the remaining benign completion/SIGTERM leak while preserving real failure delivery. Best possible solution: Close this PR as superseded and continue review on #72253 or an equivalent focused heartbeat patch that keeps benign structured exec completions internal while preserving user-visible delivery for real async command failures. What I checked:
So I’m closing this here and keeping the remaining discussion on the canonical linked item. Codex Review notes: model gpt-5.5, reasoning high; reviewed against 7c0fdae9b95b. |
PR-ready package: Fix heartbeat async exec delivery leaks
Suggested PR title
Fix heartbeat async exec delivery leaks
Suggested PR summary
This backports the heartbeat async-completion fix that was previously applied only as a live dist patch.
Problem
Even after exec-event prompts were switched to internal-only, async command completion could still leak into user-visible chat because the heartbeat delivery path continued to special-case exec completion.
Root cause
The remaining leak was in
src/infra/heartbeat-runner.ts, not just in prompt wording:execFallbackTextcould revive text already suppressed by heartbeat token strippingshouldSkipMain = normalized.shouldSkip && !normalized.hasMedia && !hasExecCompletionexcluded exec completion from the silent main-delivery pathcanAttemptHeartbeatOkand reasoning delivery were still allowed to flow outward for exec completion eventsFix
src/infra/heartbeat-events-filter.tsexecFallbackText)HEARTBEAT_OKdelivery for exec completionTests
Updated / added regression coverage in:
src/infra/heartbeat-events-filter.test.tssrc/infra/heartbeat-runner.returns-default-unset.test.tsRegression assertions now cover:
deliverToUserHEARTBEAT_OKdelivery for exec completionLocal validation already completed
corepack pnpm install --frozen-lockfilegit diff --checknode scripts/run-vitest.mjs run --config test/vitest/vitest.unit.config.ts src/infra/heartbeat-events-filter.test.ts src/infra/heartbeat-runner.returns-default-unset.test.ts0Local source branch
fix/heartbeat-async-exec-delivery-backportCommit
f83d4a15ddf2ca6c6d96c56f4baf27d1dc557c59Transfer artifacts
heartbeat-async-upstream-backport.patchheartbeat-async-upstream-backport-formatpatch.patchheartbeat-async-upstream-backport-result.mdCherry-pick instruction
Push / PR note
No external push was performed in this step. This package is prepared for manual push / PR creation once explicitly approved.