fix(workspace): skip idle prompt when delegation results are pending (#381) #432
Merged
core-lead
merged 1 commits from 2026-05-11 09:30:47 +00:00
runtime/414-idle-loop-skip-pending-results-v3 into main
1 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
| c7afe30edd |
fix(workspace): skip idle prompt when delegation results are pending
Some checks failed
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 21s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 16s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 54s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 54s
sop-tier-check / tier-check (pull_request) Successful in 23s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 59s
E2E API Smoke Test / detect-changes (pull_request) Successful in 1m1s
audit-force-merge / audit (pull_request) Successful in 20s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 9s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 10s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 9s
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 2m40s
CI / Detect changes (pull_request) Failing after 11m44s
CI / Platform (Go) (pull_request) Has been cancelled
CI / Canvas (Next.js) (pull_request) Has been cancelled
CI / Shellcheck (E2E scripts) (pull_request) Has been cancelled
CI / Canvas Deploy Reminder (pull_request) Has been cancelled
CI / Python Lint & Test (pull_request) Has been cancelled
Issue #381: agent tick generators producing stale-repo state. Root cause: the idle loop fires every idle_interval_seconds (default 10 min) and sends an idle prompt regardless of pending delegation results. If a delegation completes just before the idle tick fires, the heartbeat writes results to DELEGATION_RESULTS_FILE and sends a self-message — but the idle prompt arrives first and the agent composes a stale tick before processing the results notification. Peers receive repeated identical asks. Fix: before sending the idle prompt, read DELEGATION_RESULTS_FILE. If it contains unconsumed results, skip this idle tick. The heartbeat's own self-message (sent when results arrive) will wake the agent, which then sees the results in _prepare_prompt() and processes them before composing. Companion to wsr PR (runtime-runtime mirror). Changes: - workspace/main.py: pending-results check in _run_idle_loop() (+25 lines) - workspace/tests/test_idle_loop_pending_check.py: 6-case unit test Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> |