Skip to content

Fix Discord reply typing lifecycle#76091

Merged
steipete merged 6 commits into
openclaw:mainfrom
zhuisDEV:codex/discord-reply-typing-lifecycle
May 30, 2026
Merged

Fix Discord reply typing lifecycle#76091
steipete merged 6 commits into
openclaw:mainfrom
zhuisDEV:codex/discord-reply-typing-lifecycle

Conversation

@zhuisDEV

@zhuisDEV zhuisDEV commented May 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Rewrites the Discord accepted-reply typing change around a Discord-owned feedback object instead of a one-shot early typing request.

  • Adds a small Discord typing prestart policy that mirrors the existing OpenClaw typing-mode behavior: DMs, mentioned groups, explicit typingMode: "instant", and message-tool-only group replies can prestart; unmentioned automatic group replies, room events, and non-instant configured modes do not.
  • Carries accepted typing feedback from preflight into the queued job and final dispatch target, including thread/channel retargeting.
  • Restarts the carried controller at dispatch time so a queued prestart TTL cannot leave the real model run with a closed typing controller.
  • Deduplicates prestarted typing feedback per Discord queue key so same-session backlogs do not spawn multiple /typing keepalive loops.
  • Cleans up carried feedback for normal processing and skipped queued jobs.

Verification

Behavior addressed: accepted Discord replies keep showing typing while work is queued and while the eventual reply dispatch runs, without changing default unmentioned group typing behavior.

Real environment tested: local OpenClaw checkout plus Blacksmith Testbox changed-surface gate.

Exact steps or command run after this patch:

  • node scripts/run-vitest.mjs extensions/discord/src/monitor/message-handler.queue.test.ts extensions/discord/src/monitor/message-handler.process.test.ts extensions/discord/src/monitor/message-handler.reply-typing-policy.test.ts
  • pnpm tsgo:extensions
  • pnpm tsgo:test:extensions
  • git diff --check
  • pnpm check:changed via Blacksmith Testbox run https://github.com/openclaw/openclaw/actions/runs/26689351476
  • /Users/steipete/Projects/agent-skills/skills/autoreview/scripts/autoreview --mode branch --base origin/main

Evidence after fix: focused Discord monitor tests cover prestart policy, carried feedback reuse, stale carried-controller restart, and queue-key dedupe. check:changed completed with exit code 0. Autoreview reported no accepted/actionable findings after fixing the stale-controller, test-fixture, and duplicate-keepalive findings.

Observed result after fix: 114 focused Discord tests passed; extension prod/test type lanes passed; Testbox changed-surface gate passed.

What was not tested: no fresh live Discord recording was captured after the maintainer rewrite.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: M labels May 2, 2026
@clawsweeper

clawsweeper Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed May 30, 2026, 1:36 PM ET / 17:36 UTC.

Summary
The PR updates the Discord plugin to prestart accepted reply typing through a Discord-owned feedback lifecycle, carry it through queued dispatch, dedupe queue-key keepalives, clean skipped jobs, and cover the behavior with focused tests.

PR surface: Source +268, Tests +331, Docs 0. Total +599 across 11 files.

Reproducibility: yes. by source inspection: current main and v2026.5.27 only send the accepted preflight typing cue for DMs, while the linked reports and earlier video describe the Discord guild delay. I did not run a live Discord account in this read-only review.

Review metrics: 1 noteworthy metric.

  • Config/default surfaces: 0 added, 0 changed, 0 removed. The current diff avoids new operator-facing config or default changes after earlier compatibility-risk scope was removed.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🦞 diamond lobster
Result: ready for maintainer review.

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

Rank-up moves:

  • [P2] Optional maintainer-side live Discord proof would further reduce the remaining confidence gap before merge.

Risk before merge

  • [P1] The latest maintainer rewrite has no fresh live Discord recording; the merge proof currently relies on proof override, the earlier before/after video, focused tests, and the Blacksmith Testbox changed-surface gate.

Maintainer options:

  1. Decide the mitigation before merge
    Land this scoped Discord plugin fix after maintainer review of the proof override and keep the broader shared typing cleanup in fix: making typing start fire-and-forget allows cleanup/idle to run before a persistent typin... #75403 separate.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No automated repair lane is needed; the remaining action is maintainer review or merge with the current proof override.

Security
Cleared: No concrete security or supply-chain concern found; the diff does not change dependencies, workflows, secrets handling, permissions, or downloaded code execution.

Review details

Best possible solution:

Land this scoped Discord plugin fix after maintainer review of the proof override and keep the broader shared typing cleanup in #75403 separate.

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

