Skip to content

The agent that grows with you

refactor(kanban-cli): reflow wrapped string literals to 100 cols (AST-identical; SQL/daemon text untouched)

Teknium9ed22aac2ed9
diff --git a/hermes_cli/kanban_diagnostics.py b/hermes_cli/kanban_diagnostics.py
index ac887488cee..d671d3fdca4 100644
--- a/hermes_cli/kanban_diagnostics.py
+++ b/hermes_cli/kanban_diagnostics.py
@@ -254,11 +254,10 @@ def _rule_hallucinated_cards(task, events, runs, now, cfg) -> list[Diagnostic]:
kind="hallucinated_cards", severity="error",
title="Worker claimed cards that don't exist",
detail=(
- "The completing worker declared created_cards that either didn't "
- "exist or weren't created by its profile. The completion was "
- "blocked and the task stayed in its prior state. "
- "Usually means the worker hallucinated ids instead of capturing "
- "return values from kanban_create."
+ "The completing worker declared created_cards that either didn't exist or weren't "
+ "created by its profile. The completion was blocked and the task stayed in its prior "
+ "state. Usually means the worker hallucinated ids instead of capturing return values "
+ "from kanban_create."
),
actions=actions,
first_seen_at=_event_ts(hits[0]), last_seen_at=_event_ts(hits[-1]), count=len(hits),
@@ -270,9 +269,8 @@ def _rule_hallucinated_cards(task, events, runs, now, cfg) -> list[Diagnostic]:
_TRIAGE_SLOTS = {
True: (
"auxiliary.kanban_decomposer", "auxiliary.triage_specifier", "decomposer",
- "Auto-decompose is on, so the dispatcher needs "
- "auxiliary.kanban_decomposer (with auxiliary.triage_specifier as "
- "a fallback for non-fan-out tasks).",
+ "Auto-decompose is on, so the dispatcher needs auxiliary.kanban_decomposer (with "
+ "auxiliary.triage_specifier as a fallback for non-fan-out tasks).",
),
False: (
"auxiliary.triage_specifier", "auxiliary.kanban_decomposer", "specifier",
@@ -323,11 +321,10 @@ def _rule_triage_aux_unavailable(task, events, runs, now, cfg) -> list[Diagnosti
kind="triage_aux_unavailable", severity="warning",
title=f"Triage {primary_desc} has no usable model",
detail=(
- f"This task is still in triage and no working auxiliary model is "
- f"visible to the dispatcher. {detail_path} The default slot uses "
- f"`provider: auto` which falls back to the main model, but no main "
- f"model is configured either. Configure the slot directly or set a "
- f"main model so the auto fallback can take over."
+ f"This task is still in triage and no working auxiliary model is visible to the "
+ f"dispatcher. {detail_path} The default slot uses `provider: auto` which falls back to "
+ f"the main model, but no main model is configured either. Configure the slot directly "
+ f"or set a main model so the auto fallback can take over."
),
actions=actions,
first_seen_at=now, last_seen_at=now, count=1,
@@ -350,10 +347,9 @@ def _rule_prose_phantom_refs(task, events, runs, now, cfg) -> list[Diagnostic]:
kind="prose_phantom_refs", severity="warning",
title="Completion summary references unknown task ids",
detail=(
- "The completion summary mentions task ids that don't resolve "
- "in this board's database. The completion itself succeeded, "
- "but downstream consumers parsing the summary may be pointed "
- "at cards that never existed."
+ "The completion summary mentions task ids that don't resolve in this board's database. "
+ "The completion itself succeeded, but downstream consumers parsing the summary may be "
+ "pointed at cards that never existed."
),
actions=_generic_recovery_actions(task, running=_is_running(task)),
first_seen_at=_event_ts(hits[0]), last_seen_at=_event_ts(hits[-1]), count=len(hits),
@@ -414,18 +410,16 @@ def _rule_repeated_failures(task, events, runs, now, cfg) -> list[Diagnostic]:
if err_snippet:
title = f"Agent {outcome_label} x{failures}: {err_snippet.splitlines()[0][:160]}"
detail = (
- f"This task has failed {failures} times in a row "
- f"(most recent: {outcome_label}). Full last error:\n\n{err_snippet}\n\n"
- f"The dispatcher circuit breaker is configured for "
- f"{failure_limit} consecutive non-success attempts. Fix the "
- f"root cause and reclaim or unblock the task to retry."
+ f"This task has failed {failures} times in a row (most recent: {outcome_label}). Full "
+ f"last error:\n\n{err_snippet}\n\nThe dispatcher circuit breaker is configured for "
+ f"{failure_limit} consecutive non-success attempts. Fix the root cause and reclaim or "
+ f"unblock the task to retry."
)
else:
title = f"Agent {outcome_label} x{failures} (no error recorded)"
detail = (
- f"This task has failed {failures} times in a row "
- f"(most recent: {outcome_label}) but no error text was "
- f"captured. Check the suggested command or the worker log."
+ f"This task has failed {failures} times in a row (most recent: {outcome_label}) but no "
+ f"error text was captured. Check the suggested command or the worker log."
)
return [Diagnostic(
kind="repeated_failures", severity=severity,
@@ -539,11 +533,10 @@ def _rule_review_dependency_deadlock(task, events, runs, now, cfg) -> list[Diagn
kind="review_dependency_deadlock", severity="error",
title=f"Review handoff blocks {len(child_ids)} dependent task(s)",
detail=(
- "This implementation is sticky-blocked for review while its "
- "downstream task(s) require the implementation to be done or "
- "archived before they can run. Complete the finished phase, unlink "
- "the incorrect dependency, or migrate this workflow to the "
- "first-class review lifecycle."
+ "This implementation is sticky-blocked for review while its downstream task(s) require "
+ "the implementation to be done or archived before they can run. Complete the finished "
+ "phase, unlink the incorrect dependency, or migrate this workflow to the first-class "
+ "review lifecycle."
),
actions=actions,
first_seen_at=blocked_at, last_seen_at=blocked_at, count=len(child_ids),
@@ -575,10 +568,9 @@ def _rule_stuck_in_blocked(task, events, runs, now, cfg) -> list[Diagnostic]:
kind="stuck_in_blocked", severity="warning",
title=f"Task has been blocked for {int(age_hours)}h",
detail=(
- f"This task transitioned to blocked {int(age_hours)}h ago and "
- f"has had no comments or unblock attempts since. Blocked tasks "
- f"are waiting for human input — check the block reason and "
- f"either unblock with feedback or answer with a comment."
+ f"This task transitioned to blocked {int(age_hours)}h ago and has had no comments or "
+ f"unblock attempts since. Blocked tasks are waiting for human input — check the block "
+ f"reason and either unblock with feedback or answer with a comment."
),
actions=[DiagnosticAction(kind="comment", label="Add a comment / unblock the task", suggested=True)],
first_seen_at=last_blocked_ts, last_seen_at=last_blocked_ts, count=1,
@@ -629,11 +621,10 @@ def _rule_block_unblock_cycling(task, events, runs, now, cfg) -> list[Diagnostic
kind="block_unblock_cycling", severity="warning",
title=f"Task block→unblock cycled {cycles}x in {int(window_seconds/3600)}h",
detail=(
- f"This task has been blocked {cycles} times after being "
- "unblocked, suggesting the unblock is not addressing the "
- "root cause and the worker keeps hitting the same wall. "
- "Review the block reasons in the event history; a different "
- "intervention (reassign, change scope, archive) may be needed."
+ f"This task has been blocked {cycles} times after being unblocked, suggesting the "
+ f"unblock is not addressing the root cause and the worker keeps hitting the same wall. "
+ f"Review the block reasons in the event history; a different intervention (reassign, "
+ f"change scope, archive) may be needed."
),
actions=actions,
first_seen_at=int(initial_blocked_ts) if initial_blocked_ts else int(now),
@@ -690,11 +681,10 @@ def _rule_stranded_in_ready(task, events, runs, now, cfg) -> list[Diagnostic]:
kind="stranded_in_ready", severity=severity,
title=f"Ready for {age_str} with no worker",
detail=(
- f"This task has been ready for {age_str} but nothing has "
- f"claimed it. Common causes: assignee {assignee!r} is "
- f"misspelled, the profile was deleted, or the external "
- f"worker pool for this lane is down. Confirm the assignee "
- f"is correct and that a worker is actually polling for it."
+ f"This task has been ready for {age_str} but nothing has claimed it. Common causes: "
+ f"assignee {assignee!r} is misspelled, the profile was deleted, or the external worker "
+ f"pool for this lane is down. Confirm the assignee is correct and that a worker is "
+ f"actually polling for it."
),
actions=actions,
first_seen_at=last_ready_ts, last_seen_at=last_ready_ts, count=1,
diff --git a/hermes_cli/kanban_ops.py b/hermes_cli/kanban_ops.py
index 26190702ca8..83aa2e6ab11 100644
--- a/hermes_cli/kanban_ops.py
+++ b/hermes_cli/kanban_ops.py
@@ -178,9 +178,8 @@ def _cmd_daemon(args: argparse.Namespace) -> int:
verbose = bool(getattr(args, "verbose", False))
print(
- f"Kanban dispatcher running STANDALONE via --force "
- f"(interval={args.interval}s, pid={os.getpid()}). "
- f"Ctrl-C to stop. NOTE: if a gateway is also running with "
+ f"Kanban dispatcher running STANDALONE via --force (interval={args.interval}s, "
+ f"pid={os.getpid()}). Ctrl-C to stop. NOTE: if a gateway is also running with "
f"dispatch_in_gateway=true (default), you have two dispatchers racing for claims.",
file=sys.stderr,
)
@@ -208,12 +207,11 @@ def _cmd_daemon(args: argparse.Namespace) -> int:
now = int(time.time())
if now - health_state["last_warn_at"] >= 300:
print(
- f"[{_fmt_ts(now)}] WARN dispatcher stuck: "
- f"ready queue non-empty for {health_state['bad_ticks']} "
- f"consecutive ticks but 0 workers spawned successfully. "
- f"Check profile health (venv, PATH, credentials) and "
- f"`hermes kanban list --status ready` / "
- f"`hermes kanban list --status blocked` for recent spawn_failed tasks.",
+ f"[{_fmt_ts(now)}] WARN dispatcher stuck: ready queue non-empty for "
+ f"{health_state['bad_ticks']} consecutive ticks but 0 workers spawned "
+ f"successfully. Check profile health (venv, PATH, credentials) and `hermes "
+ f"kanban list --status ready` / `hermes kanban list --status blocked` for "
+ f"recent spawn_failed tasks.",
file=sys.stderr, flush=True,
)
health_state["last_warn_at"] = now
@@ -225,9 +223,8 @@ def _cmd_daemon(args: argparse.Namespace) -> int:
)
if did_work:
print(
- f"[{_fmt_ts(int(time.time()))}] "
- f"reclaimed={res.reclaimed} crashed={len(res.crashed)} "
- f"timed_out={len(res.timed_out)} stale={len(res.stale)} "
+ f"[{_fmt_ts(int(time.time()))}] reclaimed={res.reclaimed} "
+ f"crashed={len(res.crashed)} timed_out={len(res.timed_out)} stale={len(res.stale)} "
f"promoted={res.promoted} spawned={len(res.spawned)} "
f"auto_blocked={len(res.auto_blocked)}",
flush=True,
diff --git a/hermes_cli/kanban_parser.py b/hermes_cli/kanban_parser.py
index 56e506e8aea..1944cfc4158 100644
--- a/hermes_cli/kanban_parser.py
+++ b/hermes_cli/kanban_parser.py
@@ -115,11 +115,10 @@ _BOARD_SPECS = [
_arg("--include-logs", action="store_true", help="Include per-task worker logs"),
_json_flag(),
], help="Export a board to a portable .tar.gz archive", description=(
- "Package a board's tasks, comments, links, history, and file "
- "attachments into one archive that can be imported on another "
- "machine. Claims, worker PIDs, chat subscriptions, and paths "
- "belonging to this machine are stripped. Workspaces are never "
- "included — they are rebuilt on demand."
+ "Package a board's tasks, comments, links, history, and file attachments into one archive "
+ "that can be imported on another machine. Claims, worker PIDs, chat subscriptions, and "
+ "paths belonging to this machine are stripped. Workspaces are never included — they are "
+ "rebuilt on demand."
)),
_cmd("import", [
_arg("archive", help="Path to the .tar.gz archive"),
@@ -127,9 +126,8 @@ _BOARD_SPECS = [
_arg("--switch", action="store_true", help="Switch to the imported board afterwards"),
_json_flag(),
], help="Import a board archive as a new board", description=(
- "Import a .tar.gz produced by `hermes kanban boards export`. "
- "The board always lands as a NEW board — the slug gains a "
- "numeric suffix if it is already taken — so an import can "
+ "Import a .tar.gz produced by `hermes kanban boards export`. The board always lands as a "
+ "NEW board — the slug gains a numeric suffix if it is already taken — so an import can "
"never overwrite or merge into a board you already have."
)),
]
@@ -140,11 +138,10 @@ _SPECS = [
_cmd("boards", children=("boards_action", _BOARD_SPECS),
help="Manage kanban boards (one board per project / workstream)",
description=(
- "Boards let you separate unrelated streams of work "
- "(projects, repos, domains) into isolated queues. Each "
- "board has its own DB, workspaces directory, and dispatcher "
- "loop — tasks on one board cannot collide with tasks on "
- "another. The first board is 'default' and always exists."
+ "Boards let you separate unrelated streams of work (projects, repos, domains) into "
+ "isolated queues. Each board has its own DB, workspaces directory, and dispatcher "
+ "loop — tasks on one board cannot collide with tasks on another. The first board is "
+ "'default' and always exists."
)),
_cmd("create", [
_arg("title", help="Task title"),
@@ -176,11 +173,10 @@ _SPECS = [
"translation --skill github-code-review"),
_arg("--max-retries", type=int, default=None, metavar="N",
help="Per-task override for the consecutive-failure "
- "circuit breaker. Trip on the Nth failure — "
- "e.g. --max-retries 1 blocks on the first "
- "failure (no retries), --max-retries 3 allows "
- "two retries. Omit to use the dispatcher's kanban.failure_limit config "
- f"(default {kb.DEFAULT_FAILURE_LIMIT})."),
+ f"circuit breaker. Trip on the Nth failure — e.g. --max-retries 1 blocks on the "
+ f"first failure (no retries), --max-retries 3 allows two retries. Omit to use "
+ f"the dispatcher's kanban.failure_limit config (default "
+ f"{kb.DEFAULT_FAILURE_LIMIT})."),
_arg("--model", default=None, dest="model_override",
help="Pin the worker to this model (passed as -m <model>) without "
"changing the profile's configured model. Combine with --provider "
@@ -416,15 +412,13 @@ _SPECS = [
_cmd("repair", [_json_flag(help="Emit the repair report as JSON")],
help="Check kanban.db integrity and auto-repair index-only corruption",
description=(
- "Runs PRAGMA integrity_check on the board's DB and reports the "
- "result. When the failure consists only of index-scoped errors "
- "('wrong # of entries in index <name>' / 'row N missing from "
- "index <name>'), the corrupt file is quarantined to a "
- ".corrupt.<hash>.bak sibling first and the damaged indexes are "
- "rebuilt with REINDEX — the same narrow auto-repair the "
- "connect-time guard applies. Any other corruption class is "
- "reported and left untouched (fail-closed). Exits 0 when the DB "
- "is healthy or was repaired, non-zero when it is still corrupt."
+ "Runs PRAGMA integrity_check on the board's DB and reports the result. When the "
+ "failure consists only of index-scoped errors ('wrong # of entries in index <name>' / "
+ "'row N missing from index <name>'), the corrupt file is quarantined to a "
+ ".corrupt.<hash>.bak sibling first and the damaged indexes are rebuilt with REINDEX — "
+ "the same narrow auto-repair the connect-time guard applies. Any other corruption "
+ "class is reported and left untouched (fail-closed). Exits 0 when the DB is healthy "
+ "or was repaired, non-zero when it is still corrupt."
)),
]
diff --git a/hermes_cli/kanban_swarm.py b/hermes_cli/kanban_swarm.py
index a4cae7b52ca..8551ae32890 100644
--- a/hermes_cli/kanban_swarm.py
+++ b/hermes_cli/kanban_swarm.py
@@ -60,11 +60,10 @@ def _require_text(value: str, field_name: str) -> str:
def _swarm_context(root_id: str, goal: str) -> str:
return (
- f"\n\n## Swarm protocol\n- Swarm root / shared blackboard: `{root_id}`.\n"
- "- Read sibling/parent handoffs from Kanban context before working.\n"
- "- Put machine-readable facts in completion metadata.\n"
- "- Put cross-worker notes on the root task using structured comments.\n"
- f"- Goal: {goal.strip()}\n"
+ f"\n\n## Swarm protocol\n- Swarm root / shared blackboard: `{root_id}`.\n- Read "
+ f"sibling/parent handoffs from Kanban context before working.\n- Put machine-readable "
+ f"facts in completion metadata.\n- Put cross-worker notes on the root task using "
+ f"structured comments.\n- Goal: {goal.strip()}\n"
)
diff --git a/hermes_cli/kanban_transfer.py b/hermes_cli/kanban_transfer.py
index 401e4803227..37d9a303a5a 100644
--- a/hermes_cli/kanban_transfer.py
+++ b/hermes_cli/kanban_transfer.py
@@ -272,9 +272,8 @@ def _relocate_imported_rows(conn: sqlite3.Connection, slug: str) -> tuple[dict[s
if parked:
conn.execute(f"UPDATE tasks SET status = 'triage' WHERE id IN ({_placeholders(parked)})", parked)
warnings.append(
- f"{len(parked)} task(s) moved to triage — their workspace was a "
- f"directory or git worktree on the exporting machine and needs "
- f"to be pointed somewhere on this one"
+ f"{len(parked)} task(s) moved to triage — their workspace was a directory or git "
+ f"worktree on the exporting machine and needs to be pointed somewhere on this one"
)
for row in conn.execute("SELECT id FROM tasks").fetchall():