Skip to content

feat(gateway): add recoverable mobile approvals - #63197

Draft
ericlewis wants to merge 17 commits into
NousResearch:mainfrom
ericlewis:codex/mobile-contract-approval-sync
Draft

feat(gateway): add recoverable mobile approvals#63197
ericlewis wants to merge 17 commits into
NousResearch:mainfrom
ericlewis:codex/mobile-contract-approval-sync

Conversation

@ericlewis

Copy link
Copy Markdown

Summary

  • give gateway approvals stable Hermes-owned identities, redacted lifecycle descriptors, expiry/state/resolution metadata, and short-lived terminal tombstones
  • synchronize pending approvals into authoritative resume snapshots and publish matching terminal events
  • add mobile-scoped, ID-targeted approval.respond with durable client_request_id receipts, stable lineage validation, replay/conflict semantics, and exact out-of-FIFO resolution
  • preserve existing ID-less desktop/stdin FIFO behavior and fail closed on missing mobile choice, scope, lineage, or resource identity
  • guarantee tombstone TTL cleanup with one coalesced generation-protected timer

Stack / review order

This integration branch intentionally combines the foundations under:

  1. feat(gateway): negotiate scoped WebSocket grants #62858 — versioned hello and scoped WebSocket grants
  2. feat(gateway): add revisioned conversation sync #63149 — revisioned snapshots and replay
  3. feat(gateway): persist mobile mutation receipts #63190 — durable mobile mutation receipts

Approval recovery depends on all three seams, so this PR is the end-to-end integration review for the approval slice. It should remain draft until those foundations are reconciled.

Cuttle contract tracking: https://github.com/ericlewis/cuttle/issues/5
Parent contract: https://github.com/ericlewis/cuttle/issues/1

Safety and compatibility

  • approval presentation and resolution metadata are recursively redacted server-side
  • mobile responses require conversation.control, exact approval_id, durable client_request_id, and stable expected_stored_session_id
  • omitted or blank mobile choices are rejected before receipt reservation or resolution
  • duplicate IDs replay; changed semantics conflict; abandoned outcomes never auto-reexecute
  • existing legacy ID-less FIFO and all behavior is unchanged

Validation

  • 139 passed — focused approval identity + mobile contract/sync/mutation suites
  • 732 passed — every test file changed by this branch relative to the revisioned-sync base
  • Ruff passed on all changed Python files
  • git diff --check passed
  • two independent standards/spec reviews completed with no remaining findings

Eight existing async-mock warnings remain in QQ/Slack adapter tests; there were no failures.

ericlewis and others added 17 commits July 12, 2026 07:27
Port mr.Shu’s upstream exact-request binding onto the current gateway architecture.

Assign Hermes-owned approval IDs with redacted lifecycle descriptors, finite expiry, terminal metadata, and short-lived tombstones. Preserve legacy FIFO/all callers while making targeted late, duplicate, stale, expired, invalid, and unknown outcomes deterministic.

Propagate the core identity through the gateway notify seam and every current approval surface: Slack, Telegram, Feishu, Discord, Matrix, QQBot, WhatsApp Cloud, and Teams. Keep each platform’s current authorization checks and prevent raw secret-shaped prompt data from crossing those boundaries.
@alt-glitch alt-glitch added type/feature New feature or request comp/gateway Gateway runner, session dispatch, delivery comp/dashboard Web dashboard / control panel UI (dashboard/, landing) area/auth Authentication, OAuth, credential pools P3 Low — cosmetic, nice to have sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state labels Jul 12, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the detailed approval-recovery work. The underlying premise remains valid on current main: tools/approval.py:1551-1568 still resolves the oldest pending approval by FIFO, and tui_gateway/server.py:10269-10286 exposes only that ID-less path. The PR’s exact-ID resolver at tools/approval.py:1800-1881 directly addresses that gap.

The branch is currently a conflicting draft (gh api repos/NousResearch/hermes-agent/pulls/63197 reports mergeable: false, rebaseable: false), while current tui_gateway/server.py, approval handling, and gateway transport code have materially moved. Salvage should therefore be treated as a fresh integration against HEAD, with the existing contract tests retained as behavioral targets rather than relying on a mechanical cherry-pick.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/auth Authentication, OAuth, credential pools comp/dashboard Web dashboard / control panel UI (dashboard/, landing) comp/gateway Gateway runner, session dispatch, delivery P3 Low — cosmetic, nice to have sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit sweeper:risk-caching Sweeper risk: may break/degrade prompt caching or cache-key stability (invariant) sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants