Repository navigation
Conversation
Fail closed on stale or malformed native and relay sources, validate persisted resume state against live ownership, and keep generation-scoped response feedback bounded across delivery lanes. Preserve the reviewed portability fixes and undici security update in the frozen successor candidate.
There was a problem hiding this comment.
Pull request overview
This PR hardens the gateway’s authorization and resume behavior by introducing process-local source provenance (fail-closed on copied/mutated/stale sources), validating relay resume context against the live transport/epoch/profile, and propagating a single per-response identity across all delivery lanes. It also includes portability-related test fixes and an undici security bump for the TUI.
Changes:
- Add a process-local
SourceProvenanceRegistryand relay authenticated-epoch model to bind authorization to the exact inbound transport/source object (and revoke on copy/mutation/stale epoch). - Introduce
response_generationas a canonical per-turn/per-response identifier and thread it through streaming, media delivery, typing/status, and proxy paths. - Tighten Discord channel policy handling (explicit deny wins), improve noninteractive git env behavior under WSL, and expand/adjust tests to cover the new invariants.
Reviewed changes
Copilot reviewed 40 out of 41 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ui-tui/package.json | Bumps undici to 6.28.0. |
| package-lock.json | Locks undici 6.28.0 resolution/integrity. |
| hermes_cli/_subprocess_compat.py | Extends noninteractive_git_env() to propagate GCM_INTERACTIVE into Windows helpers under WSL via WSLENV. |
| gateway/turn_context.py | Adds response_generation to turn context. |
| gateway/platforms/base.py | Introduces per-response _response_generation, canonical metadata helper, and adapter-owned source provenance registry. |
| gateway/platforms/webhook.py | Uses _profile_override during source construction for webhook events (avoids post-mutation). |
| gateway/stream_consumer.py | Adds response_generation plumb-through and stamps _response_generation on all stream sends (including draft frames). |
| gateway/source_provenance.py | New module implementing identity+fingerprint-based provenance tracking for dataclass sources. |
| gateway/session.py | Validates persisted SessionSource fields strictly; adds transport_route and scope/guild alias validation. |
| gateway/authz_mixin.py | Reworks auth decisions to require live transport provenance (native + relay) and adds Discord-specific transport-bound checks. |
| gateway/relay/ws_transport.py | Validates inbound relay payloads, tracks authenticated epoch, isolates malformed frames, and binds relay sources to provenance/epoch. |
| gateway/relay/adapter.py | Strips private metadata before relay serialization, generation-scopes auto-thread feedback, and tightens passthrough provenance. |
| plugins/platforms/discord/adapter.py | Makes ignored channels an explicit deny in _discord_channel_ids_allowed and adds _discord_channel_ids_ignored. |
| agent/lsp/workspace.py | Prevents treating the system temp root as a git worktree (but preserves nested temp repos). |
| tests/tools/test_termux_api_detection.py | Stabilizes environment detection by neutralizing audio/WSL/container probes and mocking /proc read. |
| tests/tools/test_execution_flag_detection.py | Improves cross-platform robustness (darwin gsort, util-linux script gating) and reduces sort workload. |
| tests/hermes_cli/test_noninteractive_git.py | Adds coverage for preserving cached credential-helper config and WSL WSLENV behavior; isolates E2E git env. |
| tests/gateway/test_webhook_signature_rate_limit.py | Adds profile-scoped webhook provenance immutability check. |
| tests/gateway/test_voice_command.py | Adds helper for legacy mocks and expands Discord voice authorization/provenance coverage. |
| tests/gateway/test_stream_consumer.py | Adds assertions that all send lanes carry canonical _response_generation. |
| tests/gateway/test_stream_consumer_draft.py | Ensures draft and fresh-final paths preserve _response_generation across frames and preference probes. |
| tests/gateway/test_session.py | Adds tests for scope/guild alias validation and fail-closed behavior. |
| tests/gateway/test_send_voice_reply_notify.py | Ensures auto-TTS voice reply metadata includes _response_generation. |
| tests/gateway/test_restart_resume_pending.py | Adds extensive relay resume validation coverage and asserts response generation UUID behavior. |
| tests/gateway/test_relay_upstream_authz.py | Expands relay trust model tests (copy/mutation/epoch revocation; channel policy precedence). |
| tests/gateway/test_queued_native_image_session_key.py | Ensures queued native image follow-ups use the pending event’s response generation. |
| tests/gateway/test_proxy_mode.py | Hardens aiohttp patching approach and asserts proxy path preserves response_generation. |
| tests/gateway/test_post_stream_media_delivery.py | Verifies post-stream media + runtime footer lanes preserve _response_generation. |
| tests/gateway/test_multiplex_profile_authz.py | Ensures Discord adapter auth checks attach concrete transport provenance under multiplexing. |
| tests/gateway/test_multiplex_http_routing.py | Tightens non-Discord chat_type/profile roundtrip and validates malformed chat_type fail-closed. |
| tests/gateway/test_multiplex_adapter_registry.py | Ensures secondary sources are profiled before provenance registration in adapter handlers. |
| tests/gateway/test_discord_bot_auth_bypass.py | Updates tests to use real DiscordAdapter-built sources (transport provenance). |
| tests/gateway/test_clarify_progress_leak.py | Asserts clarify path sends include _response_generation in metadata. |
| tests/gateway/test_authz_multiplex_scope_isolation.py | Expands scope-isolation tests and adds Discord channel/user/role/bot grant invariants. |
| tests/gateway/relay/test_ws_transport.py | Adds epoch revocation and malformed-frame isolation coverage. |
| tests/gateway/relay/test_relay_threads.py | Adds generation-scoped feedback tests and private-metadata stripping assertions. |
| tests/gateway/relay/test_relay_slack_prompt_dm_root.py | Adds deep provenance/epoch/callback/transport mutation denial coverage through Slack DM normalization. |
| tests/gateway/relay/test_relay_passthrough.py | Ensures passthrough sources require live epoch/registry and authorize only when bound. |
| tests/agent/lsp/test_workspace.py | Adds tests for temp-root boundary behavior and symlink alias handling. |
| tests/agent/lsp/test_install_and_lint_fixes.py | Prevents LSP short-circuiting the direct tsc branch in this test. |
| gateway/run.py | Threads response_generation through agent execution and related delivery paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 250cd865c6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if source.platform != Platform.DISCORD: | ||
| return None |
There was a problem hiding this comment.
Allow relay resume for every fronted platform
When a resume-pending session came from any relay-fronted platform other than Discord (for example Slack, which the relay wire path stamps as platform=slack plus transport_route=relay), this guard returns None before the existing fronts_platform() check can validate the live relay adapter. _schedule_resume_pending_sessions then skips the entry as unreconstructable, so interrupted Slack/Telegram relay conversations are not auto-resumed after restart and remain pending until the user sends another message.
Useful? React with 👍 / 👎.
|
v12.5 final candidate pushed.
No installation or activation is represented by this PR update. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 893ecefc8f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| source = entry.origin | ||
| adapter = self._adapter_for_source(source) | ||
| adapter = self._candidate_adapter_for_restored_source(source) |
There was a problem hiding this comment.
Include relay-routed sessions in relay reconnect resumes
When this method is called from the reconnect block with platform == Platform.RELAY, the candidates list above still filters on entry.origin.platform == platform. Persisted relay sessions keep origin.platform as the underlying platform (Slack/Discord/etc.) and only mark transport_route == "relay", so if the RelayAdapter was not ready during startup and connects later, this new restored-source path never runs for those sessions and their resume_pending turns are left stuck until a user sends another message.
Useful? React with 👍 / 👎.
Summary
undici6.28.0 security update.Exact scope fence
a16f6828bfa8d0dd71704f60064bb1ad1a10d9be250cd865c669c0ca590b39f1e7efa4ded81e124eb11ee9f7e6bfefbb77863208f9134aaec374be4d626e46a743abc87be27b079fThis fork review PR intentionally targets the pinned snapshot branch
update/hermes-20260803-baseso the PR contains only the exact reviewed candidate. Current upstreammainhas diverged substantially. Do not retarget or merge this PR into sharedmainwithout a separate semantic rebase, refreeze, full verification, and fresh independent review.Verification
Public notarization was not performed because Apple notarization credentials were not configured.
Activation status
No installation, runtime restart, deployment, shared-main mutation, or successor activation was performed. Activation remains a separate owner-approved gate with rollback artifacts and fresh running-revision probes.