Repository navigation
fix(discord): apply access policy during active Control UI turns - #140929
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 7, 2026, 3:18 AM ET / 07:18 UTC. ClawSweeper reviewWhat this changesDiscord reads newly published access policies without reconnecting during active Control UI turns, with updated admission checks, regression coverage, and documentation. Merge readiness✅ Ready for maintainer review The fix remains necessary on current main. No blocking patch defect was found, and the explicit maintainer decision resolves the earlier wildcard-contract concern. Priority: P0 Review scores
Verification
How this fits togetherThe Gateway validates configuration changes and publishes the runtime snapshot consumed by Discord. Discord uses that snapshot to decide whether incoming messages, interactions, and voice activity may enter agent workflows. flowchart TD
A[Control UI configuration save] --> B[Gateway validates change]
B --> C{Policy only?}
C -->|Yes| D[Publish runtime configuration]
C -->|No| E[Deferred channel restart]
D --> F[Discord admission checks]
G[Incoming Discord activity] --> F
F --> H[Admit or reject activity]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +539, Tests +1061, Docs +46. Total +1646 across 59 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Make saving access policy a dependable in-product recovery path while preserving atomic deferred publication for transport changes and the documented boundary for already admitted work. Do we have a high-confidence way to reproduce the issue? Yes: current-main restart classification and retained startup policy support the reported active-turn stall, and the supplied harness reports an intended baseline failure. This read-only review did not execute it. Is this the best way to solve the issue? Yes: the patch reuses validated runtime publication and existing account-policy helpers, with an explicitly approved reload contract and retained transport deferral. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 00fd5d6a4049. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
|
Maintainer decision: retain the documented single-segment wildcard reload contract. This implements the explicitly approved policy-publication change for #140550. The declaration is limited to the seven existing Discord policy fields; exact rules win at the same depth, and token, enablement, whole-account, and mixed transport/policy changes retain restart deferral. The classifier and active-work admission checks passed in Testbox. No new SDK exports or configuration options are introduced. The two CI failures are being corrected in a test-only follow-up: the provider fixture now keeps real account-policy exports, and the Gateway/Discord harness moves from the core-only test tree into |
a59a496 to
f3cd999
Compare
|
Merged via squash.
|
…nclaw#140929) * fix(discord): apply access policy during active Control UI turns * test(discord): keep live policy proof at the integration boundary * test(ci): validate tooling packing without fixed shard names
Related: #140550. Reported by @DonnieFi.
What Problem This Solves
Fixes an issue where users saved a Discord guild or user allowlist in the Control UI but the running bot continued to reject newly allowed messages while active Control UI turns deferred channel reload.
Why This Change Was Made
This implements the maintainer-approved contract change: policy-only writes publish through the existing validated runtime-config path without restarting Discord. The reload classifier treated account fields as restart-required, and Discord admission retained startup policy.
src/gateway/config-reload-plan.tsnow supports single-segment account wildcards;extensions/discord/src/shared.tsdeclares the dynamic fields; one account-owned reader inextensions/discord/src/monitor/live-policy.tssupplies current policy to message, command, component, reaction, presence, guild-join, and voice admission.The reader binds before startup awaits, caches name resolution, and rejects stale results before admission. Numeric guild/channel IDs skip unnecessary directory resolution. Deadline-bound interactions keep their existing initial-response behavior. The obsolete startup-only reaction-registration gate and constructor-only voice fields are removed. Existing prepared-policy and standalone native-command behavior remain supported.
Reading disk during manual start would bypass validated publication, and publishing transport changes during active work would break the retained drain contract. Token, proxy, intents, command registration, voice configuration, enablement, and mixed policy/transport writes therefore keep deferred atomic publication. No config options, dependencies, storage semantics, protocol versions, or SDK exports are added.
User Impact
Newly allowed traffic is admitted during active Control UI work without reconnecting the bot. Revocation prevents admission still awaiting metadata or pairing-store lookup; already admitted work retains its context. A slow name-policy lookup produces an explicit ephemeral component response or empty autocomplete choices. Discord, shared configuration, and plugin documentation describe this contract.
Evidence
blacksmith-testbox, leasetbx_01m1x41824da5qz3h22y5mtzk4, run. This is isolated synthetic boundary proof, not live Discord-service authentication.node scripts/check-changed.mjs --base origin/main: passed.git diff --check: passed. Independent Codex autoreview against merge base93562ca9054dea9eda853d9c527190a19e8581ec: scoped-clean through P2 after final changes.pnpm build: passed.OPENCLAW_LOCAL_CHECK=0 node --import tsx scripts/profile-extension-memory.mts --extension discord --skip-combined --concurrency 1: passed (379.4 MiB maximum RSS). The copied Gateway regression fails on baseline93562ca9054dea9eda853d9c527190a19e8581ecat “policy-only publication must not wait for the active turn”, then passes on this source. Exact head:f3cd999f484a4825252f7061899c770f7f63af6c.node scripts/run-vitest.mjs extensions/discord/src/monitor/provider.test.ts test/discord-live-policy.integration.test.ts test/extension-test-boundary.test.tspassed 53 tests, locally and in Testbox run 34092309439 (leasetbx_01m1x9w1haap5q6qw70qcfsvzd, stopped). The relocated harness uses actual Gateway work admission and fails at the same intended assertion on the original baseline.node scripts/check-changed.mjs --base HEADpassed before the follow-up commit; independent review of the follow-up is clean through P2. Production source is unchanged from the full build/profile proof.node scripts/run-vitest.mjs test/scripts/ci-node-test-plan.test.ts test/discord-live-policy.integration.test.ts extensions/discord/src/channel.test.ts: 89 passed after a clean rebase toa325c39220f1c114c61b1ce15d85dec603ba2d2d. The test-only correction passed independent review and changed-file checks after installing main’s committed dependencies. No production CI change.f3cd999f484a4825252f7061899c770f7f63af6c: run 34094259868. The earlier provider/boundary and inventory-dependent test failures are resolved.Release-note context: Discord access-policy edits apply during active Control UI work without reconnecting the channel; transport changes preserve validated deferred publication.
Exact focused Testbox commands
node scripts/run-vitest.mjs src/gateway/config-reload.test.ts src/gateway/server-reload-handlers.test.ts -t 'honors per-account dynamic policy paths|admits newly allowed Discord messages|defers channel hot reload until active embedded work drains|uses the default channel reload deferral timeout' node scripts/run-vitest.mjs extensions/discord/src/channel.test.ts extensions/discord/src/monitor/live-policy.test.ts extensions/discord/src/monitor/listeners.presence.test.ts extensions/discord/src/monitor/listeners.guild-join.test.ts extensions/discord/src/monitor/provider.allowlist.test.ts extensions/discord/src/monitor/provider.startup.test.ts extensions/discord/src/monitor.test.ts extensions/discord/src/monitor/agent-components.live-policy-deadline.test.ts extensions/discord/src/monitor/monitor.agent-components.test.ts extensions/discord/src/monitor/questions.test.ts extensions/discord/src/monitor/agent-components.modal-presentation-failure.test.ts extensions/discord/src/monitor/native-command.options.test.ts extensions/discord/src/monitor/native-command.think-autocomplete.test.ts extensions/discord/src/monitor/native-command.plugin-dispatch.test.ts extensions/discord/src/voice/access.test.ts extensions/discord/src/voice/ingress.test.ts extensions/discord/src/voice/command.test.ts extensions/discord/src/voice/participant-context.test.ts extensions/discord/src/voice/voice-receive.test.ts extensions/discord/src/voice/voice-runtime.e2e.test.ts extensions/discord/src/voice/voice-runtime.secret-owner.e2e.test.ts extensions/discord/src/voice/transcripts-source.test.ts extensions/discord/src/voice/speaker-context.test.ts extensions/discord/src/voice/manager.ready-listener.test.ts pnpm build OPENCLAW_LOCAL_CHECK=0 node --import tsx scripts/profile-extension-memory.mts --extension discord --skip-combined --concurrency 1