Implement Force Multiplier 12: Automated Issue Decomposition
This commit is contained in:
49
tasks.py
49
tasks.py
@@ -2247,31 +2247,32 @@ def cross_review_prs():
|
||||
|
||||
return {"reviews": len(results), "details": results}
|
||||
|
||||
@huey.periodic_task(crontab(minute="*/15"))
|
||||
def resurrection_tick():
|
||||
"""Force Multiplier 11: The Lazarus Heartbeat (Self-Healing Services).
|
||||
@huey.periodic_task(crontab(hour="*/12"))
|
||||
def decomposition_tick():
|
||||
"""Force Multiplier 12: Automated Issue Decomposition (Epic Splitting).
|
||||
|
||||
Checks critical services and restarts them if they are dead.
|
||||
Identifies large issues (EPICs) and flags them for decomposition into sub-tasks.
|
||||
"""
|
||||
services = [
|
||||
"com.timmy.gitea-event-watcher",
|
||||
"com.timmy.gemini-worker",
|
||||
"com.timmy.grok-worker",
|
||||
"com.hermes.gateway"
|
||||
]
|
||||
gitea = get_gitea_client()
|
||||
repos = ["Timmy_Foundation/timmy-config", "Timmy_Foundation/timmy-home", "Timmy_Foundation/the-nexus"]
|
||||
|
||||
for service in services:
|
||||
try:
|
||||
# Check if service is running
|
||||
res = subprocess.run(["launchctl", "list", service], capture_output=True, text=True)
|
||||
if res.returncode != 0:
|
||||
audit_log("resurrection_start", "system", {"service": service}, confidence="High")
|
||||
# Attempt restart (assuming plist is in standard location)
|
||||
plist_path = f"/Library/LaunchDaemons/{service}.plist"
|
||||
if not os.path.exists(plist_path):
|
||||
plist_path = f"~/Library/LaunchAgents/{service}.plist"
|
||||
for repo in repos:
|
||||
issues = gitea.get_open_issues(repo)
|
||||
for issue in issues:
|
||||
labels = [l['name'] for l in issue.get('labels', [])]
|
||||
body = issue.get('body', '')
|
||||
|
||||
# Identify EPICs or large task lists
|
||||
is_epic = "EPIC" in labels or "EPIC" in issue['title']
|
||||
has_large_tasklist = body.count("- [ ]") > 5
|
||||
|
||||
if (is_epic or has_large_tasklist) and "needs-decomposition" not in labels:
|
||||
audit_log("decomposition_flagged", "system", {"repo": repo, "issue": issue['number']}, confidence="High")
|
||||
gitea.add_label(repo, issue['number'], "needs-decomposition")
|
||||
|
||||
subprocess.run(["launchctl", "load", "-w", os.path.expanduser(plist_path)])
|
||||
audit_log("resurrection_complete", "system", {"service": service}, confidence="Medium")
|
||||
except Exception as e:
|
||||
audit_log("resurrection_failed", "system", {"service": service, "error": str(e)}, confidence="Low")
|
||||
# Add comment suggesting decomposition
|
||||
msg = "### Automated Decomposition Suggestion\n"
|
||||
msg += "This issue has been flagged as an **EPIC** or contains a large task list. "
|
||||
msg += "To improve velocity and reduce cycle time, I recommend splitting this into smaller, atomic issues.\n\n"
|
||||
msg += "I will attempt to generate a decomposition plan in the next cycle."
|
||||
gitea.create_issue_comment(repo, issue['number'], msg)
|
||||
|
||||
Reference in New Issue
Block a user