Repository navigation
fix: allow unlocked Discord thread reopening - #150216
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 16, 2026, 3:15 PM ET / 19:15 UTC (Revision 3). ClawSweeper reviewWhat this changesThe Discord plugin allows authorized senders to reopen unlocked archived threads while retaining stronger permissions for locked threads and combined edits. Merge readiness✅ Ready for maintainer review This remains a useful fix: current main still rejects legitimate thread reopens through the registered adapter. The prior sender-access finding is addressed, and no blocking defect remains in the reviewed patch. Priority: P2 Review scores
Verification
How this fits togetherDiscord channel actions translate agent requests into Discord API operations. The guild-action permission owner checks the requesting sender before the bot sends a channel update. flowchart TD
A[Channel edit request] --> B[Normalize edit payload]
B --> C{Only reopen an unlocked thread?}
C -->|Yes| D[Check send permission and thread access]
C -->|No| E[Check management permission]
D --> F{Authorized?}
E --> F
F -->|Yes| G[Discord channel update]
F -->|No| H[Permission error]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +9, Tests +156. Total +165 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep the existing normalized-payload and permission owners aligned so accessible unlocked-thread reopens succeed without weakening authorization for other edits. Do we have a high-confidence way to reproduce the issue? Yes, from source: the registered adapter materializes omitted optional fields, and current main treats their presence as additional edits. This review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes. Reusing the normalized edit payload and existing thread-access owner repairs the actual adapter path while preserving stronger checks for combined or locked-thread edits. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e2eb18b701b4. LabelsLabel changes:
Label 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)
|
|
Fixed: Discord channel actions can reopen accessible unlocked archived threads with Send Messages while preserving access and stronger-edit checks. |
Discord channel actions now classify the normalized edit payload before allowing an unlocked-thread reopen with Send Messages. Current visibility and private-thread membership are checked before the queued Discord PATCH, while every additional edit keeps the stronger permission path.
What Problem This Solves
Fixes the registered Discord channel-edit action incorrectly demanding
Manage Threadswhen a sender withSend Messagesreopens an unlocked archived thread. OpenClaw treated options omitted by the caller as additional channel edits, so the lower-permission exception never applied through the normal action adapter.User Impact
Senders with current access and
Send Messageson a thread's parent channel can explicitly reopen an unlocked archived thread instead of receiving an incorrect permissions error. Having onlySend Messages in Threadsdoes not authorize the explicit edit; Discord uses that separate permission when posting automatically reopens a thread. A private-thread nonmember or a sender whoseView Channelaccess was removed remains blocked. Reopening a locked thread, unlocking it, or combining the reopen with another edit still requiresManage Threads. The change does not add a permission, action, setting, or migration.Why This Change Was Made
The registered adapter normalizes the channel edit before invoking the guild runtime. The runtime's permission selector previously checked whether optional keys existed, so adapter normalization made a pure reopen indistinguishable from a reopen combined with other edits. It now classifies the existing normalized payload itself, including
availableTags, keeping permission selection aligned with the payload sent to Discord while preserving stronger authorization for explicit changes.The selector also now uses
Send Messages, as required by Discord's Modify Channel contract for an unlocked-thread unarchive, rather than the independent thread-posting permission. OpenClaw resolves the current sender'sView Channelaccess and private-thread membership after the permission check and before dispatch, so the exception cannot borrow parent permission bits for an inaccessible thread.Evidence
A focused regression exercises the registered channel-edit adapter, real permission and access owners, and queued REST client through a secretless loopback. The authorized case reaches exactly one Discord PATCH containing only
{"archived":false}. A private-thread nonmember and a sender with a parent overwrite removingView Channelare both rejected before any PATCH. The same test rejectsSend Messages in Threadsand verifies locked threads plus explicit unlock, flag, parent, and tag edits remain on the stronger path.node scripts/run-vitest.mjs extensions/discord/src/actions/handle-action.guild-admin.test.ts extensions/discord/src/actions/runtime.test.ts— 2 files, 176 tests passed locally.pnpm check:changedon Blacksmith Testbox — exact2a116aa/36551b1daddasource passed the 176 affected tests, extension production/test typechecks, and every selected gate in 5m09s.