Self-healing agent (supervisor, recovery, login fixes, operator mail) and Portal sage redesign

Snapshot of D:\Ecw Process a11c9ff (2026-10-30).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ManikandanandClaude Opus 5.5 committed 2026-10-30 10:58:35 +05:30
1 parent fafa5285eb
commit d500f750da
26 files changed
+1704 -357

No files matched your search

+25 -3
View File
@@ -283,6 +283,27 @@ def _reasons(rows, top=6) -> list:
for (cat, text), n in ordered[:top]]
def _runs_today(rows) -> list:
"""The Dashboard's Runs today card (operator, 2026-10-30): one entry
per run in the day's rows, newest first, with its counts."""
runs = {}
for r in rows:
run = runs.setdefault(r.get("run_at"), {
"run_at": r.get("run_at"), "run_mode": r.get("run_mode"),
"claims": 0, "Pass": 0, "Fail": 0, "Review": 0})
run["claims"] += 1
if r.get("category") in CATEGORIES:
run[r["category"]] += 1
return sorted(runs.values(), key=lambda x: x["run_at"] or datetime.min,
reverse=True)
def _greeting(now=None) -> str:
hour = (now or datetime.now()).hour
return ("Good morning" if hour < 12 else
"Good afternoon" if hour < 17 else "Good evening")
def portal_settings(urls: str, server: bool) -> dict:
"""create_app's host / origin / cookie / Start settings from
PORTAL_URLS (comma separated, as people type them in the browser) and
@@ -461,11 +482,12 @@ def create_app(repo, allowed_hosts=ALLOWED_HOSTS, runner=None,
if today - timedelta(days=6) <= d["day"] <= today),
key=lambda d: d["day"])
# Only a day with claims costs the second query.
reasons = (_reasons(_db(repo.day_results, today))
if counts["claims"] else [])
rows = _db(repo.day_results, today) if counts["claims"] else []
return _page(request, "dashboard.html", [["Dashboard", None]],
today=counts, has_runs=bool(days),
alert=_last_run_alert(), week=week, reasons=reasons)
alert=_last_run_alert(), week=week,
reasons=_reasons(rows), runs_today=_runs_today(rows),
greeting=_greeting())
@app.get("/days", response_class=HTMLResponse)
def days_page(request: Request):