Prepare State Hub retirement baseline
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Multi-Context Image / build-and-push (push) Successful in 1m0s

This commit is contained in:
tegwick 2026-08-09 16:19:53 +02:00
parent 2217bdd9f5
commit 5927591be8
46 changed files with 32583 additions and 62 deletions

View file

@ -57,7 +57,12 @@ HubCoreMCPServer(
# ---------------------------------------------------------------------------
def _client() -> httpx.Client:
return httpx.Client(base_url=API_BASE, timeout=30.0, follow_redirects=True)
return httpx.Client(
base_url=API_BASE,
timeout=30.0,
follow_redirects=True,
trust_env=False,
)
def _get(path: str, params: dict | None = None) -> Any:
@ -268,6 +273,11 @@ def get_domain_summary(domain_slug: str) -> str:
blocking = _get("/decisions", {"decision_type": "pending", "topic_id": topic_id})
recent = _get("/progress", {"topic_id": topic_id, "limit": 5})
repos = _get("/repos", {"domain": domain_slug})
active_goals = _get("/repo-goals", {"status": "active"})
goals_by_repo: dict[str, list[dict]] = {}
for goal in active_goals:
repo_key = str(goal.get("repo_id") or goal.get("repo_slug") or "")
goals_by_repo.setdefault(repo_key, []).append(goal)
# ── Goal guidance ──────────────────────────────────────────────────────────
# Fetch active repo goals per repo, then cross-reference with workstreams.
@ -289,12 +299,12 @@ def get_domain_summary(domain_slug: str) -> str:
for repo in repos:
repo_slug = repo["slug"]
repo_id = repo["id"]
active_goals = _get("/repo-goals", {"repo_slug": repo_slug, "status": "active"})
if not active_goals:
repo_goals = goals_by_repo.get(str(repo_id), goals_by_repo.get(repo_slug, []))
if not repo_goals:
continue
active_goal_ids = {g["id"] for g in active_goals}
active_goal_ids = {g["id"] for g in repo_goals}
for goal in active_goals:
for goal in repo_goals:
linked = ws_by_repo_goal.get(goal["id"], [])
if not linked:
needs_workplan.append({
@ -324,7 +334,7 @@ def get_domain_summary(domain_slug: str) -> str:
"recent_workplan_title": recent_ws["title"],
"recent_workstream_id": recent_ws["id"],
"recent_workstream_title": recent_ws["title"],
"active_goal_titles": [g["title"] for g in active_goals],
"active_goal_titles": [g["title"] for g in repo_goals],
"message": (
f"Workplan '{recent_ws['title']}' is not linked to the current "
f"repo goal(s) for {repo_slug}. "
@ -353,31 +363,6 @@ def get_domain_summary(domain_slug: str) -> str:
if goal_guidance:
result["goal_guidance"] = goal_guidance
inbox_hygiene: dict[str, Any] = {}
try:
from scripts.consistency_check import collect_inbox_hygiene, STALE_UNREAD_DAYS
except ImportError:
collect_inbox_hygiene = None # type: ignore[assignment]
STALE_UNREAD_DAYS = 3
if collect_inbox_hygiene is not None:
for repo in repos:
repo_slug = repo["slug"]
hygiene = collect_inbox_hygiene(API_BASE, repo_slug)
if (
hygiene["stale_unread_count"]
or hygiene["missing_thread"]
or hygiene["work_requests_unpromoted"]
):
inbox_hygiene[repo_slug] = {
"stale_unread_count": hygiene["stale_unread_count"],
"stale_unread_days": STALE_UNREAD_DAYS,
"stale_unread": hygiene["stale_unread"][:5],
"missing_thread_count": len(hygiene["missing_thread"]),
"work_requests_unpromoted": hygiene["work_requests_unpromoted"][:3],
}
if inbox_hygiene:
result["inbox_hygiene"] = inbox_hygiene
# Compact capabilities list (type + title + repo_slug only, capped at 20)
caps_raw = _get("/capability-catalog/", {"domain": domain_slug, "status": "active"})
if isinstance(caps_raw, list):