Yes, by source inspection: current main and v2026.5.27 only send the accepted preflight typing cue for DMs, while the linked reports and earlier video describe the Discord guild delay. I did not run a live Discord account in this read-only review.

Is this the best way to solve the issue?

Yes, the current branch is the narrowest maintainable fix I found: it keeps the lifecycle in the Discord plugin, avoids shared SDK/API changes, preserves default unmentioned group behavior, and adds focused coverage for the risky queue/restart paths.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Override: A maintainer applied proof: override for this PR.
  • remove rating: 🌊 off-meta tidepool: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P1: This addresses a Discord channel regression where accepted replies can appear idle for real users before typing feedback starts.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Override: A maintainer applied proof: override for this PR.
Evidence reviewed

PR surface:

Source +268, Tests +331, Docs 0. Total +599 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 7 317 49 +268
Tests 3 393 62 +331
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 711 112 +599

What I checked:

Likely related people:

  • steipete: Current-main blame ties the existing Discord typing and queue surface to c65af78, and the PR head commits are a maintainer rewrite of the same Discord lifecycle path. (role: recent Discord typing lifecycle contributor; confidence: high; commits: c65af788534a, 69f1fb8fbcf9, 8277d637dc3c; files: extensions/discord/src/monitor/message-handler.ts, extensions/discord/src/monitor/message-handler.process.ts, extensions/discord/src/monitor/message-run-queue.ts)
  • obviyus: The related open typing-lifecycle PR traces the shared createTypingCallbacks fire-and-forget behavior to commit 45b8645, which is adjacent context for this Discord-owned feedback wrapper even though this PR no longer changes shared core typing APIs. (role: adjacent shared typing lifecycle contributor; confidence: medium; commits: 45b86450795d; files: src/channels/typing.ts, src/auto-reply/reply/typing.ts)
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.

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label May 2, 2026
@zhuisDEV zhuisDEV force-pushed the codex/discord-reply-typing-lifecycle branch from 3f81d74 to 81075df Compare May 4, 2026 03:31
@zhuisDEV zhuisDEV force-pushed the codex/discord-reply-typing-lifecycle branch from d9bede5 to f84526c Compare May 5, 2026 00:40
@zhuisDEV zhuisDEV marked this pull request as ready for review May 5, 2026 02:29
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. 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 5, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 6, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@zhuisDEV zhuisDEV changed the title [codex] Fix Discord reply typing lifecycle Fix Discord reply typing lifecycle May 7, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: supplied External PR includes structured after-fix real behavior proof. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 7, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 7, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 8, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 11, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 11, 2026
@openclaw-barnacle openclaw-barnacle Bot added extensions: codex and removed channel: slack Channel integration: slack proof: sufficient ClawSweeper judged the real behavior proof convincing. labels May 11, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 11, 2026
@zhuisDEV

Copy link
Copy Markdown
Contributor Author

seiyaiwaoka-CR

Thanks, this is very helpful confirmation.

That matches the case this PR is targeting: accepted Discord guild messages can be processed successfully, but the published bundle does not start the native typing cue during the wait, so users see no feedback until the final reply lands.

Your setup (requireMention: false, groupPolicy: "allowlist", visibleReplies: "automatic") is especially useful because it confirms this is not limited to DMs or mention-triggered guild messages.

A real deployment retest after merge would be useful. The expected behavior is that the typing indicator starts after preflight acceptance and remains refreshed through queued processing/final reply dispatch, without needing the ack reaction workaround.

@zhuisDEV

Copy link
Copy Markdown
Contributor Author

Follow-up comparison with #79104 and #75403:

  • Discord guild channels delay typing despite typingMode=instant #79104 is the same Discord guild accepted-typing issue, not a competing implementation. It confirms that current main / published releases can suppress the accepted guild typing cue even when typingMode: "instant". This PR is still the active fix path for that root cause.
  • fix: making typing start fire-and-forget allows cleanup/idle to run before a persistent typin... #75403 is useful shared lifecycle hardening, but it targets a different failure mode: cleanup racing an async typing start() for persistent indicators that require explicit removal. That is complementary, especially for persistent reaction-style indicators, but it does not fix Discord guild preflight acceptance, does not carry accepted Discord typing feedback through queue/dispatch, and is not a replacement for this PR.
  • My judgment is to keep this PR focused: start native Discord typing at the accepted preflight boundary, carry one feedback owner through queued processing and dispatch, retarget it to the resolved delivery channel/thread, and preserve explicit opt-outs like typingMode: "never".

If maintainers want a broader shared typing lifecycle pass later, #75403’s pending-start cleanup serialization can be combined separately with this PR’s active-keepalive refresh behavior. I would not fold that into this PR unless requested, because it broadens scope beyond the Discord delay regression.

