refactor!: migrate agents from session state to individual tracking issues
CI / benchmark-publish (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / e2e_tests (push) Has been cancelled
CI / integration_tests (push) Has been cancelled
CI / helm (push) Has been cancelled
CI / typecheck (push) Has been cancelled
CI / unit_tests (push) Has been cancelled
CI / quality (push) Has been cancelled
CI / security (push) Has been cancelled
CI / push-validation (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
CI / docker (push) Has been cancelled
CI / status-check (push) Has been cancelled
CI / coverage (push) Has been cancelled

BREAKING CHANGE: Migrate all CleverAgents from shared session state issue
system to individual tracking issues with 'Automation Tracking' labels

Changes:
- Replace SESSION_STATE_ISSUE_NUMBER with individual tracking issues
- Add automation tracking systems to 10 core agents
- Implement standardized agent prefixes (AUTO-UAT-POOL, AUTO-PROJ-OWN, etc.)
- Add cleanup protocols for one-issue-per-cycle management
- Remove session state dependencies from supervisor launch prompts
- Update health signaling to create individual tracking issues
- Preserve announcement issues while cleaning up cycle reports

Affected agents:
- agent-evolver.md: Added AUTO-EVLV tracking system
- bug-hunter.md: Updated tracking documentation
- epic-planner.md: Fixed remaining session state reference
- implementation-orchestrator.md: Updated health signaling
- product-builder.md: Major refactor of supervisor coordination
- project-owner.md: Added AUTO-PROJ-OWN tracking system
- spec-updater.md: Added AUTO-SPEC-UPD tracking system
- test-infra-improver.md: Added AUTO-TEST-INFRA tracking system
- uat-tester.md: Added AUTO-UAT-POOL tracking system

Benefits:
- Better isolation: no shared state conflicts between agents
- Cleaner tracking: one issue per agent per cycle
- Full traceability: each agent's work is independently tracked
- Systematic discovery: standardized labels enable monitoring

This migration follows the automation tracking specification in
.opencode/agents/shared/automation_tracking.md and maintains
compatibility with existing CleverAgents infrastructure.
This commit is contained in:
CleverAgents Build Agent
2026-04-08 23:57:16 +00:00
parent 06073bfcec
commit 0edc1bf13d
10 changed files with 1347 additions and 238 deletions
+206 -36
View File
@@ -89,6 +89,110 @@ You receive:
---
## Automation Tracking System
**Updated**: This agent creates individual tracking issues instead of posting comments to a session state issue.
### Tracking Issue Format
- **Health Reports**: `[AUTO-EVLV] Agent Evolution Report (Cycle N)`
- **Proposals**: `[AUTO-EVLV] Announce: Proposal <brief_description>`
- **Announcements**: `[AUTO-EVLV] Announce: <message summary>`
- **Labels**: "Automation Tracking" + any relevant priority labels
### Cleanup Protocol
- **ONE ISSUE PER CYCLE**: Delete previous cycle's tracking issue before creating new one
- **PRESERVE ANNOUNCEMENTS**: Don't delete announcement issues
### Agent Evolution Tracking Functions
```bash
# Find and delete previous agent evolver tracking issue
function cleanup_previous_evolver_tracking() {
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues&labels=Automation+Tracking" \
-H "Authorization: token $FORGEJO_PAT" | \
jq -r '.[] | select(.title | contains("[AUTO-EVLV] Agent Evolution Report")) | .number' | head -1)
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
echo "Cleaning up previous agent evolver tracking issue #$previous_issue"
# Close with final comment
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"body\": \"Agent evolution cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: Agent Evolution | Agent: agent-evolver\"}"
# Close the issue
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"state": "closed"}'
echo "✓ Previous agent evolver tracking issue #$previous_issue closed"
sleep 2
fi
}
# Create agent evolution tracking issue
function create_evolver_tracking_issue() {
local cycle="$1"
local title="[AUTO-EVLV] Agent Evolution Report (Cycle $cycle)"
local body="$2"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created agent evolver tracking issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
echo "✓ Applied 'Automation Tracking' label to issue #$issue_number"
return 0
else
echo "✗ Failed to create agent evolver tracking issue"
return 1
fi
}
# Create agent evolution announcement issue
function create_evolver_announcement_issue() {
local message="$1"
local priority="$2"
local body="$3"
local title="[AUTO-EVLV] Announce: $message"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created agent evolver announcement issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
return 0
else
echo "✗ Failed to create agent evolver announcement issue"
return 1
fi
}
```
## CRITICAL: Bash Sleep for Genuine Waiting
**You MUST use the Bash tool to sleep between analysis cycles.** Do NOT
@@ -115,16 +219,22 @@ LOOP:
cycle += 1
# ── Step 1: Gather performance data ──────────────────────────
# Read the session state issue for agent performance signals
# Read tracking issues from various agents for performance signals
session_issue = find issue titled "[Automated] Product Build Session State"
if not found:
# Session state issue not created yet — sleep and retry.
# Find tracking issues from all automation agents
tracking_issues = query Forgejo for all open issues with "Automation Tracking" label
if tracking_issues is empty:
# No tracking issues yet — sleep and retry.
# MUST use Bash tool:
bash("sleep 600", timeout=900000) # 10 min sleep, 15 min timeout
continue
comments = fetch all comments on session_issue (recent first)
# Collect comments and content from all tracking issues
all_tracking_data = []
for issue in tracking_issues:
comments = fetch all comments on issue
all_tracking_data.extend([issue.body] + [c.body for c in comments])
# Also gather data from:
# - PR comments (review outcomes, merge failures)
@@ -142,9 +252,9 @@ LOOP:
duplicate_work: [], # Cases where agents did redundant work
}
# Parse checkpoint comments for failure patterns
for comment in comments:
extract_performance_signals(comment, performance_data)
# Parse tracking data for failure patterns
for data in all_tracking_data:
extract_performance_signals(data, performance_data)
# ── Step 2: Identify systematic patterns ─────────────────────
patterns = []
@@ -360,36 +470,95 @@ LOOP:
existing_prs = query Forgejo for PRs from improvement/* branches
for pr in existing_prs:
if pr.state == "closed" and pr.merged:
post comment on session state issue:
"Agent improvement PR #<N> merged. Change to <agent>: <summary>
announcement_body = "# 🎆 Agent Improvement Merged
---
**Automated by CleverAgents Bot**
Supervisor: Agent Evolver | Agent: agent-evolver"
**PR**: #<N>
**Agent**: <agent>
**Summary**: <summary>
**Status**: Successfully merged
## Impact
This agent improvement has been applied to the system and should improve agent performance.
---
**Automated by CleverAgents Bot**
Supervisor: Agent Evolution | Agent: agent-evolver"
create_evolver_announcement_issue "PR #<N> Merged" "Medium" "$announcement_body"
elif pr.state == "closed" and not pr.merged:
rejected_changes.add(extract_pattern_signature(pr))
post comment on session state issue:
"Agent improvement PR #<N> rejected by human reviewer.
announcement_body = "# ⚠️ Agent Improvement Rejected
---
**Automated by CleverAgents Bot**
Supervisor: Agent Evolver | Agent: agent-evolver"
**PR**: #<N>
**Status**: Rejected by human reviewer
**Reason**: Closed without merging
# ── Step 7: Post progress ────────────────────────────────────
## Next Actions
This improvement pattern has been marked as rejected and will not be re-proposed.
---
**Automated by CleverAgents Bot**
Supervisor: Agent Evolution | Agent: agent-evolver"
create_evolver_announcement_issue "PR #<N> Rejected" "Low" "$announcement_body"
# ── Step 7: Post progress via individual tracking issue ──────────────
if cycle % 3 == 0:
post comment on session state issue:
"Agent evolver cycle <N>:
- Patterns analyzed: <N>
- Proposal issues created: <N>
- Proposals approved: <N>
- Proposals rejected: <N>
- Improvement PRs created: <N>
- PRs merged: <N>
- PRs rejected: <N>
next_report_time = date -d "+1.5 hours" -Iseconds
tracking_body = "# Agent Evolution Report — $(date +'%Y-%m-%d %H:%M:%S')
---
**Automated by CleverAgents Bot**
Supervisor: Agent Evolver | Agent: agent-evolver"
**Agent**: agent-evolver
**Cycle**: $cycle
**Reporting Interval**: 3 cycles (~90 minutes) (Next report expected: $next_report_time)
**Status**: active
## Summary
Agent evolution system analyzing patterns and proposing improvements with ${#pending_proposals[@]} proposals pending and ${#pending_prs[@]} PRs awaiting merge.
## Details
**Analysis Status**: Active - monitoring automation agent performance patterns
**Current Cycle**: $cycle
**Patterns Analyzed**: <N> patterns examined this cycle
**Pending Proposals**: ${#pending_proposals[@]} awaiting human approval
**Active PRs**: ${#pending_prs[@]} improvement PRs pending merge
### Improvement Statistics
| Metric | Count | Status |
|--------|-------|--------|
| Patterns Analyzed | <N> | This cycle |
| Proposal Issues Created | <N> | Total |
| Proposals Approved | <N> | Total |
| Proposals Rejected | <N> | Total |
| Improvement PRs Created | <N> | Total |
| PRs Merged | <N> | Total |
| PRs Rejected | <N> | Total |
## Health Indicators
- **Pattern Detection**: Active and monitoring automation tracking issues
- **Proposal Rate**: <N> new proposals this cycle
- **Approval Rate**: $(( approved_count * 100 / total_proposals ))% human approval rate
- **Implementation Rate**: $(( merged_count * 100 / total_prs ))% PR merge rate
- **System Impact**: <N> agent improvements deployed
## Next Actions
- Continue monitoring automation tracking issues for patterns
- Review pending proposals for human approval signals
- Monitor existing improvement PRs for merge status
- Next evolution analysis in ~90 minutes
---
**Automated by CleverAgents Bot**
Supervisor: Agent Evolution | Agent: agent-evolver"
cleanup_previous_evolver_tracking
create_evolver_tracking_issue $cycle "$tracking_body"
# Sleep before next cycle. MUST use Bash tool:
bash("sleep 1800", timeout=2400000) # 30 min sleep, 40 min timeout
@@ -470,11 +639,12 @@ No exceptions — every comment, every issue body, every PR description.
## Health Signaling
Every 3 cycles, post a brief health signal comment on the session state issue:
```
[HEALTH] agent-evolver cycle <N>: alive, patterns_analyzed: <N>,
proposals_pending: <len(pending_proposals)>, prs_pending: <len(pending_prs)>
```
Every 3 cycles, create individual tracking issues with comprehensive status:
- Pattern analysis statistics and discovery metrics
- Proposal workflow status (pending, approved, rejected)
- PR monitoring status (merged, rejected, awaiting review)
- Overall agent evolution system health indicators
- Cross-agent coordination status via automation tracking issues
## Context Self-Management
+175 -22
View File
@@ -90,6 +90,96 @@ Determine your mode based on the parameters you receive:
- **ONE ISSUE PER CYCLE**: Delete previous cycle's tracking issue before creating new one
- **PRESERVE ANNOUNCEMENTS**: Don't delete announcement issues
### Bug Hunter Tracking Functions
```bash
# Find and delete previous bug hunter pool tracking issue
function cleanup_previous_bug_hunter_tracking() {
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues&labels=Automation+Tracking" \
-H "Authorization: token $FORGEJO_PAT" | \
jq -r '.[] | select(.title | contains("[AUTO-BUG-POOL] Bug Detection Pool Status")) | .number' | head -1)
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
echo "Cleaning up previous bug hunter tracking issue #$previous_issue"
# Close with final comment
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"body\": \"Bug hunting cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: Bug Detection Pool | Agent: bug-hunter\"}"
# Close the issue
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"state": "closed"}'
echo "✓ Previous bug hunter tracking issue #$previous_issue closed"
sleep 2
fi
}
# Create bug detection pool tracking issue
function create_bug_hunter_tracking_issue() {
local cycle="$1"
local title="[AUTO-BUG-POOL] Bug Detection Pool Status (Cycle $cycle)"
local body="$2"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created bug hunter tracking issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
echo "✓ Applied 'Automation Tracking' label to issue #$issue_number"
return 0
else
echo "✗ Failed to create bug hunter tracking issue"
return 1
fi
}
# Create bug hunter announcement issue
function create_bug_hunter_announcement_issue() {
local message="$1"
local priority="$2"
local body="$3"
local title="[AUTO-BUG-POOL] Announce: $message"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created bug hunter announcement issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
return 0
else
echo "✗ Failed to create bug hunter announcement issue"
return 1
fi
}
```
---
### Setup
@@ -101,6 +191,7 @@ You receive:
- **Git full name / email** — for git identity
- **Forgejo username** — for API operations
- **Max workers (N)** — number of parallel scan workers to maintain
- **Cycle number** — Current cycle number for tracking issue naming
- **Spec context** (optional) — specification summary
If no spec context is provided, invoke `ref-reader` once at startup.
@@ -118,10 +209,7 @@ set timeout explicitly. You MUST NOT voluntarily exit — sleep and re-poll.
### Pool Supervision Loop
```
# Check if session state issue number was provided
if SESSION_STATE_ISSUE_NUMBER not provided:
error: "SESSION_STATE_ISSUE_NUMBER is required. This should be provided by product-builder."
ask user for the session state issue number
# Initialize tracking system - no session state issue required
N = max_workers
ref_summary = load via ref-reader
@@ -217,19 +305,63 @@ LOOP:
NEW_SID = create session + prompt_async for next_module
active[next_module] = NEW_SID
# ── Step 5: Post progress ────────────────────────────────────
# ── Step 5: Post progress via individual tracking issue ────────
if cycle % 60 == 0: # Every ~10 minutes with 10-second monitoring
post comment on session state issue:
"[HEALTH] bug-hunter | Iteration: <cycle> | Status: active\n" +
"- Type: pool-supervisor\n" +
"- Active workers: <len(active)> / <N>\n" +
"- Work completed: <len(scanned_modules)>/<len(all_modules)> modules scanned\n" +
"- Findings filed: <findings_total>\n" +
"- Last action: <brief description>\n" +
"- Next check: in 10 minutes\n\n" +
"---\n" +
"**Automated by CleverAgents Bot**\n" +
"Supervisor: Bug Hunting | Agent: bug-hunter"
next_health_time=$(date -d "+10 minutes" -Iseconds)
tracking_body="# Bug Detection Pool Status — $(date +'%Y-%m-%d %H:%M:%S')
**Agent**: bug-hunter
**Cycle**: $cycle
**Reporting Interval**: 10 minutes (Next report expected: $next_health_time)
**Status**: active
## Summary
Bug detection pool managing ${#active[@]} workers scanning ${#all_modules[@]} modules with $findings_total findings filed.
## Details
**Pool Status**: Active - scanning for potential bugs across codebase
**Active Workers**: ${#active[@]} / $N
**Progress**: ${#scanned_modules[@]}/${#all_modules[@]} modules scanned ($(( ${#scanned_modules[@]} * 100 / ${#all_modules[@]} ))%)
**Findings Filed**: $findings_total total findings
### Module Scanning Progress
| Module | Status | Worker | Findings | Duration |
|--------|--------|---------|----------|----------|
$(for module in "${!active[@]}"; do
local worker="${active[$module]:0:8}..."
local findings="${module_findings[$module]:-0}"
local duration="$(( ($(date +%s) - ${worker_start_times[$module]}) / 60 ))min"
echo "| $module | In Progress | $worker | $findings | $duration |"
done)
### Completed Modules
$(for module in "${scanned_modules[@]}" | head -10; do
echo "- $module (${module_findings[$module]:-0} findings)"
done)
## Health Indicators
- **Module Completion**: ${#scanned_modules[@]}/${#all_modules[@]} ($(( ${#scanned_modules[@]} * 100 / ${#all_modules[@]} ))%)
- **Worker Utilization**: ${#active[@]}/$N ($(( ${#active[@]} * 100 / N ))%)
- **Bug Detection Rate**: $findings_total findings across ${#scanned_modules[@]} modules
- **System Status**: Operational and actively scanning
## Next Actions
- Continue monitoring ${#active[@]} active scan workers
- Dispatch workers to remaining ${#unscanned_modules[@]} unscanned modules
- Process findings from completed scans
- Next health report in ~10 minutes
---
**Automated by CleverAgents Bot**
Supervisor: Bug Detection Pool | Agent: bug-hunter"
cleanup_previous_bug_hunter_tracking
create_bug_hunter_tracking_issue $cycle "$tracking_body"
# ── IMMEDIATELY loop back ────────────────────────────────────
```
@@ -303,12 +435,33 @@ You receive:
3. **Check existing bug issues** — query Forgejo for all open issues with
Type/Bug label. Build a knowledge base of known bugs to avoid duplicates.
4. **Post coordination comment** on the session state issue:
```
Bug hunter instance <INSTANCE_ID> starting.
Module focus: <module_focus>
Clone: $CLONE_DIR
```
4. **Post coordination via tracking issue**:
local coordination_body="# 🕵️ Bug Hunter Worker Started
**Instance ID**: $INSTANCE_ID
**Module Focus**: $module_focus
**Clone Directory**: $CLONE_DIR
**Timestamp**: $(date +'%Y-%m-%d %H:%M:%S')
## Scanning Plan
This worker instance will perform comprehensive bug detection analysis on the assigned module, focusing on:
- Error handling patterns
- Concurrency safety
- Security vulnerabilities
- Boundary condition handling
- Resource management issues
## Coordination
Other automation agents can track this worker's progress through this tracking issue and related bug reports.
---
**Automated by CleverAgents Bot**
Worker: Bug Detection | Agent: bug-hunter
**Worker Type**: Module Scanner"
create_bug_hunter_announcement_issue "Worker $INSTANCE_ID Started" "Medium" "$coordination_body"
### Analysis Process
+108 -3
View File
@@ -85,6 +85,110 @@ If these are not provided in your context, invoke `ref-reader` IMMEDIATELY to ob
**Consequence**: Creating new labels causes confusion and duplicates. Use ONLY the labels listed above.
## Automation Tracking System
**Updated**: This agent creates individual tracking issues instead of posting comments to a session state issue.
### Tracking Issue Format
- **Health Reports**: `[AUTO-EPIC] Epic Planning Health Report (Cycle N)`
- **Hierarchy Reports**: `[AUTO-EPIC] Hierarchy Compliance Report (Cycle N)`
- **Announcements**: `[AUTO-EPIC] Announce: <message summary>`
- **Labels**: "Automation Tracking" + any relevant priority labels
### Cleanup Protocol
- **ONE ISSUE PER CYCLE**: Delete previous cycle's tracking issue before creating new one
- **PRESERVE ANNOUNCEMENTS**: Don't delete announcement issues
### Epic Planning Tracking Functions
```bash
# Find and delete previous epic planner tracking issue
function cleanup_previous_epic_planner_tracking() {
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues&labels=Automation+Tracking" \
-H "Authorization: token $FORGEJO_PAT" | \
jq -r '.[] | select(.title | contains("[AUTO-EPIC] Epic Planning Health Report")) | .number' | head -1)
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
echo "Cleaning up previous epic planner tracking issue #$previous_issue"
# Close with final comment
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"body\": \"Epic planning cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: Epic Planning | Agent: epic-planner\"}"
# Close the issue
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"state": "closed"}'
echo "✓ Previous epic planner tracking issue #$previous_issue closed"
sleep 2
fi
}
# Create epic planning tracking issue
function create_epic_planner_tracking_issue() {
local cycle="$1"
local title="[AUTO-EPIC] Epic Planning Health Report (Cycle $cycle)"
local body="$2"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created epic planner tracking issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
echo "✓ Applied 'Automation Tracking' label to issue #$issue_number"
return 0
else
echo "✗ Failed to create epic planner tracking issue"
return 1
fi
}
# Create epic planning announcement issue
function create_epic_planner_announcement_issue() {
local message="$1"
local priority="$2"
local body="$3"
local title="[AUTO-EPIC] Announce: $message"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created epic planner announcement issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
return 0
else
echo "✗ Failed to create epic planner announcement issue"
return 1
fi
}
```
#### Creating Issues (CONTRIBUTING.md Section: Creating Issues)
- **Title Format**: Clear, imperative statements
- **Metadata Section**: Must include all required fields
@@ -745,8 +849,9 @@ def post_hierarchy_health_report(cycle, violations_fixed, legendaries_closed, ep
**Automated by CleverAgents Bot**
Supervisor: Epic Planning | Agent: epic-planner"""
# Post to session state issue
forgejo_create_issue_comment(owner, repo, SESSION_STATE_ISSUE_NUMBER, body=health_report)
# Create individual tracking issue for health report
cleanup_previous_epic_planner_tracking
create_epic_planner_tracking_issue $cycle "$health_report"
```
---
@@ -759,7 +864,7 @@ You receive on first invocation:
- **Forgejo username** — for API operations
- **Instance ID** — unique identifier for this supervisor instance
- **Max workers (N)** — not used (this supervisor doesn't dispatch workers)
- **SESSION_STATE_ISSUE_NUMBER** — for health reporting
- **Cycle number** — Current cycle number for tracking issue naming
If you need project rules, specification content, or contribution guidelines,
invoke `ref-reader` and `spec-reader`.
+79 -39
View File
@@ -1025,23 +1025,60 @@ LOOP FOREVER:
# ── STEP 1: Check PR work queue (EVERY cycle) ───────────────────
pr_work_queue = check_pr_work_needed()
# Report PR priority status if needed
# Report PR priority status via individual tracking issue if needed
if pr_work_queue and cycle % 5 == 0:
forgejo_create_issue_comment(
owner, repo, SESSION_STATE_ISSUE_NUMBER,
body=f"[STATUS] Implementation pool: PR-FIRST MODE\n" +
f"- {len(pr_work_queue)} PRs need work\n" +
f"- {len(active_pr_workers)} PR workers active\n" +
f"- {len(active_issue_workers)} issue workers active\n" +
f"- Available slots: {max_workers - len(active_pr_workers) - len(active_issue_workers)}\n\n" +
"No new issues will be started until all PRs have workers.\n\n" +
"PR Work Queue:\n" +
"\n".join([f" - PR #{pw['pr'].number}: {pw['work_type']} (priority: {pw['priority_score']})"
for pw in pr_work_queue[:5]]) +
"\n\n---\n" +
"**Automated by CleverAgents Bot**\n" +
"Supervisor: Implementation | Agent: implementation-orchestrator"
)
next_report_time = datetime.now() + timedelta(minutes=estimate_next_cycle_time() * 5)
tracking_body = f"""# Implementation Pool Status — PR-FIRST MODE — {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}
**Agent**: implementation-orchestrator
**Cycle**: {cycle}
**Reporting Interval**: Every 5 cycles (~variable timing) (Next report expected: {next_report_time.isoformat()})
**Status**: PR-FIRST MODE - Blocking issue work
## Summary
🚨 **CRITICAL**: {len(pr_work_queue)} PRs need workers - NO new issues until ALL PRs have workers assigned!
Pool managing {len(active_pr_workers)} PR fixes and {len(active_issue_workers)} issue implementations.
## Details
**Pool Status**: PR-FIRST MODE - All PR work takes absolute priority
**Active Workers**: {len(active_pr_workers)} PR fixes, {len(active_issue_workers)} issue implementations
**Available Slots**: {max_workers - len(active_pr_workers) - len(active_issue_workers)}
**Queue Status**: {len(pr_work_queue)} PRs pending worker assignment
### PR Work Queue ({len(pr_work_queue)} items)
| PR | Work Type | Priority Score | Issue |
|----|-----------|----------------|---------|
""" + "\n".join([f"| #{pw['pr'].number} | {pw['work_type']} | {pw['priority_score']} | #{pw.get('issue_number', 'unknown')} |"
for pw in pr_work_queue[:10]]) + f"""
### Policy Enforcement
⚠️ **NO NEW ISSUES** will be started until all PRs have active workers or are blocked by human feedback.
### Next Actions
- Continue dispatching workers to {len(pr_work_queue)} pending PRs
- Monitor {len(active_pr_workers)} active PR workers for completion
- Maintain absolute PR-first priority
- Next status update in ~5 cycles
## Health Indicators
- **PR Coverage**: {len(active_pr_workers)}/{len(pr_work_queue) + len(active_pr_workers)} PRs have workers
- **Worker Utilization**: {len(active_pr_workers + active_issue_workers)}/{max_workers} ({int((len(active_pr_workers) + len(active_issue_workers))/max_workers*100)}%)
- **Queue Health**: {len(pr_work_queue)} PRs waiting for workers
- **System Policy**: PR-FIRST MODE enforced
---
**Automated by CleverAgents Bot**
Supervisor: Implementation Pool | Agent: implementation-orchestrator"""
cleanup_previous_tracking()
create_tracking_issue(cycle, tracking_body)
# ── STEP 2: Dispatch workers to PRs first (ABSOLUTE PRIORITY) ────
slots_available = max_workers - len(active_pr_workers) - len(active_issue_workers)
@@ -1329,9 +1366,8 @@ LOOP FOREVER:
lines.append(f" - Issue #{issue_num}: session {session_id[:8]}...")
return "\n".join(lines) if lines else " (none)"
forgejo_create_issue_comment(
owner, repo, SESSION_STATE_ISSUE_NUMBER,
# REPLACED: Now creates individual tracking issue instead
# REPLACED: Now creates individual tracking issue instead
# (Implementation already updated above)
# Create comprehensive health tracking issue
next_health_report = datetime.now() + timedelta(minutes=estimate_next_cycle_time() * 10)
health_body = f"""# Implementation Pool Health Report — {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}
@@ -1520,27 +1556,31 @@ Supervisor: Implementation Pool | Agent: implementation-orchestrator"""
## Health Signaling
Every 10 monitoring iterations, post a standardized health signal:
Every 10 monitoring iterations, create an individual tracking issue with health status:
```
post comment on session state issue #SESSION_STATE_ISSUE_NUMBER:
"[HEALTH] issue-implementor | Iteration: <N> | Status: active\n" +
"- Type: pool-supervisor\n" +
"- Total active workers: <len(active_pr_workers) + len(active_issue_workers)> / <max_workers>\n" +
" - PR fix workers: <len(active_pr_workers)>\n" +
" - Issue implementation workers: <len(active_issue_workers)>\n" +
"- Work completed:\n" +
" - PRs merged: <count of completed PRs>\n" +
" - Issues completed: <len(completed_issues)>\n" +
"- Queues:\n" +
" - PRs needing work: <len(pr_work_queue)>\n" +
" - Issues queued: <len(queue)>\n" +
"- Failed retries: <sum(failed.values())>\n" +
"- Mode: <'PR-FIRST' if pr_work_queue else 'NORMAL'>\n" +
"- Last action: <brief description>\n" +
"- Next check: in 10 iterations\n\n" +
"---\n" +
"**Automated by CleverAgents Bot**\n" +
"Supervisor: Implementation | Agent: implementation-orchestrator"
# Create health tracking issue with comprehensive status
cleanup_previous_implementation_tracking
create_implementation_tracking_issue $cycle \
"[HEALTH] issue-implementor | Iteration: $N | Status: active
- Type: pool-supervisor
- Total active workers: $((${#active_pr_workers[@]} + ${#active_issue_workers[@]})) / $max_workers
- PR fix workers: ${#active_pr_workers[@]}
- Issue implementation workers: ${#active_issue_workers[@]}
- Work completed:
- PRs merged: $count_of_completed_prs
- Issues completed: ${#completed_issues[@]}
- Queues:
- PRs needing work: ${#pr_work_queue[@]}
- Issues queued: ${#queue[@]}
- Failed retries: $sum_of_failed_retries
- Mode: ${pr_work_queue:+'PR-FIRST'}${pr_work_queue:-'NORMAL'}
- Last action: $brief_description
- Next check: in 10 iterations
---
**Automated by CleverAgents Bot**
Supervisor: Implementation | Agent: implementation-orchestrator"
```
This standardized format allows the system-watchdog to detect zombie supervisors
and monitor overall system health from a single issue.
+169 -58
View File
@@ -42,6 +42,112 @@ permission:
# CleverAgents Product Builder
## Automation Tracking System
**Updated**: This agent creates individual tracking issues instead of using a session state issue.
### Tracking Issue Format
- **Health Reports**: `[AUTO-PROD-BLDR] Product Builder Status (Cycle N)`
- **Announcements**: `[AUTO-PROD-BLDR] Announce: <message summary>`
- **Labels**: "Automation Tracking" + any relevant priority labels
### Cleanup Protocol
- **ONE ISSUE PER CYCLE**: Delete previous cycle's tracking issue before creating new one
- **PRESERVE ANNOUNCEMENTS**: Don't delete announcement issues
### Product Builder Tracking Functions
```bash
# Find and delete previous product builder tracking issue
function cleanup_previous_product_builder_tracking() {
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues&labels=Automation+Tracking" \
-H "Authorization: token $FORGEJO_PAT" | \
jq -r '.[] | select(.title | contains("[AUTO-PROD-BLDR] Product Builder Status")) | .number' | head -1)
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
echo "Cleaning up previous product builder tracking issue #$previous_issue"
# Close with final comment
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"body\": \"Product builder cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: Product Builder | Agent: product-builder\"}"
# Close the issue
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"state": "closed"}'
echo "✓ Previous product builder tracking issue #$previous_issue closed"
sleep 2
fi
}
# Create product builder tracking issue
function create_product_builder_tracking_issue() {
local cycle="$1"
local title="[AUTO-PROD-BLDR] Product Builder Status (Cycle $cycle)"
local body="$2"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created product builder tracking issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
echo "✓ Applied 'Automation Tracking' label to issue #$issue_number"
# Store the issue number for this cycle
export CURRENT_TRACKING_ISSUE="$issue_number"
return 0
else
echo "✗ Failed to create product builder tracking issue"
return 1
fi
}
# Create product builder announcement issue
function create_product_builder_announcement_issue() {
local message="$1"
local priority="$2"
local body="$3"
local title="[AUTO-PROD-BLDR] Announce: $message"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created product builder announcement issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
return 0
else
echo "✗ Failed to create product builder announcement issue"
return 1
fi
}
```
# ⚠️ CRITICAL EXECUTION MODEL ⚠️
**YOUR ONLY JOBS:**
@@ -302,8 +408,10 @@ forgejo_add_issue_labels(
labels="Type/Task,State/In Progress,Priority/Medium,Type/Automation"
)
# This issue number is passed to EVERY supervisor
SESSION_STATE_ISSUE_NUMBER = session_state_issue.number
# Initialize tracking system for this session
cycle = 1
cleanup_previous_product_builder_tracking
create_product_builder_tracking_issue $cycle "Initial product builder session started"
```
### Step 5: Post initial session comment
@@ -643,7 +751,6 @@ rm -f /tmp/supervisor-sessions.env
launch_supervisor("implementation-orchestrator", "implementor-pool", "AUTO-IMP-SUP",
"You are the implementation pool supervisor.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Forgejo PAT: <PAT>.
Git: <name> <email>. Username: <username>. Password: <password>.
Max parallel workers: N_FULL.
@@ -653,7 +760,6 @@ launch_supervisor("implementation-orchestrator", "implementor-pool", "AUTO-IMP-S
launch_supervisor("continuous-pr-reviewer", "reviewer-pool", "AUTO-REV-SUP",
"You are the PR review pool supervisor.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Instance ID: reviewer-pool-1.
Forgejo PAT: <PAT>. Git: <name> <email>. Username: <username>. Password: <password>.
Max workers: N_HALF.
@@ -662,7 +768,6 @@ launch_supervisor("continuous-pr-reviewer", "reviewer-pool", "AUTO-REV-SUP",
launch_supervisor("uat-tester", "tester-pool", "AUTO-UAT-SUP",
"You are the UAT testing pool supervisor.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Instance ID: uat-pool-1.
Forgejo PAT: <PAT>. Git: <name> <email>. Username: <username>.
max_workers: N_QUARTER.
@@ -671,7 +776,6 @@ launch_supervisor("uat-tester", "tester-pool", "AUTO-UAT-SUP",
launch_supervisor("bug-hunter", "hunter-pool", "AUTO-BUG-SUP",
"You are the bug hunting pool supervisor.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Instance ID: hunter-pool-1.
Forgejo PAT: <PAT>. Git: <name> <email>. Username: <username>.
max_workers: N_QUARTER.
@@ -680,7 +784,6 @@ launch_supervisor("bug-hunter", "hunter-pool", "AUTO-BUG-SUP",
launch_supervisor("test-infra-improver", "test-infra-pool", "AUTO-INF-SUP",
"You are the test infrastructure improvement pool supervisor.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Instance ID: test-infra-pool-1.
Forgejo PAT: <PAT>. Git: <name> <email>. Username: <username>.
max_workers: N_QUARTER.
@@ -689,7 +792,6 @@ launch_supervisor("test-infra-improver", "test-infra-pool", "AUTO-INF-SUP",
launch_supervisor("architect", "architect", "AUTO-ARCH",
"You are the continuous architecture designer.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Instance ID: architect-1.
Forgejo PAT: <PAT>. Git: <name> <email>. Username: <username>.
Product vision: <vision>.
@@ -698,7 +800,6 @@ launch_supervisor("architect", "architect", "AUTO-ARCH",
launch_supervisor("epic-planner", "epic-planner", "AUTO-EPIC",
"You are the continuous epic planner.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Instance ID: epic-planner-1.
Forgejo PAT: <PAT>. Git: <name> <email>. Username: <username>.
When creating tracking issues, ALWAYS include these labels:
@@ -706,7 +807,6 @@ launch_supervisor("epic-planner", "epic-planner", "AUTO-EPIC",
launch_supervisor("human-liaison", "human-liaison", "AUTO-HUMAN",
"You are the human liaison.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Instance ID: human-liaison-1.
Forgejo PAT: <PAT>. Username: <username>.
CRITICAL: When feedback leads to conclusions that change ticket nature,
@@ -717,7 +817,6 @@ launch_supervisor("human-liaison", "human-liaison", "AUTO-HUMAN",
launch_supervisor("agent-evolver", "agent-evolver", "AUTO-EVLV",
"You are the agent evolver.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Instance ID: agent-evolver-1.
Forgejo PAT: <PAT>. Git: <name> <email>. Username: <username>.
When creating tracking issues, ALWAYS include these labels:
@@ -725,7 +824,6 @@ launch_supervisor("agent-evolver", "agent-evolver", "AUTO-EVLV",
launch_supervisor("architecture-guard", "arch-guard", "AUTO-GUARD",
"You are the architecture guard.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Forgejo PAT: <PAT>.
Git: <name> <email>.
When creating tracking issues, ALWAYS include these labels:
@@ -733,7 +831,6 @@ launch_supervisor("architecture-guard", "arch-guard", "AUTO-GUARD",
launch_supervisor("spec-updater", "spec-updater", "AUTO-SPEC",
"You are the spec updater.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Forgejo PAT: <PAT>.
Git: <name> <email>.
When creating tracking issues, ALWAYS include these labels:
@@ -741,7 +838,6 @@ launch_supervisor("spec-updater", "spec-updater", "AUTO-SPEC",
launch_supervisor("backlog-groomer", "backlog-groomer", "AUTO-BLOG",
"You are the backlog groomer.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Instance ID: groomer-1.
Forgejo PAT: <PAT>. Username: <username>.
When creating tracking issues, ALWAYS include these labels:
@@ -749,7 +845,6 @@ launch_supervisor("backlog-groomer", "backlog-groomer", "AUTO-BLOG",
launch_supervisor("docs-writer", "docs-writer", "AUTO-DOCS",
"You are the documentation writer.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Forgejo PAT: <PAT>.
Git: <name> <email>.
When creating tracking issues, ALWAYS include these labels:
@@ -757,7 +852,6 @@ launch_supervisor("docs-writer", "docs-writer", "AUTO-DOCS",
launch_supervisor("timeline-updater", "timeline-updater", "AUTO-TIME",
"You are the timeline updater.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Forgejo PAT: <PAT>.
Git: <name> <email>. Current day number: <N>.
When creating tracking issues, ALWAYS include these labels:
@@ -765,7 +859,6 @@ launch_supervisor("timeline-updater", "timeline-updater", "AUTO-TIME",
launch_supervisor("project-owner", "project-owner", "AUTO-OWNR",
"You are the project owner and triager.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Instance ID: project-owner-1.
Forgejo PAT: <PAT>. Git: <name> <email>. Username: <username>.
When creating tracking issues, ALWAYS include these labels:
@@ -773,7 +866,6 @@ launch_supervisor("project-owner", "project-owner", "AUTO-OWNR",
launch_supervisor("system-watchdog", "system-watchdog", "AUTO-WDOG",
"You are the system watchdog.
SESSION STATE ISSUE: #{SESSION_STATE_ISSUE_NUMBER}
Repo: <owner>/<repo>. Instance ID: watchdog-1.
Forgejo PAT: <PAT>. Username: <username>. Password: <password>.
OpenCode server: http://localhost:4096.
@@ -992,16 +1084,19 @@ MONITORING LOOP (runs until product is verified complete):
if no worker activity found in last 15 minutes:
# Pool supervisor might be zombied - running but not dispatching
forgejo_create_issue_comment(
owner, repo, SESSION_STATE_ISSUE_NUMBER,
body="[WARNING] Pool supervisor '${display_name}' appears inactive:\n" +
"- Session ${session_id} is running but no worker activity in 15+ minutes\n" +
"- Expected ${expected_workers} parallel workers\n" +
"- Re-launching supervisor to restore worker pool\n\n" +
"---\n" +
"**Automated by CleverAgents Bot**\n" +
"Supervisor: Product Builder | Agent: product-builder"
)
# Create announcement issue for supervisor warning
create_product_builder_announcement_issue \
"Supervisor ${display_name} appears inactive" \
"Priority/High" \
"[WARNING] Pool supervisor '${display_name}' appears inactive:
- Session ${session_id} is running but no worker activity in 15+ minutes
- Expected ${expected_workers} parallel workers
- Re-launching supervisor to restore worker pool
---
**Automated by CleverAgents Bot**
Supervisor: Product Builder | Agent: product-builder"
# Re-launch the zombie supervisor
metadata = SUPERVISOR_METADATA[display_name]
launch_supervisor(metadata["agent"], display_name, metadata["tag"], metadata["prompt"])
@@ -1010,10 +1105,12 @@ MONITORING LOOP (runs until product is verified complete):
# ── Check system watchdog alerts (every 3 heartbeats) ────────
if heartbeat_count % 3 == 0:
# Query the session state issue for recent watchdog alerts
WATCHDOG_COMMENTS = forgejo_list_issue_comments(
owner, repo, SESSION_STATE_ISSUE_NUMBER,
since=(3 minutes ago) # Check comments from last 3 minutes
)
# Check for system watchdog alerts in recent tracking issues
WATCHDOG_COMMENTS = bash("curl -s 'https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&labels=Automation+Tracking' -H 'Authorization: token $FORGEJO_PAT' | jq -r '.[] | select(.title | contains(\"[AUTO-SYS-WATCH]\")) | .number'", timeout=30000)
# Get recent comments from watchdog tracking issues
for issue_num in WATCHDOG_COMMENTS:
comments = forgejo_list_issue_comments(owner, repo, issue_num, since=(3 minutes ago))
# Process watchdog alerts from comments
for comment in WATCHDOG_COMMENTS:
if "[WATCHDOG ALERT]" in comment.body or "[SYSTEM ALERT]" in comment.body:
@@ -1024,15 +1121,18 @@ MONITORING LOOP (runs until product is verified complete):
if "forbidden API flag" in alert_body or "force_merge" in alert_body:
# Critical: An agent is violating quality gates
agent_name = extract agent name from alert
forgejo_create_issue_comment(
owner, repo, SESSION_STATE_ISSUE_NUMBER,
body="[CRITICAL] Responding to watchdog alert about ${agent_name}:\n" +
"- Detected quality gate violation\n" +
"- Re-launching supervisor with strict enforcement reminder\n\n" +
"---\n" +
"**Automated by CleverAgents Bot**\n" +
"Supervisor: Product Builder | Agent: product-builder"
)
# Create critical announcement issue for watchdog response
create_product_builder_announcement_issue \
"Critical: Responding to watchdog alert about ${agent_name}" \
"Priority/Critical" \
"[CRITICAL] Responding to watchdog alert about ${agent_name}:
- Detected quality gate violation
- Re-launching supervisor with strict enforcement reminder
---
**Automated by CleverAgents Bot**
Supervisor: Product Builder | Agent: product-builder"
# Re-launch the offending supervisor
elif "stuck in error loop" in alert_body:
@@ -1085,10 +1185,15 @@ MONITORING LOOP (runs until product is verified complete):
# Get worker counts from each pool supervisor's recent health signals
try:
recent_comments = forgejo_list_issue_comments(
owner, repo, SESSION_STATE_ISSUE_NUMBER,
limit=50, since=(60 minutes ago)
)
# Get recent comments from current tracking issue to check convergence
if [[ -n "$CURRENT_TRACKING_ISSUE" ]]; then
recent_comments = forgejo_list_issue_comments(
owner, repo, CURRENT_TRACKING_ISSUE,
limit=50, since=(60 minutes ago)
)
else
recent_comments = []
fi
for comment in recent_comments:
if "[HEALTH]" in comment.body:
@@ -1127,19 +1232,25 @@ MONITORING LOOP (runs until product is verified complete):
worker_summary += f" - Bug hunter pool: check logs (N_QUARTER={N_QUARTER} max)\n"
worker_summary += f" - Test infra pool: check logs (N_QUARTER={N_QUARTER} max)\n"
forgejo_create_issue_comment(
owner, repo, SESSION_STATE_ISSUE_NUMBER,
body=f"[HEARTBEAT] Product Builder #{heartbeat_count}:\n" +
f"- Supervisors relaunched: {supervisors_relaunched}\n" +
f"- Open issues: {len(open_issues) if 'open_issues' in locals() else 'unknown'}\n" +
f"- Open PRs: {len(open_prs) if 'open_prs' in locals() else 'unknown'}\n" +
f"- All 16 supervisors monitored: YES\n\n" +
worker_summary + "\n" +
f"Target parallelism: N={N} (Full={N_FULL}, Half={N_HALF}, Quarter={N_QUARTER})\n\n" +
"---\n" +
"**Automated by CleverAgents Bot**\n" +
"Supervisor: Product Builder | Agent: product-builder"
)
# Update current tracking issue with heartbeat every 10 cycles
if [[ $((heartbeat_count % 10)) == 0 ]] && [[ -n "$CURRENT_TRACKING_ISSUE" ]]; then
cleanup_previous_product_builder_tracking
create_product_builder_tracking_issue $((cycle + heartbeat_count)) \
"[HEARTBEAT] Product Builder #${heartbeat_count}:
- Supervisors relaunched: ${supervisors_relaunched}
- Open issues: ${len(open_issues) if 'open_issues' in locals() else 'unknown'}
- Open PRs: ${len(open_prs) if 'open_prs' in locals() else 'unknown'}
- All 16 supervisors monitored: YES
${worker_summary}
Target parallelism: N=${N} (Full=${N_FULL}, Half=${N_HALF}, Quarter=${N_QUARTER})
---
**Automated by CleverAgents Bot**
Supervisor: Product Builder | Agent: product-builder"
fi
# ── IMMEDIATELY loop back ────────────────────────────────────
# No extra delays. Sleep at the top of the next iteration.
+137 -14
View File
@@ -45,6 +45,109 @@ would make, based on the specification, milestone goals, and project state.
every 5 minutes for new work. You use `bash sleep` for genuine blocking
waits.
## Automation Tracking System
**Updated**: This agent creates individual tracking issues instead of posting comments to a session state issue.
### Tracking Issue Format
- **Health Reports**: `[AUTO-PROJ-OWN] Project Owner Report (Cycle N)`
- **Announcements**: `[AUTO-PROJ-OWN] Announce: <message summary>`
- **Labels**: "Automation Tracking" + any relevant priority labels
### Cleanup Protocol
- **ONE ISSUE PER CYCLE**: Delete previous cycle's tracking issue before creating new one
- **PRESERVE ANNOUNCEMENTS**: Don't delete announcement issues
### Project Owner Tracking Functions
```bash
# Find and delete previous project owner tracking issue
function cleanup_previous_project_owner_tracking() {
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues&labels=Automation+Tracking" \
-H "Authorization: token $FORGEJO_PAT" | \
jq -r '.[] | select(.title | contains("[AUTO-PROJ-OWN] Project Owner Report")) | .number' | head -1)
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
echo "Cleaning up previous project owner tracking issue #$previous_issue"
# Close with final comment
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"body\": \"Project owner cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: Project Owner | Agent: project-owner\"}"
# Close the issue
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"state": "closed"}'
echo "✓ Previous project owner tracking issue #$previous_issue closed"
sleep 2
fi
}
# Create project owner tracking issue
function create_project_owner_tracking_issue() {
local cycle="$1"
local title="[AUTO-PROJ-OWN] Project Owner Report (Cycle $cycle)"
local body="$2"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created project owner tracking issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
echo "✓ Applied 'Automation Tracking' label to issue #$issue_number"
return 0
else
echo "✗ Failed to create project owner tracking issue"
return 1
fi
}
# Create project owner announcement issue
function create_project_owner_announcement_issue() {
local message="$1"
local priority="$2"
local body="$3"
local title="[AUTO-PROJ-OWN] Announce: $message"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created project owner announcement issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
return 0
else
echo "✗ Failed to create project owner announcement issue"
return 1
fi
}
```
---
## CRITICAL: Label Management Protocol
@@ -637,20 +740,40 @@ No exceptions — every comment, every issue body, every PR description.
## Health Signaling
Every 5 cycles, post a standardized health signal on the session state issue:
```
forgejo_create_issue_comment(
owner, repo, SESSION_STATE_ISSUE_NUMBER,
body="[HEALTH] project-owner | Iteration: <cycle> | Status: active\n" +
"- Type: singleton\n" +
"- Active workers: N/A\n" +
"- Work completed: triaged <triaged_count> issues, assigned MoSCoW to <moscow_assigned> issues\n" +
"- Last action: <brief description>\n" +
"- Next check: in 300 seconds\n\n" +
"---\n" +
"**Automated by CleverAgents Bot**\n" +
"Supervisor: Project Owner | Agent: project-owner"
)
Every 5 cycles, create an individual tracking issue with project status:
```bash
# Every 5th cycle, post health update
if [[ $((cycle % 5)) == 0 ]]; then
cleanup_previous_project_owner_tracking
tracking_body="
[HEALTH] project-owner | Iteration: $cycle | Status: active
**Progress Summary:**
- Type: singleton
- Active workers: N/A
- Work completed: triaged $triaged_count issues, assigned MoSCoW to $moscow_assigned issues
- Last action: $brief_description
- Next check: in 300 seconds
**Triage Statistics:**
- Issues triaged this cycle: $cycle_triaged
- MoSCoW labels assigned: $cycle_moscow
- Developer assignments made: $cycle_assignments
- Priority adjustments: $cycle_priority_changes
**Strategic Health:**
- Active milestones monitored: $active_milestones_count
- Critical issues unassigned: $critical_unassigned_count
- Pending developer questions: $pending_questions_count
---
**Automated by CleverAgents Bot**
Supervisor: Project Owner | Agent: project-owner
"
create_project_owner_tracking_issue $cycle "$tracking_body"
fi
```
## Context Self-Management
@@ -139,9 +139,8 @@ function create_bug_hunter_announcement_issue() {
**Remove this code:**
```
# Check if session state issue number was provided
if SESSION_STATE_ISSUE_NUMBER not provided:
error: "SESSION_STATE_ISSUE_NUMBER is required. This should be provided by product-builder."
ask user for the session state issue number
# Now uses individual tracking issues instead of session state issue
# No SESSION_STATE_ISSUE_NUMBER parameter needed
```
**Replace with:**
+161 -18
View File
@@ -44,6 +44,110 @@ permission:
# CleverAgents Specification Updater
## Automation Tracking System
**Updated**: This agent creates individual tracking issues instead of posting comments to a session state issue.
### Tracking Issue Format
- **Health Reports**: `[AUTO-SPEC] Specification Update Report (Cycle N)`
- **Proposals**: `[AUTO-SPEC] Announce: Proposal <brief_description>`
- **Announcements**: `[AUTO-SPEC] Announce: <message summary>`
- **Labels**: "Automation Tracking" + any relevant priority labels
### Cleanup Protocol
- **ONE ISSUE PER CYCLE**: Delete previous cycle's tracking issue before creating new one
- **PRESERVE ANNOUNCEMENTS**: Don't delete announcement issues
### Spec Update Tracking Functions
```bash
# Find and delete previous spec updater tracking issue
function cleanup_previous_spec_tracking() {
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues&labels=Automation+Tracking" \
-H "Authorization: token $FORGEJO_PAT" | \
jq -r '.[] | select(.title | contains("[AUTO-SPEC] Specification Update Report")) | .number' | head -1)
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
echo "Cleaning up previous spec updater tracking issue #$previous_issue"
# Close with final comment
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"body\": \"Specification update cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: Specification Updates | Agent: spec-updater\"}"
# Close the issue
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"state": "closed"}'
echo "✓ Previous spec updater tracking issue #$previous_issue closed"
sleep 2
fi
}
# Create spec update tracking issue
function create_spec_tracking_issue() {
local cycle="$1"
local title="[AUTO-SPEC] Specification Update Report (Cycle $cycle)"
local body="$2"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created spec updater tracking issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
echo "✓ Applied 'Automation Tracking' label to issue #$issue_number"
return 0
else
echo "✗ Failed to create spec updater tracking issue"
return 1
fi
}
# Create spec update announcement issue
function create_spec_announcement_issue() {
local message="$1"
local priority="$2"
local body="$3"
local title="[AUTO-SPEC] Announce: $message"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created spec updater announcement issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
return 0
else
echo "✗ Failed to create spec updater announcement issue"
return 1
fi
}
```
## Clone Isolation Protocol
**CRITICAL: You MUST work in your own isolated clone. NEVER operate in /app.**
@@ -245,24 +349,39 @@ reverting deliberate decisions.
and reference to the approved proposal issue (`Closes #<N>`).
5. Add the label **`needs feedback`** to the PR.
6. **Do NOT merge this PR.** A human must review and merge it.
7. Post a comment on the session state issue:
```
Spec update proposal #<N> approved. PR created: #<PR_N>
Label: needs feedback (awaiting human review before merge)
7. Create an announcement issue:
```bash
announcement_body="# 📝 Specification Proposal Approved
**Proposal Issue**: #<N>
**PR Created**: #<PR_N>
**Status**: Awaiting human review
**Priority**: Needs feedback
## Summary
Spec update proposal has been approved and a PR has been created for human review before merge.
---
**Automated by CleverAgents Bot**
Supervisor: Specification Updates | Agent: spec-updater"
create_spec_announcement_issue "Proposal #<N> Approved" "Medium" "$announcement_body"
```
When a proposal is rejected (issue closed without approval):
- Record to avoid re-proposing the same change.
- Post a note on the session state issue.
- Create a rejection announcement issue.
8. **Keep spec PRs up to date:** If master has advanced since a spec PR
was created, rebase the spec branch onto master, force-push, and ensure
the PR is still mergeable. Retry indefinitely with reclone fallback.
9. **Post a Forgejo comment** — on the session state issue, post a summary of:
9. **Create tracking issue** — create individual tracking issue with summary of:
- Spec proposals created (with issue numbers)
- Proposals approved and PRs created
- Proposals rejected
- Overall specification alignment status
- Issues created for incorrect deviations
- Whether a monolithic→split restructure was proposed
@@ -323,13 +442,36 @@ function run_proactive_spec_scan():
# Create a proposal issue (same as Step 6a in main process)
create_proposal_issue(discrepancy)
# Step 4: Track metrics
post comment on session state issue:
"[HEALTH] spec-updater proactive scan complete:
- Modules scanned: <N>
- Discrepancies found: <N>
- Proposals created: <N>
- Already pending: <N>"
# Step 4: Track metrics via tracking issue
tracking_body="# Specification Proactive Scan Complete — $(date +'%Y-%m-%d %H:%M:%S')
**Agent**: spec-updater
**Scan Type**: Proactive
**Status**: Complete
## Summary
Proactive specification alignment scan completed with <N> modules examined and <N> discrepancies identified.
## Details
**Modules Scanned**: <N>
**Discrepancies Found**: <N>
**Proposals Created**: <N>
**Already Pending**: <N>
## Health Indicators
- **Specification Alignment**: $(( (modules_scanned - discrepancies_found) * 100 / modules_scanned ))% aligned
- **Discovery Rate**: <N> new discrepancies identified
- **Action Rate**: <N> proposals created for remediation
---
**Automated by CleverAgents Bot**
Supervisor: Specification Updates | Agent: spec-updater"
cleanup_previous_spec_tracking
create_spec_tracking_issue $cycle "$tracking_body"
```
**You MUST generate at least one proposal issue per scan cycle if ANY
@@ -340,11 +482,12 @@ even deeper module-by-module comparison and report findings.
## Health Signaling
Every 5 cycles, post a brief health signal comment on the session state issue:
```
[HEALTH] spec-updater cycle <N>: alive, proposals_pending: <N>,
proposals_created_total: <N>, last_scan: <type>
```
Every 5 cycles, create individual tracking issues with comprehensive status:
- Specification alignment analysis and metrics
- Proposal workflow status (pending, approved, rejected)
- PR monitoring status for spec updates
- Overall specification evolution health indicators
- Cross-implementation consistency checks
## Context Self-Management
+161 -16
View File
@@ -115,18 +115,122 @@ set timeout explicitly. You MUST NOT voluntarily exit — sleep and re-poll.
---
## Automation Tracking System
**Updated**: This agent creates individual tracking issues instead of posting comments to a session state issue.
### Tracking Issue Format
- **Health Reports**: `[AUTO-INF-POOL] Infrastructure Analysis Report (Cycle N)`
- **Worker Reports**: `[AUTO-INF-POOL] Announce: Worker <focus_area> Complete`
- **Announcements**: `[AUTO-INF-POOL] Announce: <message summary>`
- **Labels**: "Automation Tracking" + any relevant priority labels
### Cleanup Protocol
- **ONE ISSUE PER CYCLE**: Delete previous cycle's tracking issue before creating new one
- **PRESERVE ANNOUNCEMENTS**: Don't delete announcement issues
### Test Infrastructure Tracking Functions
```bash
# Find and delete previous test infra tracking issue
function cleanup_previous_infra_tracking() {
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues&labels=Automation+Tracking" \
-H "Authorization: token $FORGEJO_PAT" | \
jq -r '.[] | select(.title | contains("[AUTO-INF-POOL] Infrastructure Analysis Report")) | .number' | head -1)
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
echo "Cleaning up previous test infra tracking issue #$previous_issue"
# Close with final comment
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"body\": \"Test infrastructure analysis cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: Test Infrastructure Analysis | Agent: test-infra-improver\"}"
# Close the issue
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"state": "closed"}'
echo "✓ Previous test infra tracking issue #$previous_issue closed"
sleep 2
fi
}
# Create test infra tracking issue
function create_infra_tracking_issue() {
local cycle="$1"
local title="[AUTO-INF-POOL] Infrastructure Analysis Report (Cycle $cycle)"
local body="$2"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created test infra tracking issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
echo "✓ Applied 'Automation Tracking' label to issue #$issue_number"
return 0
else
echo "✗ Failed to create test infra tracking issue"
return 1
fi
}
# Create test infra announcement issue
function create_infra_announcement_issue() {
local message="$1"
local priority="$2"
local body="$3"
local title="[AUTO-INF-POOL] Announce: $message"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created test infra announcement issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
return 0
else
echo "✗ Failed to create test infra announcement issue"
return 1
fi
}
```
## Pool Supervisor Mode
### Setup
You receive:
- **SESSION STATE ISSUE** — Issue number for all health signals and status updates (REQUIRED)
- **Repo owner/name** — for Forgejo API calls
- **Instance ID** — unique identifier
- **Forgejo PAT** — for HTTPS git auth and API access
- **Git full name / email** — for git identity
- **Forgejo username** — for API operations
- **Max workers (N)** — number of parallel analysis workers
- **Cycle number** — Current cycle number for tracking issue naming
- **Spec context** (optional) — specification summary
If no spec context is provided, invoke `ref-reader` once at startup.
@@ -134,10 +238,7 @@ If no spec context is provided, invoke `ref-reader` once at startup.
### Pool Supervision Loop
```
# Check if session state issue number was provided
if SESSION_STATE_ISSUE_NUMBER not provided:
error: "SESSION_STATE_ISSUE_NUMBER is required. This should be provided by product-builder."
ask user for the session state issue number
# Initialize tracking system - no session state issue required
N = max_workers
ref_summary = load via ref-reader
@@ -235,17 +336,61 @@ LOOP:
# ── Post progress ────────────────────────────────────────────
if cycle % 60 == 0: # Every ~10 minutes with 10-second monitoring
post comment on session state issue:
"[HEALTH] test-infra-improver | Iteration: <cycle> | Status: active\n" +
"- Type: pool-supervisor\n" +
"- Active workers: <len(active)> / <N>\n" +
"- Work completed: <len(analyzed_areas)>/<len(analysis_areas)> areas analyzed\n" +
"- Issues filed: <findings_total>\n" +
"- Last action: <brief description>\n" +
"- Next check: in 10 minutes\n\n" +
"---\n" +
"**Automated by CleverAgents Bot**\n" +
"Supervisor: Test Infrastructure | Agent: test-infra-improver"
next_health_time=$(date -d "+10 minutes" -Iseconds)
tracking_body="# Test Infrastructure Analysis Pool Status — $(date +'%Y-%m-%d %H:%M:%S')
**Agent**: test-infra-improver
**Cycle**: $cycle
**Reporting Interval**: 10 minutes (Next report expected: $next_health_time)
**Status**: active
## Summary
Test infrastructure analysis pool managing ${#active[@]} workers analyzing ${#analysis_areas[@]} areas with $findings_total improvement proposals filed.
## Details
**Pool Status**: Active - analyzing testing infrastructure optimization opportunities
**Active Workers**: ${#active[@]} / $N
**Progress**: ${#analyzed_areas[@]}/${#analysis_areas[@]} areas analyzed ($(( ${#analyzed_areas[@]} * 100 / ${#analysis_areas[@]} ))%)
**Findings Filed**: $findings_total improvement proposals
### Analysis Areas Progress
| Area | Status | Worker | Findings | Duration |
|------|--------|---------|----------|----------|
$(for area in "${!active[@]}"; do
local worker="${active[$area]:0:8}..."
local findings="${area_findings[$area]:-0}"
local duration="$(( ($(date +%s) - ${worker_start_times[$area]}) / 60 ))min"
echo "| $area | In Progress | $worker | $findings | $duration |"
done)
### Completed Areas
$(for area in "${analyzed_areas[@]}" | head -5; do
echo "- $area (${area_findings[$area]:-0} findings)"
done)
## Health Indicators
- **Analysis Completion**: ${#analyzed_areas[@]}/${#analysis_areas[@]} ($(( ${#analyzed_areas[@]} * 100 / ${#analysis_areas[@]} ))%)
- **Worker Utilization**: ${#active[@]}/$N ($(( ${#active[@]} * 100 / N ))%)
- **Improvement Rate**: $findings_total proposals across ${#analyzed_areas[@]} areas
- **System Status**: Operational and actively analyzing
## Next Actions
- Continue monitoring ${#active[@]} active analysis workers
- Dispatch workers to remaining ${#unanalyzed_areas[@]} unanalyzed areas
- Process findings from completed analyses
- Next health report in ~10 minutes
---
**Automated by CleverAgents Bot**
Supervisor: Test Infrastructure Analysis | Agent: test-infra-improver"
cleanup_previous_infra_tracking
create_infra_tracking_issue $cycle "$tracking_body"
```
---
+149 -29
View File
@@ -69,6 +69,110 @@ You are a user acceptance testing agent. You operate in one of two modes:
This dual-mode design allows the product-builder to launch a single UAT
tester instance that manages N parallel testers internally.
## Automation Tracking System
**Updated**: This agent creates individual tracking issues instead of posting comments to a session state issue.
### Tracking Issue Format
- **Health Reports**: `[AUTO-UAT-POOL] UAT Testing Report (Cycle N)`
- **Worker Reports**: `[AUTO-UAT-POOL] Announce: Worker <feature_area> Complete`
- **Announcements**: `[AUTO-UAT-POOL] Announce: <message summary>`
- **Labels**: "Automation Tracking" + any relevant priority labels
### Cleanup Protocol
- **ONE ISSUE PER CYCLE**: Delete previous cycle's tracking issue before creating new one
- **PRESERVE ANNOUNCEMENTS**: Don't delete announcement issues
### UAT Testing Tracking Functions
```bash
# Find and delete previous UAT testing tracking issue
function cleanup_previous_uat_tracking() {
local previous_issue=$(curl -s "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues?state=open&type=issues&labels=Automation+Tracking" \
-H "Authorization: token $FORGEJO_PAT" | \
jq -r '.[] | select(.title | contains("[AUTO-UAT-POOL] UAT Testing Report")) | .number' | head -1)
if [[ -n "$previous_issue" && "$previous_issue" != "null" ]]; then
echo "Cleaning up previous UAT testing tracking issue #$previous_issue"
# Close with final comment
curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue/comments" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"body\": \"UAT testing cycle completed. Closing this tracking issue.\\n\\n---\\n**Automated by CleverAgents Bot**\\nSupervisor: UAT Testing | Agent: uat-tester\"}"
# Close the issue
curl -s -X PATCH "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$previous_issue" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"state": "closed"}'
echo "✓ Previous UAT testing tracking issue #$previous_issue closed"
sleep 2
fi
}
# Create UAT testing tracking issue
function create_uat_tracking_issue() {
local cycle="$1"
local title="[AUTO-UAT-POOL] UAT Testing Report (Cycle $cycle)"
local body="$2"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created UAT testing tracking issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
echo "✓ Applied 'Automation Tracking' label to issue #$issue_number"
return 0
else
echo "✗ Failed to create UAT testing tracking issue"
return 1
fi
}
# Create UAT testing announcement issue
function create_uat_announcement_issue() {
local message="$1"
local priority="$2"
local body="$3"
local title="[AUTO-UAT-POOL] Announce: $message"
local response=$(curl -s -X POST "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d "{\"title\": \"$title\", \"body\": \"$body\"}")
local issue_number=$(echo "$response" | jq -r '.number')
if [[ "$issue_number" != "null" && -n "$issue_number" ]]; then
echo "✓ Created UAT testing announcement issue #$issue_number"
# CRITICAL: Apply "Automation Tracking" label
curl -s -X PUT "https://git.cleverthis.com/api/v1/repos/$owner/$repo/issues/$issue_number/labels" \
-H "Authorization: token $FORGEJO_PAT" \
-H "Content-Type: application/json" \
-d '{"labels": ["Automation Tracking"]}'
return 0
else
echo "✗ Failed to create UAT testing announcement issue"
return 1
fi
}
```
## Documentation Generation
In addition to finding bugs, UAT testers capture successful end-to-end
@@ -125,9 +229,8 @@ set timeout explicitly. You MUST NOT voluntarily exit — sleep and re-poll.
### Pool Supervision Loop
**IMPORTANT: Progress reports MUST be posted as comments on the session state
issue — NEVER as separate new issues.** The SESSION_STATE_ISSUE_NUMBER must be
provided by the caller (usually product-builder).
**IMPORTANT: Progress reports MUST be posted as individual tracking issues
with the "Automation Tracking" label.** This replaces the old session state system.
```
N = max_workers
@@ -140,10 +243,11 @@ example_categories_covered = set()
cycle = 0
SERVER = "http://localhost:4096"
# ── Check for session state issue number ─────────────────────────
if SESSION_STATE_ISSUE_NUMBER not provided:
error: "SESSION_STATE_ISSUE_NUMBER is required. This should be provided by product-builder."
ask user for the session state issue number
# ── Setup automation tracking system ────────────────────────────
cycle_number = 1
owner = "<owner>"
repo = "<repo>"
FORGEJO_PAT = "<pat>"
# ── RESUME: Adopt existing UAT worker sessions from previous run ─
EXISTING_WORKERS = bash("curl -s ${SERVER}/session | python3 -c \"
@@ -231,25 +335,41 @@ LOOP:
NEW_SID = create session + prompt_async for next_area
active[next_area] = NEW_SID
# ── Step 4: Post progress (as COMMENT on session state issue) ─────
# NEVER create a new Forgejo issue for progress reports.
# Always post as a comment on SESSION_STATE_ISSUE_NUMBER.
# ── Step 4: Create individual tracking issue for progress ─────────
if cycle % 60 == 0: # Every ~10 minutes with 10-second monitoring
post comment on issue #SESSION_STATE_ISSUE_NUMBER:
"[HEALTH] uat-tester | Iteration: <cycle> | Status: active\n" +
"- Type: pool-supervisor\n" +
"- Active workers: <len(active)> / <N>\n" +
"- Work completed: <len(tested_areas)>/<len(feature_areas)> areas tested\n" +
"- Coverage: <len(tested_areas)/len(feature_areas)*100>%\n" +
"- Bugs filed: <bugs_found_total>\n" +
"- Documentation:\n" +
" - Examples generated: <docs_generated_total>\n" +
" - Categories covered: <example_categories_covered>\n" +
"- Last action: <brief description>\n" +
"- Next check: in 10 minutes\n\n" +
"---\n" +
"**Automated by CleverAgents Bot**\n" +
"Supervisor: UAT Testing | Agent: uat-tester"
# Clean up previous tracking issue and create new one
cleanup_previous_uat_tracking
tracking_body="
[HEALTH] uat-tester | Iteration: $cycle | Status: active
**Progress Summary:**
- Type: pool-supervisor
- Active workers: ${#active[@]} / $N
- Work completed: ${#tested_areas[@]}/${#feature_areas[@]} areas tested
- Coverage: $((${#tested_areas[@]} * 100 / ${#feature_areas[@]}))%
- Bugs filed: $bugs_found_total
- Documentation:
- Examples generated: $docs_generated_total
- Categories covered: ${example_categories_covered[@]}
- Last action: $brief_description
- Next check: in 10 minutes
**Active Testing Areas:**
$(for area in "${!active[@]}"; do echo "- $area (session: ${active[$area]})"; done)
**Completed Areas:**
$(for area in "${tested_areas[@]}"; do echo "- ✓ $area"; done)
**Remaining Areas:**
$(for area in "${untested[@]}"; do echo "- ○ $area"; done)
---
**Automated by CleverAgents Bot**
Supervisor: UAT Testing | Agent: uat-tester
"
create_uat_tracking_issue $cycle "$tracking_body"
# ── IMMEDIATELY loop back ────────────────────────────────────
```
@@ -693,10 +813,10 @@ No exceptions — every comment, every issue body, every PR description.
## Important Rules
- **NEVER create new Forgejo issues for progress reports.** In Pool
Supervisor Mode, use the SESSION_STATE_ISSUE_NUMBER provided by the
caller and post ALL progress updates as comments on that single issue.
Creating separate issues for each progress report pollutes the issue tracker.
- **CREATE individual tracking issues for progress reports.** In Pool
Supervisor Mode, create individual tracking issues with the "Automation Tracking"
label for each cycle. Clean up previous cycles to maintain exactly one active
tracking issue at a time.
- **NEVER work in /app.** Always use your isolated clone (Worker Mode) or
Forgejo API only (Pool Supervisor Mode).
- **NEVER modify code.** You are a tester, not a fixer. File issues only.