fix(workspace): skip idle prompt when delegation results are pending (#381) #414

Closed
infra-runtime-be wants to merge 2 commits from runtime/381-idle-loop-pending-messages into main

2 Commits

Author SHA1 Message Date
62adeeea01 Merge remote-tracking branch 'origin/main' into runtime/381-idle-loop-pending-messages
Some checks failed
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 2s
sop-tier-check / tier-check (pull_request) Failing after 2s
audit-force-merge / audit (pull_request) Has been skipped
2026-05-11 06:57:00 +00:00
192e70dec8 fix(workspace): skip idle prompt when delegation results are pending
Some checks failed
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 22s
sop-tier-check / tier-check (pull_request) Failing after 25s
Issue #381: the idle loop fired every idle_interval_seconds (default 10 min)
and sent the idle prompt even when delegation results were pending. The
heartbeat sends a self-message to notify the agent when results arrive, but
the idle prompt could arrive first, causing the agent to compose a stale tick
before processing the pending delegation notification.

Fix: before sending the idle prompt, read _DELEGATION_RESULTS_FILE. If the
file exists and is non-empty, skip this idle tick and log why. The heartbeat
will notify the agent when it next runs and sees the pending results.

Added test_idle_loop_pending_check.py covering: no file, empty file,
whitespace-only, single result, multiple results, newline-only.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-11 06:38:28 +00:00