@zhuisDEV

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

I narrowed the branch to the Discord reply typing lifecycle fix. The PR diff no longer includes the unrelated cron compatibility change, macOS, oc-path, LINE, GitHub Copilot, or incidental test drift. Local validation passed:

  • node scripts/run-vitest.mjs src/channels/typing.test.ts src/plugin-sdk/channel-lifecycle.queue.test.ts
  • node scripts/test-projects.mjs extensions/discord/src/monitor/message-handler.queue.test.ts extensions/discord/src/monitor/message-handler.process.test.ts
  • pnpm tsgo:prod
  • pnpm check:test-types
  • pnpm lint --threads=8
  • pnpm lint:extensions:bundled
  • git diff --check

@clawsweeper

clawsweeper Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@zhuisDEV

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

I removed the remaining shared createTypingCallbacks semantic change that ClawSweeper identified as the compatibility risk. The scoped PR diff now keeps only the Discord reply typing lifecycle fix, Discord queue cleanup hooks, the shared channel run-queue hook contract needed for skipped queued work cleanup, docs, and changelog.

Local validation passed on this narrower head:

  • node scripts/run-vitest.mjs src/plugin-sdk/channel-lifecycle.queue.test.ts
  • node scripts/test-projects.mjs extensions/discord/src/monitor/message-handler.queue.test.ts extensions/discord/src/monitor/message-handler.process.test.ts
  • pnpm tsgo:prod
  • pnpm check:test-types
  • pnpm lint --threads=8
  • pnpm lint:extensions:bundled
  • git diff --check

@clawsweeper

clawsweeper Bot commented May 18, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@clawsweeper

clawsweeper Bot commented May 19, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg: ✨ hatched 🌱 uncommon Mossy Patch Peep. Rarity: 🌱 uncommon. Trait: sparkles near resolved comments.

Details

Share on X: post this hatch
Copy: My PR egg hatched a 🌱 uncommon Mossy Patch Peep in ClawSweeper.
Hatchability:

  • 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.

About:

  • Eggs appear after real-behavior proof passes. They are collectible flavor only.
  • Review momentum changes the shell state: follow-up work warms it, re-review makes it wobble, and a clean final review lets it hatch.
  • 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.

@zhuisDEV

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

I narrowed the branch to remove the remaining compatibility-risk scope. The PR no longer changes core GetReplyOptions, createTypingController, typingKeepalive, or default unconfigured Discord message_tool_only keepalive behavior. Those stale tool-reply typing edges are left to the narrower related PRs.

The projected diff is now limited to the Discord accepted typing lifecycle, Discord queued-run cleanup, the shared channel run-queue skipped-work cleanup hook contract, docs/changelog, and focused tests.

Local validation passed:

  • node scripts/test-projects.mjs extensions/discord/src/monitor/message-handler.queue.test.ts extensions/discord/src/monitor/message-handler.process.test.ts (93 tests)
  • node scripts/run-vitest.mjs src/channels/typing.test.ts src/plugin-sdk/channel-lifecycle.queue.test.ts (20 tests)
  • pnpm tsgo:prod
  • pnpm check:test-types
  • pnpm lint --threads=8
  • pnpm run test:extensions:package-boundary:compile
  • git diff --check

@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@zhuisDEV

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

I updated this branch against current origin/main and narrowed the remaining compatibility risk:

  • Removed the public ChannelRunQueue.enqueue(..., options) hook from the projected PR diff.
  • Moved skipped queued-run cleanup into the Discord message queue wrapper.
  • Switched Discord reply typing feedback to the non-deprecated openclaw/plugin-sdk/channel-outbound import.
  • Restored periodic Discord typing refresh for carried feedback during long replies.
  • Removed the release-owned changelog entry and duplicate SDK docs row from the projected diff.

Latest local validation on head cd1a7d7adf passed:

  • node scripts/test-projects.mjs extensions/discord/src/monitor/message-handler.queue.test.ts extensions/discord/src/monitor/message-handler.process.test.ts
  • node scripts/run-vitest.mjs src/agents/code-mode.test.ts src/auto-reply/reply/agent-runner-memory.test.ts
  • pnpm check:architecture
  • pnpm tsgo:prod
  • pnpm check:test-types
  • pnpm lint --threads=8
  • pnpm run test:extensions:package-boundary:compile
  • git diff --check

@clawsweeper

clawsweeper Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord P1 High-priority user-facing bug, regression, or broken workflow. proof: override Maintainer override for the external PR real behavior proof gate. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants