Skip to content

Discord ambient room events#82573

Merged
steipete merged 1 commit into
mainfrom
codex/discord-room-events-pr
May 17, 2026
Merged

Discord ambient room events#82573
steipete merged 1 commit into
mainfrom
codex/discord-room-events-pr

Conversation

@obviyus

@obviyus obviyus commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep unmentioned Discord room-event history pending while source replies are message-tool-only
  • clear that pending history only after a visible Discord send succeeds, covering local message actions and durable core outbound sends
  • pass the inbound event kind through core outbound send preparation so Discord can attach delivery metadata
  • add the maintainer changelog entry for the landed behavior

Verification

  • pnpm test src/infra/outbound/outbound-send-service.test.ts extensions/discord/src/channel-actions.test.ts extensions/discord/src/outbound-adapter.test.ts extensions/discord/src/monitor/message-handler.process.test.ts extensions/discord/src/actions/handle-action.test.ts
  • pnpm check:test-types
  • git diff --check
  • /Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --mode branch --output /tmp/pr82573-codex-review-after-rebase.txt

Real behavior proof

Behavior addressed: Discord room-event context stays available until the agent actually sends a visible Discord reply through the message tool or durable core send path.
Real environment tested: local OpenClaw checkout with Discord/core outbound unit coverage on the rebased PR branch; live Discord delivery was not run, so proof override is applied.
Exact steps or command run after this patch: see Verification above.
Evidence after fix: focused Discord/core tests cover pending room-event history, clearing on local visible sends, clearing on queued core sends, and metadata propagation into the Discord outbound adapter.
Observed result after fix: focused tests, test types, diff check, and Codex review all passed on rebased head 0344f0b.
What was not tested: live Discord bot runtime against the Discord API.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: telegram Channel integration: telegram size: XL maintainer Maintainer-authored PR labels May 16, 2026
@clawsweeper

clawsweeper Bot commented May 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR adds Discord room-event delivery correlation so pending room-event history is preserved until local or durable visible Discord sends succeed, with focused Discord/outbound tests and a small run-node test fix.

Reproducibility: yes. from source inspection: current main classifies Discord unmentioned group/channel chatter as room_event, passes history into the shared turn kernel, and the kernel clears pending group history immediately after dispatch. I did not run live Discord in this read-only review.

Real behavior proof
Override: A maintainer applied proof: override for this PR.

Next step before merge
Protected maintainer label and proof override put this in maintainer review/landing flow; there is no narrow ClawSweeper repair finding to address.

Security
Cleared: No concrete security or supply-chain concern found; the diff is TypeScript runtime/test code plus changelog and does not change dependencies, workflows, secrets, or install/build execution paths.

Review details

Best possible solution:

Land the reviewed Discord delivery-correlation path after maintainer approval and appropriate Discord/test proof, preserving the related core room-event contract from #82606.

Do we have a high-confidence way to reproduce the issue?

Yes from source inspection: current main classifies Discord unmentioned group/channel chatter as room_event, passes history into the shared turn kernel, and the kernel clears pending group history immediately after dispatch. I did not run live Discord in this read-only review.

Is this the best way to solve the issue?

Yes in direction: the PR follows the existing room-event delivery-correlation pattern and moves Discord history clearing behind visible message-tool/core outbound delivery. No safer narrower repair was identified, but protected maintainer review remains the landing path.

What I checked:

  • Protected live PR context: Provided live context shows this PR is open, ready for review, labeled maintainer and proof: override, and has head c8351580d14629c600ea9d01fec2bd3c06aca99a, so cleanup close is blocked by policy. (c8351580d146)
  • Current Discord classification path: Current main classifies Discord inbound group/channel messages through classifyChannelInboundEvent and stores the resolved inboundEventKind on the preflight result. (extensions/discord/src/monitor/message-handler.preflight.ts:650, c2e90914b735)
  • Current history clearing behavior: Current main clears pending group history unconditionally after the prepared channel turn dispatch completes. (src/channels/turn/kernel.ts:503, c2e90914b735)
  • Current Discord handoff to shared history finalizer: Current Discord processing passes guild history into runPreparedInboundReplyTurn, so room-event dispatch currently follows the shared post-dispatch history clear instead of waiting for visible message-tool delivery. (extensions/discord/src/monitor/message-handler.process.ts:654, c2e90914b735)
  • PR implementation shape: The PR adds Discord inbound-event delivery metadata/correlation and updates Discord process/action/outbound paths so room-event history is cleared after visible outbound success rather than source dispatch alone. (extensions/discord/src/inbound-event-delivery.ts:1, c8351580d146)
  • Related merged core work: The related core room-event refactor is present on main through merge commit 0190f4ae1e505c63e0de51d6cc5b300d24f4a136; this PR keeps the remaining Discord delivery/history behavior after that work. (0190f4ae1e50)

