chore(agents): fix ca-test-infra-improver health comment spam
CI / lint (pull_request) Successful in 30s
CI / typecheck (pull_request) Successful in 52s
CI / security (pull_request) Successful in 1m3s
CI / quality (pull_request) Successful in 32s
CI / build (pull_request) Successful in 19s
CI / helm (pull_request) Successful in 23s
CI / unit_tests (pull_request) Failing after 6m41s
CI / docker (pull_request) Has been skipped
CI / e2e_tests (pull_request) Successful in 17m31s
CI / integration_tests (pull_request) Failing after 23m3s
CI / coverage (pull_request) Successful in 10m40s
CI / status-check (pull_request) Failing after 1s
CI / benchmark-publish (pull_request) Has been skipped
CI / benchmark-regression (pull_request) Successful in 57m34s

Approved proposal: #3385
Pattern: workflow_fix
Evidence: Agent posted 44 of 52 comments in 20 minutes, drowning out all
other agent signals. The cycle % 60 guard was ambiguous and ignored by the
model.
Fix: Replace fragile modulo guard with explicit timestamp-based rate
limiting (10-minute minimum between health posts). Add prominent CRITICAL
warning about rate limiting. Clarify that health posting runs in the outer
loop, not the inner monitoring loop.

ISSUES CLOSED: #3385
This commit is contained in:
2026-04-05 18:30:04 +00:00
committed by Forgejo
parent 1bd0c7999d
commit 304e922012
+17 -2
View File
@@ -133,6 +133,14 @@ If no spec context is provided, invoke `ca-ref-reader` once at startup.
### Pool Supervision Loop
**CRITICAL: Health Comment Rate Limiting.** Do NOT post health comments on
every monitoring iteration. Health comments MUST be posted **at most once
every 10 minutes**, enforced by a `last_health_post_time` timestamp. If
less than 10 minutes have elapsed since the last health comment, do NOT
post. The ONLY exception is a **significant state change** (worker
completed, all areas analyzed, new worker dispatched after a slot freed
up). Even state-change posts are limited to at most one per 60 seconds.
```
# Check if session state issue number was provided
if SESSION_STATE_ISSUE_NUMBER not provided:
@@ -157,6 +165,8 @@ analysis_areas = [
analyzed_areas = set()
findings_total = 0
cycle = 0
last_health_post_time = 0 # Timestamp of last health comment (epoch seconds)
HEALTH_INTERVAL_SECONDS = 600 # 10 minutes between health comments
# ── RESUME: Adopt existing worker sessions from previous run ─────
EXISTING_WORKERS = bash("curl -s ${SERVER}/session | python3 -c \"
@@ -233,8 +243,12 @@ LOOP:
NEW_SID = create session + prompt_async for next_area
active[next_area] = NEW_SID
# ── Post progress ────────────────────────────────────────────
if cycle % 60 == 0: # Every ~10 minutes with 10-second monitoring
# ── Post progress (RATE LIMITED — see rules above) ───────────
# IMPORTANT: This section runs ONCE per outer supervision cycle,
# NOT inside the inner "while active" monitoring loop above.
# Only post if at least HEALTH_INTERVAL_SECONDS have elapsed.
current_time = time.time() # or equivalent epoch seconds
if current_time - last_health_post_time >= HEALTH_INTERVAL_SECONDS:
post comment on session state issue:
"[HEALTH] ca-test-infra-improver | Iteration: <cycle> | Status: active\n" +
"- Type: pool-supervisor\n" +
@@ -246,6 +260,7 @@ LOOP:
"---\n" +
"**Automated by CleverAgents Bot**\n" +
"Supervisor: Test Infrastructure | Agent: ca-test-infra-improver"
last_health_post_time = current_time
```
---