diff --git a/.opencode/agents/ca-test-infra-improver.md b/.opencode/agents/ca-test-infra-improver.md index 39bc0f139..985d43eb1 100644 --- a/.opencode/agents/ca-test-infra-improver.md +++ b/.opencode/agents/ca-test-infra-improver.md @@ -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: | 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 ``` ---