Likely related people:

  • steipete: The provided PR timeline/comment says steipete rewrote the branch after the merged core room-event PR, and local history shows Peter Steinberger as the recent author for the core inbound-event and Discord room-event handling commits on main. (role: recent area contributor and PR rewriter; confidence: high; commits: c8351580d146, 0190f4ae1e50, 07f05e972e27; files: extensions/discord/src/monitor/message-handler.process.ts, extensions/discord/src/monitor/message-handler.context.ts, extensions/discord/src/channel-actions.ts)

Remaining risk / open question:

  • Live Discord runtime capture was not included; proof: override makes this a maintainer landing judgment rather than a contributor proof blocker.

Codex review notes: model gpt-5.5, reasoning high; reviewed against c2e90914b735.

@steipete steipete force-pushed the codex/discord-room-events-pr branch from ae727cc to 1eb2d47 Compare May 17, 2026 00:00
@openclaw-barnacle openclaw-barnacle Bot added size: L and removed channel: telegram Channel integration: telegram size: XL labels May 17, 2026
@steipete steipete marked this pull request as ready for review May 17, 2026 00:01
@steipete steipete added the proof: override Maintainer override for the external PR real behavior proof gate. label May 17, 2026
@steipete

Copy link
Copy Markdown
Contributor

Rewrote this PR on current main to keep only the remaining Discord room-event delivery/history behavior after #82606.

Verification:

  • pnpm test src/infra/outbound/outbound-send-service.test.ts extensions/discord/src/channel-actions.test.ts extensions/discord/src/outbound-adapter.test.ts extensions/discord/src/monitor/message-handler.process.test.ts extensions/discord/src/actions/handle-action.test.ts
  • codex-review --mode branch --output /tmp/pr82573-codex-review.txt: clean, no accepted/actionable findings.
  • Focused coverage now proves room-event history is recorded while source replies are tool-only, clears after local visible Discord actions, clears for group DMs, and clears after queued/core outbound delivery metadata is observed.

Known proof gap:

  • pnpm check:changed via Testbox currently stops in src/infra/run-node.test.ts with a typecheck error that is present on current origin/main and outside this PR diff; this PR's touched core/Discord shards above are green.

Applied maintainer proof: override because this is an internal history/delivery-correlation fix with targeted local proof rather than a live Discord runtime capture.

@steipete steipete force-pushed the codex/discord-room-events-pr branch from 1eb2d47 to c835158 Compare May 17, 2026 00:07

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8351580d1

ℹ️ 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 (adminResult !== undefined) {
if (action === "thread-reply") {
notifyVisibleOutbound(readStringParam(params, "threadId") ?? readTarget());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid throwing after successful thread-reply sends

When action === "thread-reply", this new notification path calls readStringParam(params, "threadId") ?? readTarget(). readTarget() only accepts to/from, but the existing admin handler explicitly supports CLI channelId input (handle-action.guild-admin.ts notes to/channelId compatibility), so valid channelId-only requests now throw after handleDiscordAction has already sent the reply. That turns successful thread replies into tool errors for legacy CLI callers and skips normal post-send flow.

Useful? React with 👍 / 👎.

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
@steipete steipete force-pushed the codex/discord-room-events-pr branch from c835158 to 0344f0b Compare May 17, 2026 00:19
@steipete

Copy link
Copy Markdown
Contributor

Final maintainer proof for the rewritten branch:

  • Rebased onto latest origin/main; head: 0344f0b
  • Focused tests: pnpm test src/infra/outbound/outbound-send-service.test.ts extensions/discord/src/channel-actions.test.ts extensions/discord/src/outbound-adapter.test.ts extensions/discord/src/monitor/message-handler.process.test.ts extensions/discord/src/actions/handle-action.test.ts
  • Type/diff checks: pnpm check:test-types; git diff --check
  • Codex review: /Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --mode branch --output /tmp/pr82573-codex-review-after-rebase.txt -> clean, no accepted/actionable findings
  • GitHub CI: run 25976740590 passed
  • CodeQL Critical Quality: run 25976740584 passed

Known proof gap: no live Discord API runtime capture; this is covered by focused Discord/core tests plus the proof override label.

@steipete steipete merged commit d1280a3 into main May 17, 2026
117 of 120 checks passed
@steipete steipete deleted the codex/discord-room-events-pr branch May 17, 2026 00:24
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 20, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 24, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
galiniliev pushed a commit to galiniliev/openclaw that referenced this pull request May 25, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
SebTardif pushed a commit to SebTardif/openclaw that referenced this pull request May 26, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord maintainer Maintainer-authored PR proof: override Maintainer override for the external PR real behavior proof gate. size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants