generated from coulomb/repo-seed
Implement post-triage operational hardening
This commit is contained in:
@@ -377,6 +377,7 @@ async def emit_tasks(payload: dict) -> list[str]:
|
||||
Session = _get_session_factory()
|
||||
|
||||
refs: list[str] = []
|
||||
errors: list[str] = []
|
||||
async with Session() as session:
|
||||
async with session.begin():
|
||||
for spec_dict in task_specs_raw:
|
||||
@@ -411,6 +412,11 @@ async def emit_tasks(payload: dict) -> list[str]:
|
||||
)
|
||||
session.add(log_row)
|
||||
except Exception as exc:
|
||||
message = f"{spec.source_type}:{spec.source_id}: {exc}"
|
||||
errors.append(message)
|
||||
activity.logger.warning("emit_tasks: sink.emit failed — %s", exc)
|
||||
|
||||
if errors:
|
||||
raise RuntimeError(f"task emission sink failure: {errors!r}")
|
||||
|
||||
return refs
|
||||
|
||||
@@ -31,7 +31,7 @@ from activity_core.context_resolvers.base import CONTEXT_RESOLVER_REGISTRY, Cont
|
||||
_DEFAULT_STATE_HUB_URL = "http://127.0.0.1:8000"
|
||||
_TIMEOUT_SECONDS = 10.0
|
||||
_OPEN_WORKSTREAM_STATUSES = {"active", "ready", "blocked"}
|
||||
_OPEN_TASK_STATUSES = {"todo", "in_progress", "blocked"}
|
||||
_OPEN_TASK_STATUSES = {"wait", "todo", "progress"}
|
||||
# Sentinel age for repos that have never had an SBOM ingested. Large enough
|
||||
# that any threshold-based staleness rule treats them as "very stale" without
|
||||
# forcing the rule expression to special-case None.
|
||||
@@ -260,7 +260,7 @@ def _daily_triage_digest(params: dict[str, Any]) -> str:
|
||||
"status",
|
||||
"open_task_counts",
|
||||
"needs_human_count",
|
||||
"blocked_task_count",
|
||||
"wait_task_count",
|
||||
"workplan_health_labels",
|
||||
],
|
||||
},
|
||||
@@ -311,14 +311,14 @@ def _open_workstream_digest(
|
||||
|
||||
|
||||
def _task_counts(tasks: list[dict[str, Any]]) -> dict[str, int]:
|
||||
counts = {"todo": 0, "in_progress": 0, "blocked": 0, "needs_human": 0}
|
||||
counts = {"wait": 0, "todo": 0, "progress": 0, "needs_human": 0}
|
||||
for task in tasks:
|
||||
status = task.get("status")
|
||||
if status in counts:
|
||||
counts[status] += 1
|
||||
if task.get("needs_human"):
|
||||
counts["needs_human"] += 1
|
||||
counts["open_total"] = counts["todo"] + counts["in_progress"] + counts["blocked"]
|
||||
counts["open_total"] = counts["wait"] + counts["todo"] + counts["progress"]
|
||||
return counts
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ def _candidate_sort_key(candidate: dict[str, Any]) -> tuple[int, int, int, int]:
|
||||
_priority_rank(candidate.get("planning_priority")),
|
||||
0 if candidate.get("status") == "active" else 1,
|
||||
-int(counts.get("needs_human", 0)),
|
||||
-int(counts.get("blocked", 0)),
|
||||
-int(counts.get("wait", 0)),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user