Skip to content

refactor: route bundled plugin session callers through seam#89129

Merged
jalehman merged 3 commits into
mainfrom
clawdbot-d02/31b-bundled-plugin-consumers-seam
Jun 14, 2026
Merged

refactor: route bundled plugin session callers through seam#89129
jalehman merged 3 commits into
mainfrom
clawdbot-d02/31b-bundled-plugin-consumers-seam

Conversation

@jalehman

@jalehman jalehman commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

What

Route the bundled plugin session/transcript consumer slice onto the 3.1a session accessor seam where the behavior is already narrow and entry-scoped. Refs #88838.

Why

This keeps the Path 3 / 3.1b bundled plugin consumer slice file-backed and behavior-preserving while removing avoidable whole-store mutations before the SQLite storage flip. The remaining true whole-store/partial-entry compatibility cases stay documented as follow-up design work rather than being hidden in source code.

Changes

  • Route plugin session reads through accessor
  • Route timestamp reads through accessor
  • Patch Discord model picker entries
  • Patch Discord thread-close matches
  • Patch Telegram model selections
  • Use entry setup helpers in tests

Real behavior proof

  • Behavior or issue addressed: Bundled plugin session consumers in PR refactor: route bundled plugin session callers through seam #89129 still load through the local OpenClaw gateway and preserve the Discord channel/session agent path after routing bundled callers through the session accessor seam.
  • Real environment tested: Local OpenClaw gateway on macOS from /Users/phaedrus/Projects/clawdbot, configured live Discord and Telegram accounts, PR head d951144 built into dist/index.js and loaded through the managed LaunchAgent on port 18789. After resolving the GitHub base conflict, the branch was rebased and pushed as final head 7975bc0 with focused post-rebase proof.
  • Exact steps or command run after this patch: Fetched the PR head, checked it out detached, ran pnpm build, restarted the gateway with pnpm openclaw gateway restart, verified pnpm openclaw status --json showed update.git.sha d951144, verified pnpm openclaw channels status --json showed Discord and Telegram running/connected, sent and read a Discord proof message with pnpm openclaw message send/read, then ran pnpm openclaw agent --session-key agent:main:discord:channel:1480658992731521298 --deliver --reply-channel discord --reply-to channel:1480658992731521298 --json. Post-rebase at final head 7975bc0, reran node scripts/check-session-accessor-boundary.mjs, pnpm plugin-sdk:api:check, git diff --check, targeted node scripts/run-vitest.mjs bundled Discord/Telegram/WhatsApp/plugin-SDK/runtime guard tests, targeted oxfmt, targeted oxlint, pnpm tsgo:extensions, and pnpm tsgo:core.
  • Evidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output): Terminal output showed Discord send messageId 1515787546171412692, Discord readback content "PR refactor: route bundled plugin session callers through seam #89129 live proof ping from d951144: Discord bundled plugin is running after branch reload.", agent runId 82ed3ae8-7688-4924-a4e4-3b41f4e5e2d9, sessionId 6e8d619d-10c7-4bef-b866-4f172ed68ee2, deliverySucceeded true, delivered message 1515787692233855147, and readback content "PR 89129 Discord session proof OK." Gateway logs also showed sessionKey agent:main:discord:channel:1480658992731521298 processing -> idle, run_completed, and message.delivery.completed for channel discord. Post-rebase terminal proof showed the accessor guard passed, plugin SDK API baseline check passed, and the targeted Vitest run passed 5 shards / 8 files / 201 tests.
  • Observed result after fix: The PR-built gateway started bundled Discord and Telegram plugins, Discord direct send/read worked, and a real model-backed Discord session turn completed and delivered back to the configured Discord channel using the existing bundled channel session. The final rebased head 7975bc0, rebased onto current main 3563850, preserved the bundled-consumer/accessor slice, including the Telegram injected-session dependency adapter, and passed the focused guard/API/unit/type/lint/format proof.
  • What was not tested: Native Discord model-picker button selection, Discord thread close UI, native Telegram callback/menu interaction, WhatsApp runtime login, and a second live gateway run on the post-rebase SHA.
  • Proof limitations or environment constraints: The live gateway was restored to main fc6d448 after live proof. The live behavior proof was collected before the conflict-resolution rebase; the post-rebase branch changed only the same bundled-consumer/accessor slice and its guard resolution, and was covered by focused non-live proof.
  • Before evidence (optional but encouraged): Before loading this PR head, the same local gateway was running main fc6d448; GitHub reported the pre-rebase PR head as DIRTY/CONFLICTING, which is why the branch was subsequently rebased.

Testing

  • node scripts/run-vitest.mjs extensions/discord/src/monitor/native-command.model-picker.test.ts extensions/discord/src/monitor/thread-session-close.test.ts extensions/telegram/src/bot.create-telegram-bot.test.ts extensions/whatsapp/src/auto-reply/monitor/group-activation.test.ts extensions/whatsapp/src/auto-reply/web-auto-reply-utils.test.ts
    • Passed: 157 tests across 3 shards.
  • node_modules/.bin/oxfmt --check extensions/discord/src/monitor/native-command-model-picker-apply.ts extensions/discord/src/monitor/native-command.model-picker.test.ts extensions/discord/src/monitor/thread-session-close.ts extensions/discord/src/monitor/thread-session-close.test.ts extensions/telegram/src/bot-handlers.runtime.ts extensions/telegram/src/bot.create-telegram-bot.test.ts extensions/whatsapp/src/auto-reply/web-auto-reply-utils.test.ts
    • Passed.
  • node scripts/run-oxlint.mjs extensions/discord/src/monitor/native-command-model-picker-apply.ts extensions/discord/src/monitor/native-command.model-picker.test.ts extensions/discord/src/monitor/thread-session-close.ts extensions/discord/src/monitor/thread-session-close.test.ts extensions/telegram/src/bot-handlers.runtime.ts extensions/telegram/src/bot.create-telegram-bot.test.ts extensions/whatsapp/src/auto-reply/web-auto-reply-utils.test.ts
    • Passed.
  • pnpm --dir . tsgo:extensions
    • Passed.
  • git diff --check
    • Passed.
  • /opt/homebrew/bin/timeout 900 /Users/phaedrus/Projects/prompts/skills/autoreview/scripts/autoreview --mode local --no-web-search
    • First run found a Discord thread-close stale-snapshot race; fixed with an atomic updatedAt/sessionId guard and regression test.
    • Rerun passed with no accepted/actionable findings.

Known follow-up: public SDK whole-store compatibility and WhatsApp activation-only scoped backfill remain tracked under the Path 3 whole-store design follow-up because they rely on mutable whole-store or partial-entry semantics.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web size: M maintainer Maintainer-authored PR labels Jun 1, 2026
@clawsweeper

clawsweeper Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 14, 2026, 3:17 PM ET / 19:17 UTC.

Summary
The branch reroutes bundled Discord and Telegram session reads/writes plus plugin SDK session read exports through the session accessor seam, with targeted tests and a boundary-guard update.

PR surface: Source +87, Tests +123, Other +30. Total +240 across 19 files.

Reproducibility: not applicable. this is a refactor/migration slice rather than a current-main bug report. The relevant proof is source comparison, focused validation, CI, and live behavior evidence from the PR body.

Review metrics: 1 noteworthy metric.

  • Public SDK Session Read Exports: 3 rerouted. getSessionEntry, listSessionEntries, and readSessionUpdatedAt now resolve through the accessor seam, so plugin API compatibility needs maintainer attention before merge.

Stored data model
Persistent data-model change detected: serialized state: extensions/discord/src/monitor/native-command-model-picker-apply.ts, serialized state: src/plugin-sdk/session-store-runtime.test.ts, serialized state: src/plugin-sdk/session-store-runtime.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
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:

  • Optionally capture Telegram Desktop model-selection callback proof before landing if maintainers want visible transport coverage.

Mantis proof suggestion
A native Telegram Desktop proof would cover the visible callback path not exercised by the current live Discord-focused proof. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

telegram desktop proof: verify selecting a Telegram model option updates the active session and edits the callback message correctly.

Risk before merge

  • [P1] The PR reroutes public plugin SDK session read exports, so third-party or bundled callers that depend on exact store-helper aliasing, clone, or store-resolution behavior need maintainer acceptance before merge.
  • [P1] Discord and Telegram session updates move from whole-store mutation to entry-scoped list/patch helpers; a semantic mismatch could stale, reset, or mis-associate existing session state.
  • [P1] The real proof covers a live Discord gateway/session path plus post-rebase validation, but it does not exercise native Telegram model-selection callbacks, Discord model-picker UI, Discord thread-close UI, or WhatsApp runtime login.

Maintainer options:

  1. Land As Staged Accessor Slice (recommended)
    Maintain the ordered migration plan and accept the SDK/session-state compatibility risk after reviewing the focused proof and green checks.
  2. Request Visible Callback Proof
    Ask for Telegram Desktop model-selection callback proof if maintainers want visible transport coverage before landing.
  3. Pause Under Migration Tracker
    Keep the branch open but unmerged if maintainers are not ready to expose this seam through bundled and SDK session callers yet.

Next step before merge

  • [P2] Keep this in maintainer review; there is no narrow automated repair target after the final-head proof and green checks.

Security
Cleared: The diff is a TypeScript session-accessor refactor plus tests and a local guard script update; it does not add dependency, workflow, secret, package lifecycle, downloaded artifact, or new code-execution surface.

Review details

Best possible solution:

Land this as the staged accessor-seam slice after maintainer acceptance of SDK/session-state compatibility risk, while keeping whole-store compatibility and the SQLite flip under the migration tracker.

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

Not applicable: this is a refactor/migration slice rather than a current-main bug report. The relevant proof is source comparison, focused validation, CI, and live behavior evidence from the PR body.

Is this the best way to solve the issue?

Yes: routing these bounded bundled/plugin SDK callers through the permanent accessor seam is the narrowest maintainable slice. Broader whole-store compatibility and SQLite storage decisions remain in the canonical migration tracker.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 356385045f8e.

Label changes

Label justifications:

  • P2: This is a normal-priority refactor in a session-state migration stack with limited but real channel and SDK blast radius.
  • merge-risk: 🚨 compatibility: The PR changes plugin SDK session read export behavior that bundled and third-party plugin callers may rely on.
  • merge-risk: 🚨 session-state: The PR changes how Discord and Telegram session entries are listed, patched, and reset.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes terminal/log proof from a real local gateway with live Discord and Telegram accounts plus final-head focused validation; it is sufficient for the main changed session path, with visible callback gaps noted separately.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes terminal/log proof from a real local gateway with live Discord and Telegram accounts plus final-head focused validation; it is sufficient for the main changed session path, with visible callback gaps noted separately.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR touches Telegram model-selection callback/session behavior that can be demonstrated in a short Telegram Desktop proof.
Evidence reviewed

PR surface:

Source +87, Tests +123, Other +30. Total +240 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 10 156 69 +87
Tests 8 155 32 +123
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 44 14 +30
Total 19 355 115 +240

What I checked:

  • Repository policy read: Read the full root policy plus scoped plugin, plugin SDK, plugin runtime, scripts, tests, and Telegram review guidance; the applicable guidance makes plugin SDK/session-state changes compatibility-sensitive and asks for real Telegram proof for callback/session behavior. (AGENTS.md:25, 356385045f8e)
  • Live PR state: GitHub reports head 7fe4d46 as mergeable and clean; 168 status entries had no failing, cancelled, pending, or action-required checks after filtering success/skipped/neutral completions. (7fe4d46ef135)
  • Current main still needs the slice: Current main still has bundled consumers using whole-store helpers such as Discord model picker updateSessionStore and Telegram loadSessionStore/resolveSessionStoreEntry, so the PR is not superseded by main. (extensions/discord/src/monitor/native-command-model-picker-apply.ts:8, 356385045f8e)
  • Accessor seam on current main: Current main has the permanent session accessor seam with alias-aware loadSessionEntry, listSessionEntries, and readSessionUpdatedAt, introduced by the merged gateway seam PR. (src/config/sessions/session-accessor.ts:160, 356385045f8e)
  • PR reroutes public SDK read exports: The PR head re-exports getSessionEntry, listSessionEntries, and readSessionUpdatedAt from session-accessor while leaving legacy loadSessionStore and write helpers available from the existing store facade. (src/plugin-sdk/session-store-runtime.ts:3, 7fe4d46ef135)
  • PR reroutes Discord session mutations: The PR head replaces Discord model picker whole-store mutation with patchSessionEntry fallback creation, and resets thread sessions by listing entries then patching only unchanged current entries. (extensions/discord/src/monitor/thread-session-close.ts:51, 7fe4d46ef135)

Likely related people:

  • jalehman: Authored the merged session accessor seam on current main and authored this PR's three session-accessor migration commits. (role: migration stack author and likely follow-up owner; confidence: high; commits: ef47dd610c87, 83c315da09e3, bfeca6e29663; files: src/config/sessions/session-accessor.ts, src/plugin-sdk/session-store-runtime.ts, extensions/discord/src/monitor/native-command-model-picker-apply.ts)
  • steipete: GitHub file history shows prior work on session entry workflow helpers and repeated session/plugin SDK and Discord model-picker touches relevant to the affected API surface. (role: session/plugin SDK area contributor; confidence: medium; commits: cabb55380f84, 6171b4254d41, 538d36eaaaa6; files: src/config/sessions/store.ts, src/plugin-sdk/session-store-runtime.ts, extensions/discord/src/monitor/native-command-model-picker-apply.ts)
  • vincentkoc: Authored the current-main revert that deferred the earlier session metadata SQLite flip, preserving the file-backed session paths this staged accessor stack is now migrating. (role: adjacent session migration contributor; confidence: medium; commits: 7f1d82ab2518; files: src/config/sessions/store.ts, src/config/sessions/session-accessor.ts)
  • obviyus: Recent GitHub history shows multiple Telegram handler and callback/runtime seam commits in the same touched Telegram module. (role: recent Telegram handler contributor; confidence: medium; commits: a956ab848146, 3078a8335d58, 9c6186de436c; files: extensions/telegram/src/bot-handlers.runtime.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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 1, 2026
@jalehman
jalehman marked this pull request as draft June 1, 2026 18:10
@jalehman
jalehman force-pushed the clawdbot-9c3/session-accessor-seam branch from f18f99c to b39023f Compare June 4, 2026 20:31
@jalehman
jalehman changed the base branch from clawdbot-9c3/session-accessor-seam to clawdbot-9c3-ce2/session-accessor-gateway-entry June 4, 2026 21:34
@jalehman
jalehman force-pushed the clawdbot-d02/31b-bundled-plugin-consumers-seam branch 2 times, most recently from 2676603 to ba74be8 Compare June 4, 2026 21:44
@jalehman
jalehman force-pushed the clawdbot-9c3-ce2/session-accessor-gateway-entry branch 2 times, most recently from 890d5e3 to b496b4b Compare June 10, 2026 22:16
@jalehman
jalehman force-pushed the clawdbot-d02/31b-bundled-plugin-consumers-seam branch from ba74be8 to 21255b3 Compare June 11, 2026 05:04
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels Jun 11, 2026
@jalehman

Copy link
Copy Markdown
Contributor Author

Follow-up: the plugin SDK API baseline needs regeneration on this branch (pnpm plugin-sdk:api:gen) after the wave-1 rebase — plugin-sdk:api:check CI will fail until then. Pending a pnpm-capable environment; tracked in the wave-1 status on #88838.

@jalehman
jalehman force-pushed the clawdbot-9c3-ce2/session-accessor-gateway-entry branch from 1e31abd to 094f9b5 Compare June 13, 2026 23:20
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. labels Jun 14, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 14, 2026
@jalehman
jalehman force-pushed the clawdbot-d02/31b-bundled-plugin-consumers-seam branch from 3c5b1b6 to 7fe4d46 Compare June 14, 2026 19:04
@jalehman jalehman self-assigned this Jun 14, 2026
@jalehman
jalehman force-pushed the clawdbot-d02/31b-bundled-plugin-consumers-seam branch from 7fe4d46 to 7975bc0 Compare June 14, 2026 19:21
@jalehman
jalehman merged commit f1b8827 into main Jun 14, 2026
167 checks passed
@jalehman
jalehman deleted the clawdbot-d02/31b-bundled-plugin-consumers-seam branch June 14, 2026 19:26
@jalehman

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Thanks @jalehman!

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 15, 2026
…#89129)

Merged via squash.

Prepared head SHA: 7975bc0
Co-authored-by: jalehman <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
wangmiao0668000666 pushed a commit to wangmiao0668000666/openclaw that referenced this pull request Jun 17, 2026
…#89129)

Merged via squash.

Prepared head SHA: 7975bc0
Co-authored-by: jalehman <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
crh-code pushed a commit to crh-code/openclaw that referenced this pull request Jun 18, 2026
…#89129)

Merged via squash.

Prepared head SHA: 7975bc0
Co-authored-by: jalehman <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
badgerbees pushed a commit to badgerbees/openclaw that referenced this pull request Jul 8, 2026
…#89129)

Merged via squash.

Prepared head SHA: 7975bc0
Co-authored-by: jalehman <[email protected]>
Co-authored-by: jalehman <[email protected]>
Reviewed-by: @jalehman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web maintainer Maintainer-authored PR mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts 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