Все задачи

Изменение Hermes

feat(gateway): opt-in prompt-cache notifications and Telegram pin

Исходный PR автора в Hermes. Описание и обсуждение — на английском в источнике.

Это изменение Hermes из исходного PR. Статус и обсуждение доступны в исходном PR; включение в релиз проверяется отдельно.

Данные GitHub проверены:

Состояние PR

Открыт — предложение

Включение PR в релиз не проверено

Источник: GitHub

feat(gateway): opt-in prompt-cache notifications and Telegram pin

## Summary

Extend the prompt-cache visibility introduced in #161103 to messaging conversations. That foundational PR by @teknium1 added the shared cache deadline and CLI/TUI/Desktop indicators plus `/usage`. This PR reuses that clock; it does not implement another cache policy or warm the cache.

- `/usage cache notify`: opt-in state-change notifications.
- `/usage cache pinned`: one updated Telegram message, quietly pinned where permitted; falls back to notifications when pinning is unsupported or denied.
- `/usage cache off`: default; ordinary messaging remains unchanged.

Status is an estimate, not a provider cache-hit or billing guarantee. Unknown and cold are distinct. Text labels and timestamps make the status usable without relying on icons or color.

## Safety and lifecycle

- No model requests or model-context modifications for status updates.
- Session/profile/receiving-bot/chat/topic isolation and explicit group administrator authorization.
- Durable message claims avoid duplicate sends after ambiguous transport outcomes; this deliberately favors a missed notification over a duplicate.
- Bounded edit retries preserve server cooldowns and retry budgets across restart.
- Revalidate status and deadline after asynchronous persistence, before sending/editing; session-ID fencing prevents stale metadata writes across reset.
- Restore enabled transport slots without restart-only notification spam. Do not repeatedly pin messages users unpin; no replacement-pin loop after deletion.
- Side messages preserve native stream-final behavior. Shutdown cancels watchers. Errors remain isolated from normal replies.

## Verification

Independent review identified defects that were reproduced in regression tests, repaired, and independently re-reviewed with an ACCEPT verdict.

- Fresh independent canonical runner: 47 passed in four feature/Telegram files; 35 passed in four additional usage, multiplex, clock and stream-final files (82 total, no failures).
- Separate author/parent selected run: 92 passed, 2 failed including the shutdown file. The same two `test_start_gateway_turns_a_failed_stop_into_an_exit_verdict[stop/service_restart]` cases also fail on the pristine base (18 passed, 2 failed in that file). These are disclosed, not counted as green or repaired here.
- `scripts/check --base HEAD` on the pre-commit candidate: all 22 checks passed; boundary lint and `git diff --check` passed.
- Race/restart regression probes were demonstrated failing before their corresponding repairs, then passing.
- Tests use isolated session stores and fake transport effects through the real Telegram adapter. No live Telegram or provider test is claimed; upstream CI is pending.

## Privacy

Reviewed the complete 14-file candidate and scanned for secrets, private host paths and personal identifiers before publication. No runtime configuration, credentials, chat history, logs or local planning files are included. Commit uses a GitHub noreply identity.

Maintainer context: @teknium1 — this is a messaging-surface follow-up to your #161103, not a change to its warming behavior.
Изменённые файлы (14)
  • gateway/messaging_cache_indicator.py
  • gateway/platforms/base.py
  • gateway/run_bootstrap.py
  • gateway/run_shutdown.py
  • gateway/session.py
  • gateway/slash_commands_status.py
  • locales/en.yaml
  • plugins/platforms/telegram/adapter.py
  • plugins/platforms/telegram/message_pinning.py
  • tests/gateway/test_messaging_cache_final_review_races.py
  • tests/gateway/test_messaging_cache_indicator.py
  • tests/gateway/test_messaging_cache_review_probes.py
  • tests/plugins/test_messaging_cache_telegram.py
  • website/docs/user-guide/messaging/index.md

Открыть GitHub

Темы этого объекта

Помощь с этой задачей

Как устроены счётчики

Считаются открытия конкретных объектов и переходы на GitHub, не люди и не установки. Интересы остаются в браузере; в новом хранилище — только счётчики, IP используется кратковременно в памяти для ограничения запросов. Нет событий — нет заявления о популярности.

Политика конфиденциальности