Skip to content

fix(discord): count replies to existing threads as delivered - #163785

Closed
alkor2000 wants to merge 3 commits into
openclaw:mainfrom
alkor2000:codex/fix-discord-thread-delivery-evidence
Closed

alkor2000 wants to merge 3 commits into
openclaw:mainfrom
alkor2000:codex/fix-discord-thread-delivery-evidence

Conversation

@alkor2000

@alkor2000 alkor2000 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Related: #163724

What Problem This Solves

A successful reply to an existing Discord thread can lack the thread identity needed to confirm delivery to the current source, leaving a silent requester completion classified as undelivered.

User Impact

Replies posted into existing threads carry accurate placement evidence through progress and final receipts. Actual after-fix Discord thread delivery and requester task settlement remain required, unproven merge evidence; this maintenance does not waive that review request.

Why This Change Was Made

The sender already fetches the destination channel. Its existing thread type now supplies the thread ID for physical-delivery callbacks and the aggregate receipt, including chunked sends. Ordinary channel, forum creation, media, reply, structured-message, and request-authority behavior retain their owners.

This complements #163756 by MertBasar0, which repairs implicit thread identification during extraction. The repair remains receipt-only, with no overlapping resolver change, new permission policy, configuration, API or stored-data format.

Current maintenance normally merges published head 608ddb9f703174be0b3f2a5496a8e7049fb0ebbe with pinned official main c786f4d4c4ea27630466a529630e56071845a682. The actual sender conflict keeps main’s async withDiscordRequestAuthority scope and structured-message helper, then replays the same three receipt-fix hunks. The retired internal sender wrapper is not restored; both regressions retain their behavioral assertions.

Evidence

Current committed head: 83ef1a8.

  • Five owner/sibling files pass 145 cases in 126.73 seconds: public-plugin requester regression, channel contracts, basic sends, thread creation and outbound payload contracts. The requester regression uses canonical threading/outbound/REST owners with synthetic GET/POST responses; the actual receipt feeds extraction, source matching and direct completion classification.
  • Wrong destination/account, contradictory receipt placement, dry-run and tool-error controls reject delivery. The existing selected-thread case protects physical progress receipts and aggregate thread identity, alongside destination and platform-ID assertions.
  • Fresh independent P0–P2 review of the full three-file scope is scoped-clean. Separate source review and lead inspection confirm the same production hunks preserve current main’s authority, scheduler, reply, media, forum and structured-send owners. Static review is not runtime execution.
  • All 27 core test consumer graphs pass (3314.418 seconds), as do extension production types (272.490 seconds), extension test types (436.239 seconds), scoped format/lint, changed guards and git diff --check. The complete native plan records 33 passing stages and one failing unused-export stage, summed stage wall 5,173.743 seconds; runtime value import cycles are zero.

Inherited local failure: production and full-tree Knip report src/talk/client-voice-session-store.ts: ClientVoiceToolEffect (the full-tree namespace report includes voiceSessionStore); script scanning reports zero entries. The exact entire tracked working tree at pinned main c786f4d4c4ea27630466a529630e56071845a682, in the same installed environment, reproduces the identical production/full-tree findings in 157.523 seconds. Candidate source and index were restored exactly. No scanner exemption, baseline change, test deletion or unrelated voice change was used. This is a qualified inherited failure, not a claim that all checks pass. Node 24.19.0 / pnpm 12.5.1..

Live evidence gap: this round’s canonical Discord readiness probe failed at Convex lease acquisition, before any Discord identity/history request. The probe did not obtain a lease identity, no Gateway started and no Discord objects were created. Preflight found neither broker environment variable, no Convex/bunx launcher on PATH, and no default Convex user-config file. Canonical discovery, including its offline fallback, did not produce a usable lease; the probe does not establish which authentication, project-access or pool prerequisite needs repair. This is an environment prerequisite failure, not evidence of a Discord permission defect. No credentials were installed, provisioned, copied or rotated. The existing real-Discord message-tool → NO_REPLY → successful requester settlement request remains pending an authorized shared QA lease.

Local results use controlled REST responses, not live Discord or an operator Gateway. Separate voice, component, poll and webhook send producers remain outside the repair. Natural exact-head CI is separate from local proof; no workflow is dispatched or rerun to obtain green.

Retained earlier defect proof and costs

The original sender failed the same composed receipt/requester regression; the receipt-only correction passed while the channel descriptor remained unchanged. Previous head 608 integrated official main 4aa24e3a and passed the 144-case sender/public-facade selection in 85.722 seconds, extension production/test types, scoped lint/format and diff checks. Earlier independent sibling proof protected another 119 cases. Those runs retain their original inputs and do not become current-head CI.

Original isolated requester test: 26.188 seconds wall / 252 ms test time. Original changed thread suite: 26.494 seconds wall / 27 cases. Existing fixtures add no new Gateway boot, timer, polling, or production seam during this maintenance. New-head CI job-seconds are unmeasured until its natural run completes.

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord agents Agent runtime and tooling size: M labels Oct 2, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

The Discord sender includes an existing thread’s identity in physical delivery callbacks and the final delivery receipt.

Example: A requester sends “Completed the requested work.” to channel:1510164477642014740 and finishes with NO_REPLY

  • Before: The message is posted, but its receipt lacks thread identity and the current-source completion check rejects it.
  • After: The receipt identifies thread 1510164477642014740, allowing the completion check to credit the reply.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The repair is focused and source-supported, but its evidence remains an in-process composition with mocked HTTP responses.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: A reply successfully posted into the requester’s Discord thread can still leave delegated work classified as undelivered.
Reason: Accurate physical delivery evidence is an established contract, and this focused repair complements the merged route fix. It does not address the linked report’s secondary error-wording concern.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR retains a useful receipt repair that current main and the merged related fix do not provide. No actionable patch defect was found, and no closure condition applies.

Priority: P1
Reviewed head: 83ef1a856704a78bba81e7525bc20efed1b1e810

Before merge

  • Add real behavior proof - The public Discord sender and completion classifier are exercised with synthetic fetch responses, while the captured body explicitly leaves the runtime scenario pending. Provide redacted logs, live output, or terminal screenshots showing an existing requester-thread message-tool reply, NO_REPLY, and successful task settlement; redact IP addresses, keys, phone numbers, and non-public endpoints. Existing optional receipt fields are populated without changing a stored-data contract. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Findings

None.

Provenance

  • extensions/discord/src/send.outbound.ts existing-thread progress and final receipts: original intent not found (unknown: The exact origin of omitted existing-thread identity could not be established because historical blob searches failed. The latest sender consolidation explicitly preserved receipt behavior; earlier receipt work intended authoritative physical placement.)

Tests

  • Missing end-to-end proof: Show the changed sender posting into an existing Discord requester thread, followed by NO_REPLY and observed successful task settlement through a running Gateway.
Agent review details

How this fits together

The Discord plugin sends messages and returns receipts describing where they landed. OpenClaw’s agent runtime uses those receipts to recognize replies to the requester’s current conversation and settle delegated tasks.

flowchart TD
  A[Requester in Discord thread] --> B[Message tool sends reply]
  B --> C[Discord sender reads destination]
  C --> D[Message posted to existing thread]
  D --> E[Receipt includes thread identity]
  E --> F[Current conversation check]
  F --> G[Silent completion credited]
Loading

Technical review

Best possible solution:

Keep physical thread identity authoritative in Discord’s existing sender and receipt owner while preserving shared account, destination, and completion checks.

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

Yes: current source shows that an existing-thread send returns a receipt without thread identity, which the current-source matcher rejects. The supplied composed regression exercises this path, but this read-only review did not execute it.

Is this the best way to solve the issue?

Yes: supplying the fetched destination’s thread identity at the physical sender repairs the evidence producer without weakening shared matching or duplicating the merged route resolver.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against dcd3ca7a7fd5.

Provenance checked

  • extensions/discord/src/send.creates-thread.test.ts selected-thread receipt expectations keeps the original intent (fix(discord): keep forum replies in their created thread #120857: Keep one logical payload in its forum thread and preserve authoritative thread and message receipts without changing explicit-thread routing.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +4, Tests +222. Total +226 across 3 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 1 6 2 +4
Tests 2 224 2 +222
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 230 4 +226

Root-cause cluster

Relationship: partial_overlap
Canonical: #163724
Summary: The canonical report’s route-identity repair has merged; this PR addresses complementary physical-receipt evidence that remains absent.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Missing physical thread evidence can prevent successful Discord requester replies from settling delegated tasks correctly.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Capture the existing-thread sender and requester settlement scenario through a running Gateway.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-02T21:09:45.452Z sha 9304898 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-02T21:38:39.406Z sha 608ddb9 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-02T21:47:03.200Z sha 608ddb9 :: needs real behavior proof before merge. :: none

Reviewed October 8, 2026, 4:28 PM ET / 20:28 UTC (Revision 4).

@obviyus

obviyus commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

On current main d1553a7a40, we tested with real Discord bots through an isolated Gateway: sessions_spawn → sessions_yield → a message-tool send into an existing thread delivered successfully, and the child settled with delivery status delivered.

Our run could not force a literal trailing NO_REPLY in the thread case: the requester ended at the message tool call. Could you share the exact flow where the requester was marked undelivered—the model, the prompt, and whether the final reply was a literal NO_REPLY?

@alkor2000

Copy link
Copy Markdown
Contributor Author

Thanks for testing this on current main. I have not reproduced an undelivered requester with real Discord bots, and I cannot supply a verified model or original prompt. The reporter did not include those in #163724.

The reported flow was an existing Discord thread → sessions_spawn (mode=run) → sessions_yield → requester wake sends through message(action="send", target="channel:<thread id>") → a literal final NO_REPLY. It was reported on 2026.9.6/2026.9.7; no Gateway restart was involved. The claimed failed outcome is the reporter's observation, not my live result.

My regression at 83ef1a856704 exercises the public Discord sender with synthetic channel GET / message POST responses, feeds its receipt through extraction and source matching, and explicitly supplies payloads: [{ text: "NO_REPLY" }] to the direct completion classifier. It isolates the existing-thread receipt identity loss, but does not prove a model naturally emits that final response or reproduce actual task settlement. The PR body already leaves the live proof pending.

Your successful current-main run is useful contrary evidence. It covers the actual send and child settlement; the literal-final case remains unverified. I will keep these scopes separate rather than claim my fixture establishes a live failure.

@obviyus

obviyus commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Thanks for this. With real Discord bots on current main, a sessions_spawn, sessions_yield and message send into an existing thread was delivered, and the child settled as delivered. We couldn't reproduce an undelivered classification through a real flow. Closing for now. If you can capture the exact model, prompt and logs from a run where it happened, reopen and we'll pick it up.

@obviyus obviyus closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: discord Channel integration: discord P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants