diff --git a/gateway/kanban_watchers.py b/gateway/kanban_watchers.py index 5bcf70c8d218..056efc3457c8 100644 --- a/gateway/kanban_watchers.py +++ b/gateway/kanban_watchers.py @@ -18,6 +18,8 @@ from pathlib import Path from typing import Any, Callable, Optional +from agent.i18n import t + # Match the logger run.py uses (logging.getLogger(__name__) where __name__ == # "gateway.run") so extracted log records keep their original logger name. logger = logging.getLogger("gateway.run") @@ -160,7 +162,9 @@ async def _kanban_notifier_watcher(self, interval: float = 5.0) -> None: logger.warning("kanban notifier: kanban_db not importable; notifier disabled") return - TERMINAL_KINDS = ("completed", "blocked", "gave_up", "crashed", "timed_out") + # "status" covers dashboard drag-drop and `_set_status_direct()` + # writes — surface those transitions to subscribers too. + TERMINAL_KINDS = ("completed", "blocked", "gave_up", "crashed", "timed_out", "status", "archived", "unblocked") # Subscriptions are removed only when the task reaches a truly final # status (done / archived). We used to also unsub on any terminal # event kind (gave_up / crashed / timed_out / blocked), but that @@ -250,11 +254,13 @@ def _collect(): for sub in subs: owner_profile = sub.get("notifier_profile") or None if owner_profile and owner_profile != notifier_profile: - logger.debug( - "kanban notifier: subscription for %s owned by profile %s; current profile %s skipping", - sub.get("task_id"), owner_profile, notifier_profile, - ) - continue + _owner_adapters = getattr(self, "_profile_adapters", {}).get(owner_profile) + if not _owner_adapters: + logger.debug( + "kanban notifier: subscription for %s owned by profile %s; current profile %s has no adapter for it, skipping", + sub.get("task_id"), owner_profile, notifier_profile, + ) + continue platform = (sub.get("platform") or "").lower() if platform not in active_platforms: logger.debug( @@ -304,7 +310,14 @@ def _collect(): self._kanban_advance, sub, d["cursor"], board_slug, ) continue - adapter = self.adapters.get(plat) + sub_profile = sub.get("notifier_profile") or "" + adapter = None + if sub_profile: + _profile_map = getattr(self, "_profile_adapters", {}).get(sub_profile) + if _profile_map: + adapter = _profile_map.get(plat) + if adapter is None: + adapter = self.adapters.get(plat) if adapter is None: logger.debug( "kanban notifier: adapter %s disconnected before delivery for %s; rewinding claim", @@ -319,6 +332,7 @@ def _collect(): ) continue title = (task.title if task else sub["task_id"])[:120] + board_tag = f"[{board_slug}] " if board_slug else "" for ev in d["events"]: kind = ev.kind # Identity prefix: attribute terminal pings to the @@ -345,25 +359,25 @@ def _collect(): r = lines[0][:160] if lines else task.result[:160] handoff = f"\n{r}" msg = ( - f"✔ {tag}Kanban {sub['task_id']} done" + f"✔ {board_tag}{tag}Kanban {sub['task_id']} done" f" — {title}{handoff}" ) elif kind == "blocked": reason = "" if ev.payload and ev.payload.get("reason"): reason = f": {str(ev.payload['reason'])[:160]}" - msg = f"⏸ {tag}Kanban {sub['task_id']} blocked{reason}" + msg = f"⏸ {board_tag}{tag}Kanban {sub['task_id']} blocked{reason}" elif kind == "gave_up": err = "" if ev.payload and ev.payload.get("error"): err = f"\n{str(ev.payload['error'])[:200]}" msg = ( - f"✖ {tag}Kanban {sub['task_id']} gave up " + f"✖ {board_tag}{tag}Kanban {sub['task_id']} gave up " f"after repeated spawn failures{err}" ) elif kind == "crashed": msg = ( - f"✖ {tag}Kanban {sub['task_id']} worker crashed " + f"✖ {board_tag}{tag}Kanban {sub['task_id']} worker crashed " f"(pid gone); dispatcher will retry" ) elif kind == "timed_out": @@ -371,9 +385,14 @@ def _collect(): if ev.payload and ev.payload.get("limit_seconds"): limit = int(ev.payload["limit_seconds"]) msg = ( - f"⏱ {tag}Kanban {sub['task_id']} timed out " + f"⏱ {board_tag}{tag}Kanban {sub['task_id']} timed out " f"(max_runtime={limit}s); will retry" ) + elif kind == "status": + new_status = "" + if ev.payload and ev.payload.get("status"): + new_status = str(ev.payload["status"]) + msg = f"🔄 {board_tag}{tag}Kanban {sub['task_id']} → {new_status}" else: continue metadata: dict[str, Any] = {} @@ -460,6 +479,55 @@ def _collect(): # same state. See the longer comment on TERMINAL_KINDS # above for the failure mode this prevents. task_terminal = task and task.status in {"done", "archived"} + _WAKE_KINDS = ("completed", "gave_up", "crashed", "timed_out", "blocked") + _wake_kinds = {ev.kind for ev in d["events"] if ev.kind in _WAKE_KINDS} + if _wake_kinds: + try: + _session_key = getattr(task, "session_id", None) or "" + if _session_key: + _title = (task.title if task else sub["task_id"])[:120] + _assignee = task.assignee if task else "" + _parts = [] + if "completed" in _wake_kinds: _parts.append(t("gateway.kanban.wake.completed")) + if "gave_up" in _wake_kinds: _parts.append(t("gateway.kanban.wake.gave_up")) + if "crashed" in _wake_kinds: _parts.append(t("gateway.kanban.wake.crashed")) + if "timed_out" in _wake_kinds: _parts.append(t("gateway.kanban.wake.timed_out")) + if "blocked" in _wake_kinds: _parts.append(t("gateway.kanban.wake.blocked")) + _status = t("gateway.kanban.wake.status_joiner").join(_parts) or t("gateway.kanban.wake.status_default") + _synth = t( + "gateway.kanban.wake.message", + task_id=sub["task_id"], + status=_status, + title=_title, + assignee=_assignee, + board=board_slug, + ) + from gateway.session import SessionSource + from gateway.platforms.base import MessageEvent, MessageType + _source = SessionSource( + platform=plat, + chat_id=sub["chat_id"], + chat_type="group", + thread_id=sub.get("thread_id") or None, + user_id=sub.get("user_id"), + profile=sub_profile or None, + ) + _synth_event = MessageEvent( + text=_synth, + message_type=MessageType.TEXT, + source=_source, + internal=True, + ) + await adapter.handle_message(_synth_event) + logger.info( + "kanban notifier: woke agent for %s on %s/%s profile=%s events=%s", + sub["task_id"], platform_str, sub["chat_id"], sub_profile or "default", _wake_kinds, + ) + except Exception as _wk_err: + logger.debug( + "kanban notifier: wakeup injection failed for %s: %s", + sub["task_id"], _wk_err, + ) if task_terminal: await asyncio.to_thread( self._kanban_unsub, sub, board_slug, diff --git a/gateway/run.py b/gateway/run.py index ceaefd9a830c..b4b90b32b6bd 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -13544,6 +13544,7 @@ def _set_session_env(self, context: SessionContext) -> list: user_name=str(context.source.user_name) if context.source.user_name else "", session_key=context.session_key, message_id=str(context.source.message_id) if context.source.message_id else "", + profile=getattr(context.source, "profile", "") or "", async_delivery=_async_delivery, ) diff --git a/gateway/session_context.py b/gateway/session_context.py index 55f269df54db..276e21eb919c 100644 --- a/gateway/session_context.py +++ b/gateway/session_context.py @@ -62,6 +62,8 @@ # private-chat topic (those lanes route only with thread id + reply anchor). _SESSION_MESSAGE_ID: ContextVar = ContextVar("HERMES_SESSION_MESSAGE_ID", default=_UNSET) +_SESSION_PROFILE: ContextVar = ContextVar("HERMES_SESSION_PROFILE", default=_UNSET) + # Whether the current session's delivery channel can route an ASYNC completion # back to the agent AFTER the current turn ends (i.e. wake a fresh turn). # @@ -100,6 +102,7 @@ "HERMES_SESSION_KEY": _SESSION_KEY, "HERMES_SESSION_ID": _SESSION_ID, "HERMES_SESSION_MESSAGE_ID": _SESSION_MESSAGE_ID, + "HERMES_SESSION_PROFILE": _SESSION_PROFILE, "HERMES_CRON_AUTO_DELIVER_PLATFORM": _CRON_AUTO_DELIVER_PLATFORM, "HERMES_CRON_AUTO_DELIVER_CHAT_ID": _CRON_AUTO_DELIVER_CHAT_ID, "HERMES_CRON_AUTO_DELIVER_THREAD_ID": _CRON_AUTO_DELIVER_THREAD_ID, @@ -132,6 +135,7 @@ def set_session_vars( session_key: str = "", session_id: str = "", message_id: str = "", + profile: str = "", cwd: str = "", async_delivery: bool = True, ) -> list: @@ -161,6 +165,7 @@ def set_session_vars( _SESSION_KEY.set(session_key), _SESSION_ID.set(session_id), _SESSION_MESSAGE_ID.set(message_id), + _SESSION_PROFILE.set(profile), _SESSION_ASYNC_DELIVERY.set(bool(async_delivery)), ] try: @@ -194,6 +199,7 @@ def clear_session_vars(tokens: list) -> None: _SESSION_KEY, _SESSION_ID, _SESSION_MESSAGE_ID, + _SESSION_PROFILE, ): var.set("") # Reset async-delivery capability to the "never set" sentinel rather than a diff --git a/locales/af.yaml b/locales/af.yaml index ece46799d98a..33c1ebde4fcc 100644 --- a/locales/af.yaml +++ b/locales/af.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(ingeteken — jy sal in kennis gestel word wanneer {task_id} voltooi of vasval)" truncated_suffix: "… (afgekap; gebruik `hermes kanban …` in jou terminale vir volle uitvoer)" no_output: "(geen uitvoer)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "Geen persoonlikhede opgestel in `{path}/config.yaml` nie" diff --git a/locales/de.yaml b/locales/de.yaml index 154268e60dde..fa98011be3d7 100644 --- a/locales/de.yaml +++ b/locales/de.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(abonniert — Sie werden benachrichtigt, wenn {task_id} abgeschlossen oder blockiert wird)" truncated_suffix: "… (gekürzt; verwenden Sie `hermes kanban …` im Terminal für die vollständige Ausgabe)" no_output: "(keine Ausgabe)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "Keine Persönlichkeiten in `{path}/config.yaml` konfiguriert" diff --git a/locales/en.yaml b/locales/en.yaml index a8a132622f44..11780493a33d 100644 --- a/locales/en.yaml +++ b/locales/en.yaml @@ -164,6 +164,15 @@ gateway: subscribed_suffix: "(subscribed — you'll be notified when {task_id} completes or blocks)" truncated_suffix: "… (truncated; use `hermes kanban …` in your terminal for full output)" no_output: "(no output)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "No personalities configured in `{path}/config.yaml`" diff --git a/locales/es.yaml b/locales/es.yaml index 128f371fb1bf..3840a452e71c 100644 --- a/locales/es.yaml +++ b/locales/es.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(suscrito — recibirás una notificación cuando {task_id} termine o se bloquee)" truncated_suffix: "… (truncado; usa `hermes kanban …` en tu terminal para la salida completa)" no_output: "(sin salida)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "No hay personalidades configuradas en `{path}/config.yaml`" diff --git a/locales/fr.yaml b/locales/fr.yaml index 692c71221fb0..967748c40aab 100644 --- a/locales/fr.yaml +++ b/locales/fr.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(abonné — vous serez notifié lorsque {task_id} se terminera ou sera bloqué)" truncated_suffix: "… (tronqué ; utilisez `hermes kanban …` dans votre terminal pour la sortie complète)" no_output: "(aucune sortie)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "Aucune personnalité configurée dans `{path}/config.yaml`" diff --git a/locales/ga.yaml b/locales/ga.yaml index cdacf94312a8..1c2d9d462b6e 100644 --- a/locales/ga.yaml +++ b/locales/ga.yaml @@ -153,6 +153,15 @@ gateway: subscribed_suffix: "(síntiúsaithe — cuirfear in iúl duit nuair a chríochnóidh nó a stopfaidh {task_id})" truncated_suffix: "… (giorraithe; úsáid `hermes kanban …` i do theirminéal le haghaidh aschur iomláin)" no_output: "(gan aschur)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "Níl aon phearsantachtaí cumraithe in `{path}/config.yaml`" diff --git a/locales/hu.yaml b/locales/hu.yaml index fec8aac766fc..f993b764c8e9 100644 --- a/locales/hu.yaml +++ b/locales/hu.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(feliratkozva — értesítést kapsz, ha a {task_id} befejeződik vagy elakad)" truncated_suffix: "… (csonkítva; használd a `hermes kanban …` parancsot a terminálban a teljes kimenethez)" no_output: "(nincs kimenet)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "Nincs személyiség beállítva itt: `{path}/config.yaml`" diff --git a/locales/it.yaml b/locales/it.yaml index 5e17a835f48f..0540f30fd9e5 100644 --- a/locales/it.yaml +++ b/locales/it.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(iscritto — riceverai notifica quando {task_id} verrà completato o si bloccherà)" truncated_suffix: "… (troncato; usa `hermes kanban …` nel terminale per l'output completo)" no_output: "(nessun output)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "Nessuna personalità configurata in `{path}/config.yaml`" diff --git a/locales/ja.yaml b/locales/ja.yaml index b6d9a9575884..3cd7b6da0b14 100644 --- a/locales/ja.yaml +++ b/locales/ja.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(購読しました — {task_id} が完了またはブロックされたときに通知されます)" truncated_suffix: "… (切り詰めました; 完全な出力にはターミナルで `hermes kanban …` を使用してください)" no_output: "(出力なし)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "`{path}/config.yaml` に人格が設定されていません" diff --git a/locales/ko.yaml b/locales/ko.yaml index f07d22837add..a7d0ee63d79a 100644 --- a/locales/ko.yaml +++ b/locales/ko.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(구독 중 — {task_id}이(가) 완료되거나 차단되면 알림을 받습니다)" truncated_suffix: "… (잘림; 전체 출력을 보려면 터미널에서 `hermes kanban …`을 사용하세요)" no_output: "(출력 없음)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "`{path}/config.yaml`에 구성된 성격이 없습니다" diff --git a/locales/pt.yaml b/locales/pt.yaml index 5be22d90b1e7..e6796cd17f76 100644 --- a/locales/pt.yaml +++ b/locales/pt.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(subscrito — receberás uma notificação quando {task_id} terminar ou bloquear)" truncated_suffix: "… (truncado; usa `hermes kanban …` no teu terminal para a saída completa)" no_output: "(sem saída)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "Nenhuma personalidade configurada em `{path}/config.yaml`" diff --git a/locales/ru.yaml b/locales/ru.yaml index ca5617a4cc4d..52edfaddbeeb 100644 --- a/locales/ru.yaml +++ b/locales/ru.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(подписка оформлена — вы получите уведомление, когда {task_id} завершится или будет заблокирован)" truncated_suffix: "… (сокращено; используйте `hermes kanban …` в терминале для полного вывода)" no_output: "(нет вывода)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "В `{path}/config.yaml` не настроено ни одной личности" diff --git a/locales/tr.yaml b/locales/tr.yaml index 29bacf36ee4e..f3d7ee033bb7 100644 --- a/locales/tr.yaml +++ b/locales/tr.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(abone olundu — {task_id} tamamlandığında veya engellendiğinde bildirim alacaksınız)" truncated_suffix: "… (kısaltıldı; tam çıktı için terminalinizde `hermes kanban …` komutunu kullanın)" no_output: "(çıktı yok)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "`{path}/config.yaml` içinde yapılandırılmış kişilik yok" diff --git a/locales/uk.yaml b/locales/uk.yaml index 1e20ec7b6ca7..9eab5b3580ba 100644 --- a/locales/uk.yaml +++ b/locales/uk.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(підписано — ви отримаєте сповіщення, коли {task_id} завершиться або буде заблоковано)" truncated_suffix: "… (скорочено; використовуйте `hermes kanban …` у терміналі для повного виводу)" no_output: "(немає виводу)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "У `{path}/config.yaml` не налаштовано жодної особистості" diff --git a/locales/zh-hant.yaml b/locales/zh-hant.yaml index a7aae1adb8ac..eec2cce3316c 100644 --- a/locales/zh-hant.yaml +++ b/locales/zh-hant.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(已訂閱 — 當 {task_id} 完成或被封鎖時將通知您)" truncated_suffix: "…(已截斷;如需完整輸出請在終端機執行 `hermes kanban …`)" no_output: "(無輸出)" + wake: + completed: "completed" + gave_up: "gave up (retries exhausted)" + crashed: "crashed (worker exited); dispatcher will retry" + timed_out: "timed out; dispatcher will retry" + blocked: "blocked; needs attention" + status_default: "status changed" + status_joiner: ", " + message: "[kanban] Task {task_id} {status}.\nTitle: {title}\nAssignee: @{assignee}\nBoard: {board}\n\nCheck the result or decide the next step." personality: none_configured: "`{path}/config.yaml` 中未設定人格" diff --git a/locales/zh.yaml b/locales/zh.yaml index 7f9789ee3be4..880acccb9b70 100644 --- a/locales/zh.yaml +++ b/locales/zh.yaml @@ -149,6 +149,15 @@ gateway: subscribed_suffix: "(已订阅 — 当 {task_id} 完成或被阻塞时将通知您)" truncated_suffix: "…(已截断;如需完整输出请在终端运行 `hermes kanban …`)" no_output: "(无输出)" + wake: + completed: "已完成" + gave_up: "已放弃(重试次数耗尽)" + crashed: "崩溃(worker 异常退出),dispatcher 将重试" + timed_out: "超时,dispatcher 将重试" + blocked: "被阻塞,需要处理" + status_default: "状态变化" + status_joiner: "," + message: "[kanban] 任务 {task_id} {status}。\n标题: {title}\n执行者: @{assignee}\n看板: {board}\n\n请检查结果或决定下一步动作。" personality: none_configured: "`{path}/config.yaml` 中未配置人格设定" diff --git a/tools/kanban_tools.py b/tools/kanban_tools.py index c78317f63f88..c8c7e0e6f8b8 100644 --- a/tools/kanban_tools.py +++ b/tools/kanban_tools.py @@ -947,7 +947,10 @@ def _maybe_auto_subscribe(conn: Any, task_id: str) -> bool: chat_id = session_key thread_id = get_session_env("HERMES_SESSION_THREAD_ID", "") or None user_id = get_session_env("HERMES_SESSION_USER_ID", "") or None - notifier_profile = os.environ.get("HERMES_PROFILE") + notifier_profile = ( + get_session_env("HERMES_SESSION_PROFILE", "") + or os.environ.get("HERMES_PROFILE") + ) # Lazy-import to keep the module-level dependency light from hermes_cli import kanban_db as _kb