fix: ensure exec notifyOnExit wakes heartbeat as exec-event#41479
Conversation
Greptile SummaryThis PR fixes a bug where background exec process completion heartbeats were failing to bypass HEARTBEAT.md empty-guard checks, causing agent turns to not be triggered reliably after a background Root cause: The dynamic reason string The fix: Replaces the dynamic reason with the standardized
Confidence Score: 5/5
Last reviewed commit: d05a712 |
a0a1c2f to
c924cf6
Compare
|
Reproduced and validated this live in a Discord group-channel setup. What we observed before the fix:
After tracing the live runtime, the root cause matched this PR exactly:
We then applied the equivalent minimal local fix in our running install:
Result:
In our setup, heartbeat delivery back to the chat was already enabled, so the remaining blocker was specifically the wake-reason mismatch. So from downstream live validation: this PR matches the minimal fix that resolved the bug for us. Related broader cleanup / superset approach: #42394 |
7896cf1 to
2630905
Compare
…41479) Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…41479) Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…41479) Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
…41479) Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Summary
Describe the problem and fix in 2–5 bullets:
notifyOnExitrequests a heartbeat with reasonexec:<session-id>:exit. The heartbeat runner only bypasses the empty HEARTBEAT.md guard for reasonsexec-event,wake,hook:*,cron:*— soexec:<id>:exitis skipped and the agent never gets a turn for the system event.maybeNotifyOnExitnow requests the heartbeat with reasonexec-event(same as node exec events), so the bypass applies and the agent runs on background exec exit.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
Background exec exit now triggers an agent turn even when HEARTBEAT.md is empty (or comments-only). Previously the system event was queued but the heartbeat was skipped, so the agent did not run until the next user message.
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation: N/ARepro + Verification
Environment
tools.exec.notifyOnExit: true(default), empty or comments-only HEARTBEAT.mdSteps
Expected
Actual (before fix)
exec:<id>:exit; bypass list does not match; heartbeat skipped; event stays queued until next user message.Evidence
Attach at least one:
Existing
exec notifyOnExittests updated to expectreason: "exec-event"; they assert the wake is still scoped/unscoped by session key as before.Human Verification (required)
What you personally verified (not just CI), and how:
emitExecSystemEventuse ofexec-event;resolveHeartbeatReasonKindand bypass in heartbeat-runner already treatexec-eventas event-driven.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
tools.exec.notifyOnExit: falseto disable exec-exit notifications entirely.Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.