Compare commits

..

1 Commits

View File

@@ -2127,26 +2127,32 @@ def cross_review_prs():
return {"reviews": len(results), "details": results}
def get_model_for_task(task_class, agent_name=None):
"""Implement the Fallback Portfolio doctrine (docs/fallback-portfolios.md).
@huey.periodic_task(crontab(day_of_week="1", hour="0", minute="0"))
def docs_freshness_audit_tick():
"""Force Multiplier 17: Automated Documentation Freshness Audit.
Reads fallback-portfolios.yaml and returns the primary model for the given task class.
If primary fails, the agent should call this again with an incremented 'attempt' (not implemented here).
Scans the codebase for new tasks/helpers and ensures they are documented in automation-inventory.md.
"""
import yaml
portfolio_path = Path(__file__).parent / "fallback-portfolios.yaml"
if not portfolio_path.exists():
return "gemini-1.5-flash" # Default fallback
inventory_path = Path(__file__).parent / "docs" / "automation-inventory.md"
if not inventory_path.exists():
return
with open(portfolio_path, "r") as f:
portfolios = yaml.safe_load(f)
inventory_content = inventory_path.read_text()
# Scan tasks.py for new @huey tasks
with open(__file__, "r") as f:
content = f.read()
tasks = re.findall(r"def (\w+_tick|\w+_task)", content)
# 1. Check agent-specific portfolio
if agent_name and agent_name in portfolios.get("agents", {}):
return portfolios["agents"][agent_name]["primary"]["model"]
# 2. Check task-class portfolio
if task_class in portfolios.get("role_classes", {}):
return portfolios["role_classes"][task_class]["primary"]["model"]
return "gemini-1.5-flash"
missing_tasks = [t for t in tasks if t not in inventory_content]
if missing_tasks:
audit_log("docs_stale_detected", "system", {"missing": missing_tasks}, confidence="High")
# Create issue to update docs
gitea = get_gitea_client()
repo = "Timmy_Foundation/timmy-config"
title = "[DOCS] Stale Documentation Detected: Missing Automation Inventory Entries"
body = f"The following tasks were detected in `tasks.py` but are missing from `docs/automation-inventory.md`:\n\n"
body += "\n".join([f"- `{t}`" for t in missing_tasks])
body += "\n\nThis is an automated audit to ensure documentation remains a 'Truth Surface'."
gitea.create_issue(repo, title, body, labels=["documentation", "needs-update"])