Skip to content

fix(approval): restore session approval tier for tirith-flagged prompts (salvage #67312) - #68664

Merged
teknium1 merged 3 commits into
mainfrom
hermes/hermes-d6afde3b
Jul 21, 2026
Merged

fix(approval): restore session approval tier for tirith-flagged prompts (salvage #67312)#68664
teknium1 merged 3 commits into
mainfrom
hermes/hermes-d6afde3b

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

Summary

Pure-tirith approval prompts regain the Session tier on every messaging platform, and Matrix gains a dedicated session reaction (🌀) — salvaged from @faikwo's #67312 onto current main.

Before #68597, allow_permanent=False (any tirith finding) collapsed platform button sets to Once/Deny-adjacent shapes even though the persistence layer fully supports session-scoped approval of tirith keys. #68597 fixed the Always tier for mixed prompts; this PR adds the missing Session dimension @faikwo identified: a separate allow_session capability flag so adapters render the session tier independently of the permanent tier.

Changes

  • tools/approval.py: allow_session added to all three gateway notify payloads (dangerous-command guard, plugin-escalation gate, execute_code guard) — True except for Smart-DENY owner overrides
  • gateway/run.py: forwards allow_session to send_exec_approval and the plain-text fallback
  • plugins/platforms/matrix/adapter.py (@faikwo): 🌀 session reaction, reaction legend in the prompt, three-tier reaction seeding (once/session/always/deny)
  • Telegram, Discord, Slack, Feishu, Teams: Session button gated on allow_session; WhatsApp Cloud + qqbot accept the kwarg (no session tier in their button sets)
  • Tests: Matrix reaction-seeding contract updated to the new default four-reaction set, new tirith-tier and no-session-tier cases, payload assertion in test_command_guards.py

Validation

Prompt type Before After
Standard dangerous command Once / Session / Always / Deny unchanged
Pure-tirith finding (Matrix reactions) ✅ / ❌ only ✅ / 🌀 / ❌
Mixed pattern + tirith Once / Session / Always (#68597) unchanged
Smart-DENY owner override Once / Deny unchanged (allow_session=False)

Targeted tests: 472 passed across matrix/telegram/slack/feishu/discord approval suites + test_approval.py, test_command_guards.py, test_execute_code_approval_cluster.py. Live E2E: gateway payload carries both flags; Matrix reaction map resolves 🌀 → session.

Salvage of #67312@faikwo's commit is cherry-picked with authorship preserved; the cross-platform widening (Telegram/Discord/Slack/Feishu/Teams/WhatsApp/qqbot + the two extra payload sites) is a follow-up commit on top.

Infographic

Approval scope tiers

Joshua and others added 2 commits July 21, 2026 06:41
Adds an allow_session flag to the gateway approval payload so adapters
can render the session tier independently of the permanent tier. Matrix
gains a session reaction (🌀) and a reaction legend; pure-tirith prompts
now offer once/session/deny instead of collapsing to once/deny.

Salvaged from PR #67312, adapted to the allow_permanent semantics that
landed in #68597 (Always offered when any dangerous-pattern warning is
persistable; pure-tirith prompts stay session-max).
Widen the allow_session tier from Matrix to every adapter the gateway
notifies: Telegram, Discord, Slack, Feishu, and Teams gate their Session
button on it; WhatsApp Cloud and qqbot accept the kwarg (no session tier
in their button sets). Also thread allow_session through the plugin-
escalation gate, the execute_code guard payload, and the plain-text
fallback so every notify path carries the same capability flags.
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

running on 8904dd1

looks good to me!

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins platform/qqbot QQ Bot adapter platform/whatsapp WhatsApp Business adapter platform/discord Discord bot adapter platform/feishu Feishu / Lark adapter platform/matrix Matrix adapter (E2EE) platform/slack Slack app adapter platform/telegram Telegram bot adapter sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 21, 2026
…and gateway payload

Update the Matrix reaction-seeding contract to the four-reaction default
(once/session/always/deny), add tirith-tier (session without always) and
no-session-tier cases, and assert allow_session=True in the tirith
gateway payload.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins P2 Medium — degraded but workaround exists platform/discord Discord bot adapter platform/feishu Feishu / Lark adapter platform/matrix Matrix adapter (E2EE) platform/qqbot QQ Bot adapter platform/slack Slack app adapter platform/telegram Telegram bot adapter platform/whatsapp WhatsApp Business adapter sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants