Skip to content

fix: retain Discord native commands in conversation history - #169200

Merged
obviyus merged 6 commits into
mainfrom
fix/native-command-transcript-parity
Oct 11, 2026
Merged

obviyus merged 6 commits into
mainfrom
fix/native-command-transcript-parity

Conversation

@obviyus

@obviyus obviyus commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes missing conversation history when Discord native commands send status, argument menus, model-picker updates, or plugin replies directly instead of through the shared dispatcher.

Follow-up to #169026. This PR is Discord-only; Slack and Mattermost native adapters are deferred.

User Impact

Discord users can refer back to delivered native command exchanges in later turns and chat history. Failed sends and the transient “Applying model change…” notice are not recorded. Command execution, authorization, reply visibility, and message delivery stay unchanged.

Why This Change Was Made

The native adapters now call the existing delivered-command recorder after successful delivery. That owner retains redaction, idempotency, and transcript persistence. Capture identities include the Discord account and conversation/session; bound model-picker and plugin commands retain their target session. Touched live session reads use the worker-owned async reader. Component capture retains visible labels and text, not interaction IDs or option values.

No new SDK export, database schema, dependency, or configuration option.

Evidence

  • Four focused Discord entry-point suites: 77 passed in 24.62s wall time, with one worker. The retained negative control on the unmodified owner has 6 failures / 71 passes for those same 77 cases.
  • Full worktree build passed after the Discord-only split.
  • Real QA Lab Discord transport, isolated Gateway, OpenAI gpt-5-mini: the driver sent /status, then asked for the version and build hash without supplying either value. The model answered: “OpenClaw 2026.9.9” and “d4ae04c”. (from /status). The command and delivered status reply were also observed in chat.history.
  • A separate real Discord transport run with the deterministic provider captured the next outbound provider request: its user message includes /status and its assistant message includes the delivered status text. chat.history retained both. This assertion examines raw provider message content, not the debug summary, which omits assistant output_text.
  • Both final runs passed, stopped their isolated Gateways, and completed sequential owned-message cleanup with zero unresolved operations. The temporary real-provider credential file was removed.

Live gaps

Discord slash interactions, ephemeral replies, and component clicks require a manual user client and were not automated. Their native entry points are covered by the focused status, argument-menu, model-picker, and plugin-dispatch tests. The live /status proof uses a text command, not a fabricated slash interaction. No Slack or Mattermost behavior is claimed by this PR.

Merge Risk

Two-way code change: reverting restores the old capture behavior, but does not delete exchanges already appended to conversation history. Blast radius is Discord native command transcript capture and its session reads; ordinary reply transport and other channels are unchanged.

Review fixes

The delivery owner now reports the representation it actually sent: Components V2 text instead of hidden legacy fallback text, and visible embed text where applicable. The recorder mocks preserve the module's other exports, and component traversal no longer adds a type assertion.

The five focused Discord suites pass 93 tests in 32.29s. Before the representation repair, the four added delivery assertions failed against the prior owner. Both the mock-export and assertion-safety ratchets pass, and the full build passed. These fixes are in e5d5c640427613179bd04bb17e957972a9f6eb4a; the live text-command evidence above is from its parent d4ae04ce19d3b5840d7c629c2796b0de5cb1837d. A fresh hosted review and CI are required on the new head.

Interaction fixture isolation

The interaction-boundary fixture now mocks only the delivered-command recorder, preserving the SDK module’s other exports, as the sibling native-command suites do. The production autocomplete and transcript code are unchanged, and the exact test-model assertion remains intact. Previously, a status interaction used the real persistence path, which initialized the global runtime config from the test environment; later autocomplete preferred that snapshot over the fixture config. This was fixture contamination, not a stored model override.

The original fixture fails with gpt-6-astra instead of test-model. With recorder isolation, the complete native-command selection passes three times: 122 tests across 10 files each, in 62.74s, 41.95s, and 43.37s total runner wall time.

A discriminating control kept the real recorder and pinned the fixture config the way Gateway startup does: 12/12 passed, including an immediate status → autocomplete check on the same client and an assertion that recording preserved the runtime snapshot. This distinguishes missing fixture isolation from a production model-resolution change.

Section accessory capture

The late review finding is repaired at the component text traversal: native replies now retain a Section accessory’s visible button label while continuing to omit custom IDs. The existing Components V2 delivery regression now exercises a Section with text Actions and button label Read; on the prior traversal it failed because Read was missing.

After the accessory repair, the complete native-command selection passes 122 tests across 10 files, three times (42.55s, 43.07s, 43.45s runner wall time), in the same secretless container. The pre-fix accessory control had 1 failure / 15 passes, failing specifically because the delivered Read label was absent from capture.

@clawsweeper

clawsweeper Bot commented Oct 11, 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.

@obviyus

obviyus commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord size: M labels Oct 11, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR retains delivered Discord native command replies and model-picker interactions in conversation history.

Example: A Discord native plugin reply contains a Section with text “Actions” and an accessory button labeled “Read”.

  • Before: The delivered native exchange is absent from conversation history.
  • After: History retains the command and “Actions\nRead” while excluding the button’s custom ID.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused implementation and repaired regressions support correctness, but native delivery-to-history behavior is demonstrated only through mocked adapter boundaries.
Proof confidence 🦐 gold shrimp (3/6) Under the supplied maintainer-authored classification, the ordinary contributor proof gate does not apply; native adapter coverage uses recorder mocks, and the reported real Discord text-command run does not exercise the changed native paths.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Delivered native Discord commands and replies disappear from later model context and conversation history.
Reason: Discord transcript continuity has clear user value, and the implementation extends the already merged recording contract within a focused channel scope.

Merge readiness

✅ Ready for maintainer review

This PR addresses a concrete gap still present on main, and the previously reported capture and fixture defects are repaired; no remaining discrete correctness finding was identified.

Priority: P2
Reviewed head: 76da48b3704c1ce78fa0f24ca82c171a13e9a8f5

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: A real native Discord slash-command or picker exchange appearing in history and the next provider request remains unshown; the supplied live text-command run exercises shared dispatch.
Agent review details

How this fits together

Discord’s native interaction adapters receive commands and component clicks, deliver replies through Discord, then pass visible text and the target session to the existing shared transcript recorder for later history and model requests.

flowchart TD
A[Discord command or picker click] --> B[Native interaction adapter]
B --> C[Discord reply delivery]
C --> D[Visible delivered text]
D --> E[Shared command recorder]
E --> F[Session transcript]
F --> G[History and later model requests]
Loading

Technical review

Best possible solution:

Retain the focused Discord adapters using the existing post-delivery recorder and preserve transport visibility, redaction, and session targeting.

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

Current main’s direct native status, menu, picker, and plugin paths omit transcript capture; source establishes the failure path, while the reported negative controls support the adapter regressions.

Is this the best way to solve the issue?

The patch uses the established capture owner at successful delivery boundaries and preserves the intentional direct status path instead of forcing native replies through a competing dispatcher.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Discord direct native status delivery keeps the original intent (fix(discord): return native status replies directly #66434: Return the real status card directly because generic dispatch can produce no visible status reply.)
  • Discord follow-up visibility and structured reply delivery keeps the original intent (19354c9: Keep all slash-command follow-ups ephemeral and avoid exposing status details publicly.)
  • Documented native transcript coverage changes intended behavior with a stated reason (289d859: The foundation covered shared dispatch and Telegram while explicitly deferring native Discord adapters.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 289d859 adds src/config/sessions/command-transcript.ts:35 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 289d859c2bab; files: src/config/sessions/command-transcript.ts)

PR surface

Source +156, Tests +138, Docs +1. Total +295 across 14 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 5 183 27 +156
Tests 6 140 2 +138
Docs 3 12 11 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 14 335 40 +295

Review metrics

Metric Value Why it matters
Production versus test changes Production +183/-27 LOC; tests +140/-2 LOC Production growth connects native delivery paths to one existing recorder and extracts delivered component/embed text; tests extend existing adapter regressions without adding production-only test seams.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Missing native command exchanges affect later Discord conversation context and history, with limited channel-specific scope.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

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

  • Improve confidence with a real native Discord status or picker exchange shown in history and the next provider request, redacting IPs, API keys, phone numbers, and non-public endpoints.

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 (4 earlier review cycles)
  • reviewed 2026-10-11T15:46:13.055Z sha d4ae04c :: needs changes before merge. :: [P2] Record the delivered representation instead of legacy fallback text | [P2] Preserve exports or explain isolation in the new transcript mocks
  • reviewed 2026-10-11T16:01:19.820Z sha e5d5c64 :: needs changes before merge. :: none
  • reviewed 2026-10-11T16:10:19.983Z sha 920b852 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-11T16:28:01.665Z sha de6f928 :: needs changes before merge. :: [P3] Retain section accessory labels in command history

Reviewed October 11, 2026, 12:44 PM ET / 16:44 UTC (Revision 5).

@obviyus

obviyus commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review: e5d5c64 fixes delivered Components V2/embed capture and preserves mock exports. The assertion and mock-export ratchets pass; 93 focused Discord tests pass, including four delivery regressions that failed before the representation repair. The body records the real gpt-5-mini text-command proof and the manual-only native interaction gap.

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Oct 11, 2026
@obviyus

obviyus commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@obviyus

obviyus commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 11, 2026
@obviyus

obviyus commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 11, 2026
@obviyus
obviyus merged commit 62fbdc1 into main Oct 11, 2026
102 of 106 checks passed
@obviyus
obviyus deleted the fix/native-command-transcript-parity branch October 11, 2026 16:50
@obviyus

obviyus commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 62fbdc1. Discord native command replies are now part of the conversation the agent sees.

obviyus added a commit that referenced this pull request Oct 11, 2026
Mattermost native /model and /models replies and model-picker refreshes were visible to the user but never recorded, so the agent could not see them on later turns. This routes them through the shared command-exchange capture owner from #169026 after confirmed delivery, using worker-owned async session reads (including the derived-parent model). The selection confirmation and the picker refresh now share one command identity, so a selection is recorded once. The command identity helper moved into the command-transcript owner, so core and plugins use the same scoping. Proof is test-only, since there is no Mattermost live harness: 16 registered-handler cases fail on main and pass here, plus a persistence test with one user command and two assistant replies. This completes the slash-command parity work after #169026 (core and Telegram), #169200 (Discord) and #169236 (Slack).

Co-authored-by: Ayaan Zaidi <[email protected]>
steipete added a commit that referenced this pull request Oct 12, 2026
Native Discord status replies are recorded after delivery (#169200), which
advances the session activity timestamp. Keep exact equality for every owner
and lifecycle field, while requiring nondecreasing activity across both
status reads. Retain the runtime-effect and dispatch assertions.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…#169200)

Discord command replies sent directly through native paths (the status reply, argument menus, model picker opening, updates and selections, and plugin-command replies) were visible to the user but never recorded, so the agent could not see them on later turns. openclaw#169026 added the shared command-exchange capture owner for core dispatch and Telegram. This PR routes Discord's native direct sends through the same owner after confirmed delivery. The captured text is what the user saw, including Components V2, embed and Section.accessory labels, with no custom IDs. Redaction and conversation-scoped identities come from the owner. Real Discord proof via QA Lab with gpt-5-mini: /status sent as text, then a follow-up that the model answered from the status reply; the next provider request and chat.history contain both the command and the reply. Native slash interactions and component clicks need a human client, so they're covered by registered-entry-point regressions. Slack and Mattermost native paths follow in a separate PR.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
…w#169255)

Mattermost native /model and /models replies and model-picker refreshes were visible to the user but never recorded, so the agent could not see them on later turns. This routes them through the shared command-exchange capture owner from openclaw#169026 after confirmed delivery, using worker-owned async session reads (including the derived-parent model). The selection confirmation and the picker refresh now share one command identity, so a selection is recorded once. The command identity helper moved into the command-transcript owner, so core and plugins use the same scoping. Proof is test-only, since there is no Mattermost live harness: 16 registered-handler cases fail on main and pass here, plus a persistence test with one user command and two assistant replies. This completes the slash-command parity work after openclaw#169026 (core and Telegram), openclaw#169200 (Discord) and openclaw#169236 (Slack).

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
Native Discord status replies are recorded after delivery (openclaw#169200), which
advances the session activity timestamp. Keep exact equality for every owner
and lifecycle field, while requiring nondecreasing activity across both
status reads. Retain the runtime-effect and dispatch assertions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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.

1 participant