The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(gateway): /debug local from a chat is refused, never uploaded
Teknium025745d5624c
diff --git a/gateway/slash_commands.py b/gateway/slash_commands.pyindex 28936959b36..61abb479191 100644--- a/gateway/slash_commands.py+++ b/gateway/slash_commands.py@@ -1271,8 +1271,12 @@ class GatewaySlashCommandsMixin(collect_debug_report, upload_to_pastebin)from hermes_cli.debug_redaction import redact_debug_support_text- if (getattr(event.source, "platform", None) == Platform.LOCAL- and "local" in {w.lower() for w in (event.get_command_args() or "").split()}):+ wants_local = "local" in {w.lower() for w in (event.get_command_args() or "").split()}+ if wants_local and getattr(event.source, "platform", None) != Platform.LOCAL:+ # From a chat the report can't stay on the machine; `/debug local` must never fall+ # through to the public paste. Bare `/debug` is the upload form.+ return t("gateway.debug.local_refused")+ if wants_local:# A local session's `/debug local` (main's CLI form) asks for the report on this machine:# return the redacted report for the client to show, with no network call at all (not# even the expired-paste sweep). Uploading stays on the explicit `/debug` form (T7).diff --git a/locales/af.yaml b/locales/af.yamlindex c83eee703f8..b132a8fa638 100644--- a/locales/af.yaml+++ b/locales/af.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "Vir volledige loglae, gebruik `hermes debug share` vanaf die CLI."share_hint: "Deel hierdie skakels met die Hermes-span vir ondersteuning."report_label: "Verslag"+ local_refused: "`/debug local` hou die verslag op die masjien waarop Hermes loop, so dit is nie vanuit 'n klets beskikbaar nie. Stuur `/debug` om die opsommingsverslag op te laai."deny:stale: "❌ Opdrag geweier (goedkeuring was verouderd)."no_pending: "Geen hangende opdrag om te weier nie."diff --git a/locales/ar.yaml b/locales/ar.yamlindex 0ba1fc9f198..167651483b6 100644--- a/locales/ar.yaml+++ b/locales/ar.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "لرفع السجلات الكاملة، استخدم `hermes debug share` من واجهة الأوامر."share_hint: "شارك هذه الروابط مع فريق Hermes للحصول على الدعم."report_label: "تقرير"+ local_refused: "يُبقي `/debug local` التقرير على الجهاز الذي يشغّل Hermes، لذا فهو غير متاح من المحادثة. أرسل `/debug` لرفع التقرير الموجز."deny:stale: "❌ رُفض الأمر (الموافقة كانت قديمة)."no_pending: "لا يوجد أمر معلّق لرفضه."diff --git a/locales/de.yaml b/locales/de.yamlindex 96a2f9bf105..41f413947b8 100644--- a/locales/de.yaml+++ b/locales/de.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "Für vollständige Log-Uploads verwenden Sie `hermes debug share` aus der CLI."share_hint: "Teilen Sie diese Links mit dem Hermes-Team, um Unterstützung zu erhalten."report_label: "Bericht"+ local_refused: "`/debug local` behält den Bericht auf dem Rechner, auf dem Hermes läuft, und ist daher im Chat nicht verfügbar. Senden Sie `/debug`, um den Kurzbericht hochzuladen."deny:stale: "❌ Befehl abgelehnt (Genehmigung war veraltet)."no_pending: "Kein ausstehender Befehl zum Ablehnen."diff --git a/locales/en.yaml b/locales/en.yamlindex 1a773037e49..1d7779246bc 100644--- a/locales/en.yaml+++ b/locales/en.yaml@@ -167,6 +167,7 @@ gateway:full_logs_hint: "For full log uploads, use `hermes debug share` from the CLI."share_hint: "Share these links with the Hermes team for support."report_label: "Report"+ local_refused: "`/debug local` keeps the report on the machine running Hermes, so it isn't available from a chat. Send `/debug` to upload the summary report."deny:stale: "❌ Command denied (approval was stale)."no_pending: "No pending command to deny."diff --git a/locales/es.yaml b/locales/es.yamlindex 25835352ec1..9782218a200 100644--- a/locales/es.yaml+++ b/locales/es.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "Para subir registros completos, usa `hermes debug share` desde la CLI."share_hint: "Comparte estos enlaces con el equipo de Hermes para obtener soporte."report_label: "Informe"+ local_refused: "`/debug local` mantiene el informe en la máquina donde se ejecuta Hermes, así que no está disponible desde un chat. Envía `/debug` para subir el informe resumido."deny:stale: "❌ Comando denegado (la aprobación había caducado)."no_pending: "No hay ningún comando pendiente que denegar."diff --git a/locales/fr.yaml b/locales/fr.yamlindex 13b40dd9455..789f0f57dc5 100644--- a/locales/fr.yaml+++ b/locales/fr.yaml@@ -190,6 +190,7 @@ gateway:full_logs_hint: "Pour envoyer les journaux complets, utilisez `hermes debug share` depuis la CLI."share_hint: "Partagez ces liens avec l'équipe Hermes pour obtenir de l'aide."report_label: "Rapport"+ local_refused: "`/debug local` garde le rapport sur la machine qui exécute Hermes ; il n'est donc pas disponible depuis une discussion. Envoyez `/debug` pour téléverser le rapport de synthèse."deny:stale: "❌ Commande refusée (l'approbation était périmée)."no_pending: "Aucune commande en attente de refus."diff --git a/locales/ga.yaml b/locales/ga.yamlindex 85f5164f5c2..70b2da3e221 100644--- a/locales/ga.yaml+++ b/locales/ga.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "Le haghaidh uaslódálacha logála iomlána, úsáid `hermes debug share` ón CLI."share_hint: "Roinn na naisc seo le foireann Hermes le haghaidh tacaíochta."report_label: "Tuairisc"+ local_refused: "Coinníonn `/debug local` an tuarascáil ar an meaisín a ritheann Hermes, mar sin níl sé ar fáil ó chomhrá. Seol `/debug` chun an achoimre a uaslódáil."deny:stale: "❌ Ordú diúltaithe (bhí an cead imithe i léig)."no_pending: "Níl aon ordú ag fanacht le diúltú."diff --git a/locales/hu.yaml b/locales/hu.yamlindex d73ed002d51..22c4fdbe96c 100644--- a/locales/hu.yaml+++ b/locales/hu.yaml@@ -167,6 +167,7 @@ gateway:full_logs_hint: "Teljes naplók feltöltéséhez használd a `hermes debug share` parancsot a CLI-ből."share_hint: "Oszd meg ezeket a hivatkozásokat a Hermes csapattal támogatásért."report_label: "Jelentés"+ local_refused: "A `/debug local` azon a gépen tartja a jelentést, amelyen a Hermes fut, ezért csevegésből nem érhető el. Küldd el a `/debug` parancsot az összefoglaló jelentés feltöltéséhez."deny:stale: "❌ Parancs elutasítva (a jóváhagyás elavult)."no_pending: "Nincs elutasítható függőben lévő parancs."diff --git a/locales/it.yaml b/locales/it.yamlindex 23ed9d57f78..ee0d3ea87b6 100644--- a/locales/it.yaml+++ b/locales/it.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "Per il caricamento dei log completi, usa `hermes debug share` dalla CLI."share_hint: "Condividi questi link con il team Hermes per ricevere supporto."report_label: "Report"+ local_refused: "`/debug local` mantiene il report sulla macchina che esegue Hermes, quindi non è disponibile da una chat. Invia `/debug` per caricare il report riepilogativo."deny:stale: "❌ Comando negato (l'approvazione era obsoleta)."no_pending: "Nessun comando in attesa da negare."diff --git a/locales/ja.yaml b/locales/ja.yamlindex 992246f9d74..d9ea8cf408d 100644--- a/locales/ja.yaml+++ b/locales/ja.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "完全なログのアップロードには、CLI から `hermes debug share` を使用してください。"share_hint: "サポートを受けるには、このリンクを Hermes チームに共有してください。"report_label: "レポート"+ local_refused: "`/debug local` はレポートを Hermes を実行しているマシン上に保持するため、チャットからは使えません。要約レポートをアップロードするには `/debug` を送信してください。"deny:stale: "❌ コマンドを拒否しました (承認は期限切れでした)。"no_pending: "拒否待ちのコマンドはありません。"diff --git a/locales/ko.yaml b/locales/ko.yamlindex a76da7f4ff2..70ed148335b 100644--- a/locales/ko.yaml+++ b/locales/ko.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "전체 로그 업로드는 CLI에서 `hermes debug share`를 사용하세요."share_hint: "지원을 받으려면 이 링크를 Hermes 팀과 공유하세요."report_label: "리포트"+ local_refused: "`/debug local`은 보고서를 Hermes가 실행 중인 컴퓨터에만 보관하므로 채팅에서는 사용할 수 없습니다. 요약 보고서를 업로드하려면 `/debug`를 보내세요."deny:stale: "❌ 명령이 거부되었습니다 (승인이 만료됨)."no_pending: "거부 대기 중인 명령이 없습니다."diff --git a/locales/pt.yaml b/locales/pt.yamlindex 0656f7b0b41..9de08de3080 100644--- a/locales/pt.yaml+++ b/locales/pt.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "Para enviar logs completos, usa `hermes debug share` a partir da CLI."share_hint: "Partilha estes links com a equipa do Hermes para obter suporte."report_label: "Relatório"+ local_refused: "`/debug local` mantém o relatório na máquina que executa o Hermes, por isso não está disponível num chat. Envie `/debug` para enviar o relatório resumido."deny:stale: "❌ Comando negado (a aprovação tinha expirado)."no_pending: "Não há nenhum comando pendente para negar."diff --git a/locales/ru.yaml b/locales/ru.yamlindex 8002a2140f5..9504a082286 100644--- a/locales/ru.yaml+++ b/locales/ru.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "Для загрузки полных журналов используйте `hermes debug share` из CLI."share_hint: "Поделитесь этими ссылками с командой Hermes для получения поддержки."report_label: "Отчёт"+ local_refused: "`/debug local` оставляет отчёт на машине, где работает Hermes, поэтому недоступна из чата. Отправьте `/debug`, чтобы загрузить краткий отчёт."deny:stale: "❌ Команда отклонена (одобрение устарело)."no_pending: "Нет команды для отклонения."diff --git a/locales/tr.yaml b/locales/tr.yamlindex 6a6473c7429..7580ebb6e54 100644--- a/locales/tr.yaml+++ b/locales/tr.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "Tam günlük yüklemeleri için CLI'dan `hermes debug share` kullanın."share_hint: "Destek için bu bağlantıları Hermes ekibiyle paylaşın."report_label: "Rapor"+ local_refused: "`/debug local` raporu Hermes'in çalıştığı makinede tutar, bu yüzden sohbetten kullanılamaz. Özet raporu yüklemek için `/debug` gönderin."deny:stale: "❌ Komut reddedildi (onay geçersizdi)."no_pending: "Reddedilecek bekleyen komut yok."diff --git a/locales/uk.yaml b/locales/uk.yamlindex da3207f340b..aecc4818b5a 100644--- a/locales/uk.yaml+++ b/locales/uk.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "Щоб завантажити повні журнали, використайте `hermes debug share` з CLI."share_hint: "Поділіться цими посиланнями з командою Hermes для отримання підтримки."report_label: "Звіт"+ local_refused: "`/debug local` залишає звіт на машині, де працює Hermes, тому недоступна з чату. Надішліть `/debug`, щоб завантажити короткий звіт."deny:stale: "❌ Команду відхилено (схвалення застаріло)."no_pending: "Немає команди для відхилення."diff --git a/locales/zh-hant.yaml b/locales/zh-hant.yamlindex d2409716139..ffd0019d393 100644--- a/locales/zh-hant.yaml+++ b/locales/zh-hant.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "如需上傳完整紀錄,請在 CLI 中使用 `hermes debug share`。"share_hint: "請將這些連結分享給 Hermes 團隊以取得支援。"report_label: "報告"+ local_refused: "`/debug local` 會把報告留在執行 Hermes 的機器上,因此無法在聊天中使用。傳送 `/debug` 可上傳摘要報告。"deny:stale: "❌ 指令已拒絕(批准已過期)。"no_pending: "沒有待拒絕的指令。"diff --git a/locales/zh.yaml b/locales/zh.yamlindex ecb2348e2cf..8958d0dc887 100644--- a/locales/zh.yaml+++ b/locales/zh.yaml@@ -164,6 +164,7 @@ gateway:full_logs_hint: "如需上传完整日志,请在 CLI 中使用 `hermes debug share`。"share_hint: "请将这些链接分享给 Hermes 团队以获得支持。"report_label: "报告"+ local_refused: "`/debug local` 会把报告留在运行 Hermes 的机器上,因此无法在聊天中使用。发送 `/debug` 可上传摘要报告。"deny:stale: "❌ 命令已拒绝(批准已过期)。"no_pending: "没有待拒绝的命令。"diff --git a/tests/gateway/test_local_debug_never_uploads.py b/tests/gateway/test_local_debug_never_uploads.pyindex aa526cea203..64dc0325027 100644--- a/tests/gateway/test_local_debug_never_uploads.py+++ b/tests/gateway/test_local_debug_never_uploads.py@@ -2,7 +2,8 @@The messaging ``/debug`` handler ignored its argument and always uploaded the summary to a publicpaste. A local session's ``/debug local`` asks for the report on this machine: the gateway returns-the redacted report for the client to show and makes no network call. Messaging keeps its upload.+the redacted report for the client to show and makes no network call. From a messaging chat+``/debug local`` is refused and uploads nothing; bare ``/debug`` keeps the upload."""import socketfrom unittest.mock import patch@@ -66,11 +67,26 @@ async def test_messaging_debug_still_uploads_the_summary():patch('hermes_cli.debug._best_effort_sweep_expired_pastes', lambda: None), \patch('hermes_cli.debug._capture_dump', lambda: 'dump'), \patch('hermes_cli.debug.collect_debug_report', lambda **kw: 'SUMMARY'):- out = await _runner()._handle_debug_command(_event(Platform.TELEGRAM, '/debug local'))+ out = await _runner()._handle_debug_command(_event(Platform.TELEGRAM, '/debug'))assert uploaded == ['SUMMARY']assert 'https://paste.rs/x' in out+async def test_messaging_debug_local_is_refused_without_uploading():+ """``/debug local`` from a chat is a named refusal pointing at bare ``/debug``; nothing is uploaded."""+ guard = _NoNetwork()+ with patch('hermes_cli.debug.upload_to_pastebin', guard), \+ patch('hermes_cli.diagnostics_upload.share_to_nous', guard), \+ patch('hermes_cli.debug._schedule_auto_delete', guard), \+ patch('hermes_cli.debug._best_effort_sweep_expired_pastes', guard), \+ patch('hermes_cli.debug.collect_debug_report', guard), \+ patch.object(socket.socket, 'connect', guard):+ out = await _runner()._handle_debug_command(_event(Platform.TELEGRAM, '/debug local'))+ assert guard.calls == []+ assert '/debug' in out and 'http' not in out.lower()++@pytest.mark.asyncioasync def test_local_debug_local_real_collector_opens_no_socket(tmp_path, monkeypatch):"""The real collector, unpatched: no socket connect and no upload helper is reached."""