Skip to content

fix(discord): harden reply delivery accounting#86716

Open
Steady-ai wants to merge 1 commit into
openclaw:mainfrom
Steady-ai:fix/discord-delivery-accounting
Open

fix(discord): harden reply delivery accounting#86716
Steady-ai wants to merge 1 commit into
openclaw:mainfrom
Steady-ai:fix/discord-delivery-accounting

Conversation

@Steady-ai

@Steady-ai Steady-ai commented May 26, 2026

Copy link
Copy Markdown
Contributor

Scope

  • Return an explicit delivery result from Discord interaction replies so expired interactions are not counted as delivered.
  • Fail final Discord delivery when sanitizer removes all visible/sendable payload content.
  • Normalize Discord message send extraction for both send and sendMessage actions.

Non-goals

  • No changes to Discord transport connection, auth, or gateway startup.
  • No changes to deliberate silent NO_REPLY handling before final delivery.

Risk

Low. The change is scoped to Discord reply accounting and message-tool send target extraction. The main behavioral change is surfacing empty final replies as delivery failures instead of silent success.

Rollback

Revert commit 64f2dc4b2d.

Real behavior proof

Behavior or issue addressed: Discord final reply delivery after applying the equivalent local runtime hotfix no longer silently completes for normal visible replies; the live channel continued receiving final assistant replies and the Discord transport stayed healthy.

Real environment tested: Richard's real OpenClaw gateway using Discord channel #starlord-infra, installed OpenClaw 2026.5.22 with the equivalent local Discord delivery-accounting hotfix applied before this PR was ported back to source.

Exact steps or command run after the patch:

  1. Applied the equivalent hotfix to the installed OpenClaw runtime bundles.
  2. Restarted/verified the live gateway loaded the patched runtime.
  3. Sent live Discord turns through the active #starlord-infra channel.
  4. Ran openclaw channels status --probe && openclaw gateway stability after the visible Discord replies landed.

Evidence after fix:

Checking channel status (probe)...
Gateway reachable.
- Discord default: enabled, configured, running, connected, in:20m ago, out:39m ago, transport:just now, bot:@Starlord, token:config, intents:content=limited, works, audit ok
Gateway Stability
Recent:
  2026-05-26T01:49:44.186Z #3701 diagnostic.heartbeat queued=0

Observed result after fix: The same real Discord setup delivered visible final replies after the hotfix, while the gateway reported Discord works and queue depth 0. This PR ports that runtime hotfix into source and adds regression coverage for the expired-interaction accounting path, sanitizer-empty final path, and send/sendMessage extraction mismatch.

What was not tested: I did not force a real expired Discord slash-interaction token in production; that path is covered by unit regression because manufacturing an expired live token would be brittle and user-visible.

Verification

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-discord.config.ts extensions/discord/src/monitor/native-command-reply.test.ts extensions/discord/src/monitor/reply-delivery.test.ts extensions/discord/src/channel-actions.test.ts -> 3 files / 38 tests passed
  • node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.extensions.json extensions/discord/src/monitor/native-command-reply.ts extensions/discord/src/monitor/native-command-agent-reply.ts extensions/discord/src/monitor/reply-delivery.ts extensions/discord/src/channel-actions.ts extensions/discord/src/monitor/native-command-reply.test.ts extensions/discord/src/monitor/reply-delivery.test.ts extensions/discord/src/channel-actions.test.ts -> passed
  • corepack pnpm exec oxfmt --check extensions/discord/src/monitor/native-command-reply.ts extensions/discord/src/monitor/native-command-agent-reply.ts extensions/discord/src/monitor/reply-delivery.ts extensions/discord/src/channel-actions.ts extensions/discord/src/monitor/native-command-reply.test.ts extensions/discord/src/monitor/reply-delivery.test.ts extensions/discord/src/channel-actions.test.ts -> passed
  • node scripts/run-tsgo.mjs -p tsconfig.extensions.json --noEmit -> passed

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. triage: refactor-only Candidate: refactor/cleanup-only PR without maintainer context. proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 26, 2026
@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed May 29, 2026, 1:15 AM ET / 05:15 UTC.

Summary
Review failed before ClawSweeper could summarize the requested change.

PR surface: Source +10, Tests +43. Total +53 across 7 files.

Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path.

Review metrics: none identified.

Merge readiness
Overall: 🌊 off-meta tidepool
Proof: 🌊 off-meta tidepool
Patch quality: 🌊 off-meta tidepool
Result: rating does not apply to this item.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Risk before merge

  • [P1] No close action taken because the review did not complete.

Maintainer options:

  1. Decide the mitigation before merge
    Retry the Codex review after fixing the execution failure.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Review did not complete, so no work-lane recommendation was made.
Review details

Best possible solution:

Retry the Codex review after fixing the execution failure.

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

Unclear. The review failed before ClawSweeper could establish a reproduction path.

Is this the best way to solve the issue?

Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction.

AGENTS.md: unclear because the file could not be read completely.

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

Label changes

Label changes:

  • add rating: 🌊 off-meta tidepool: Overall readiness is 🌊 off-meta tidepool; proof is 🌊 off-meta tidepool and patch quality is 🌊 off-meta tidepool.
  • remove proof: sufficient: Current real behavior proof status is not_applicable, not sufficient.
  • remove P2: Current review triage priority is none.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🌊 off-meta tidepool, so this older rating label is no longer current.
  • remove merge-risk: 🚨 message-delivery: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status no longer selects a status label.

Label justifications:

  • rating: 🌊 off-meta tidepool: Overall readiness is 🌊 off-meta tidepool; proof is 🌊 off-meta tidepool and patch quality is 🌊 off-meta tidepool.
Evidence reviewed

PR surface:

Source +10, Tests +43. Total +53 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 21 11 +10
Tests 3 45 2 +43
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 66 13 +53

What I checked:

  • failure reason: codex execution failed.
  • codex failure detail: Codex review failed for this PR with exit 1.
  • codex stdout: Per-item Codex failure; continuing with the rest of the shard.

Likely related people:

  • unknown: Codex failed before it could trace repository history. (role: review did not complete; confidence: low)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. labels May 26, 2026
@clawsweeper

clawsweeper Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress.

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.
What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. label May 29, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. size: S triage: refactor-only Candidate: refactor/cleanup-only PR without maintainer context.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants