fix(issue-14): record every event on disk before the wire publish
Round-2 review of952657e(reviewer-grok-01): R1's disk-heartbeat evidence comes from events.log, but publish_event appended to it only after with_retry(_publish_once) returned - after the broker ACK or all of its retries. With the public broker at ~5 s per publish, an agent's heartbeat reached the disk after the grace window and the live job was closed as deadline_timeout (test_wrapper_idle_timeout_grace_accepts_disk_heartbeat failed 2/2 on952657ehere, as it did for the reviewer). - publish_event: new record_local_event appends the prepared payload to events.log right after prepare_event (validation and seq allocation first) and before the wire publish; record_outcome takes local_event_recorded=True so the line is not written twice, while the audit "published" entry and the status sync stay after the publish - DelegationService.publish_event: the same local-first order - wrapper comment and VERSIONS.md v4.4.2 item 6 now say the heartbeat is on disk before the publish; new-test count 21 - tests: the heartbeat is already in events.log when the publish starts (and is recorded once), and a publish failing on every retry leaves one local record with published=False in the audit; both fail on952657e. The wrapper disk-heartbeat test keeps the real publish_event path and now passes 3/3 at the same broker latency Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HCGpJXhSZasJLU38ksDghe
This commit is contained in:
1 parent
952657efb4
commit
ebe58f6be0
5 files changed
+109
-13
No files matched your search
@@ -621,13 +621,13 @@ _within_deadline() {
|
||||
}
|
||||
|
||||
# ISSUE-14: agent-agnostic liveness. publish_event appends every event to the
|
||||
# job's on-disk events.log right after its wire publish attempt, whether that
|
||||
# publish succeeded or not, so a `progress` heartbeat the subscriber never saw
|
||||
# (it had already idled out, or the broker dropped it) is still visible here -
|
||||
# late by at most its publish retries while the broker is failing. An agent
|
||||
# running its tests in a background shell looks idle to herdr and shows no
|
||||
# busy token, yet keeps heartbeating - this is the only evidence that covers
|
||||
# that case.
|
||||
# job's on-disk events.log BEFORE its wire publish (record_local_event), so a
|
||||
# `progress` heartbeat the subscriber never saw (it had already idled out, or
|
||||
# the broker dropped it) is visible here the moment it is sent - a slow or
|
||||
# failing broker no longer delays it by its publish retries. An agent running
|
||||
# its tests in a background shell looks idle to herdr and shows no busy
|
||||
# token, yet keeps heartbeating - this is the only evidence that covers that
|
||||
# case.
|
||||
_recent_disk_heartbeat() {
|
||||
local job_id="$1" window="$2" f="$REGISTRY_DIR/$job_id.events.log"
|
||||
[ -f "$f" ] || return 1
|
||||
|
||||
Reference in new issue
Block a user