Skip to content

Persist Discord thread bindings in SQLite - #88866

Merged
steipete merged 2 commits into
mainfrom
codex/sqlite-discord-thread-bindings
Jun 1, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/sqlite-discord-thread-bindings

Conversation

@steipete

@steipete steipete commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Persist Discord ACP thread bindings in the Discord plugin-state SQLite namespace instead of state/discord/thread-bindings.json.
  • Move legacy JSON handling into doctor migration detection, including startup guard detection and valid-empty cleanup.
  • Remove Discord model-picker runtime legacy JSON import so runtime reads canonical plugin-state only.
  • Update the live Discord ACP smoke script to poll the SQLite plugin-state store.

Verification

  • node scripts/run-vitest.mjs extensions/discord/src/monitor/thread-bindings.lifecycle.test.ts extensions/discord/src/monitor/model-picker-preferences.test.ts extensions/discord/src/monitor/model-picker-preferences-migrations.test.ts src/cli/program/config-guard.test.ts
  • node scripts/run-tsgo.mjs -p extensions/discord/tsconfig.json --incremental --tsBuildInfoFile /tmp/openclaw-discord-thread-bindings.tsbuildinfo
  • node scripts/run-oxlint.mjs extensions/discord/src/monitor/thread-bindings.state.ts extensions/discord/src/monitor/thread-bindings.manager.ts extensions/discord/src/monitor/thread-bindings.lifecycle.test.ts extensions/discord/src/monitor/model-picker-preferences.ts extensions/discord/src/monitor/model-picker-preferences.test.ts extensions/discord/src/monitor/model-picker-preferences-migrations.ts extensions/discord/src/monitor/model-picker-preferences-migrations.test.ts src/cli/program/config-guard.ts src/cli/program/config-guard.test.ts scripts/dev/discord-acp-plain-language-smoke.ts
  • git diff --check
  • /Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --mode branch --base origin/main

Notes

  • Full pnpm lint --threads=8 is blocked on existing extensions/microsoft-foundry/provider.ts lint findings on latest main, unrelated to this branch.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord cli CLI command changes scripts Repository scripts size: L maintainer Maintainer-authored PR labels Jun 1, 2026
@steipete

steipete commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Ready to land.

Exact head: 007a06a807e63ea395a378220ec0f30a55d68986

Local proof:

  • node scripts/run-vitest.mjs extensions/discord/src/monitor/thread-bindings.lifecycle.test.ts extensions/discord/src/monitor/model-picker-preferences.test.ts extensions/discord/src/monitor/model-picker-preferences-migrations.test.ts src/cli/program/config-guard.test.ts
  • node scripts/run-tsgo.mjs -p extensions/discord/tsconfig.json --incremental --tsBuildInfoFile /tmp/openclaw-discord-thread-bindings.tsbuildinfo
  • node scripts/run-oxlint.mjs extensions/discord/src/monitor/thread-bindings.state.ts extensions/discord/src/monitor/thread-bindings.manager.ts extensions/discord/src/monitor/thread-bindings.lifecycle.test.ts extensions/discord/src/monitor/model-picker-preferences.ts extensions/discord/src/monitor/model-picker-preferences.test.ts extensions/discord/src/monitor/model-picker-preferences-migrations.ts extensions/discord/src/monitor/model-picker-preferences-migrations.test.ts src/cli/program/config-guard.ts src/cli/program/config-guard.test.ts scripts/dev/discord-acp-plain-language-smoke.ts
  • git diff --check
  • /Users/steipete/Projects/agent-scripts/skills/autoreview/scripts/autoreview --mode branch --base origin/main

GitHub proof:

  • Real behavior proof, dependency guard, OpenGrep changed-path scan, actionlint, no-tabs, label, preflight, and security-fast passed on this head.
  • Expanded CI/security matrix jobs were still queued/pending when checked.

Known gaps:

  • No live Discord ACP smoke run; the smoke script was updated to read plugin-state SQLite and covered by lint/static proof.
  • Full pnpm lint --threads=8 is blocked by existing unrelated extensions/microsoft-foundry/provider.ts lint findings on latest main.

@steipete
steipete merged commit e72def6 into main Jun 1, 2026
190 of 196 checks passed
@steipete
steipete deleted the codex/sqlite-discord-thread-bindings branch June 1, 2026 02:10

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 007a06a807

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +596 to +600
const store = createPluginStateKeyedStore<ThreadBindingRecord>("discord", {
namespace: THREAD_BINDINGS_NAMESPACE,
maxEntries: THREAD_BINDINGS_MAX_ENTRIES,
env: { ...process.env, OPENCLAW_STATE_DIR: stateDir },
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the Discord smoke off the Bun-only SQLite path

In the documented manual path (docs/help/testing.md invokes this script with bun), this polling code now goes through createPluginStateKeyedStore, which opens the OpenClaw state DB via requireNodeSqlite() in src/infra/node-sqlite.ts. Bun 1.2.x does not provide node:sqlite, so each binding poll fails and is swallowed by the wait loop, making the smoke time out even after the bot creates a binding. Please either run this script under Node or use a Bun-compatible way to read the SQLite state.

Useful? React with 👍 / 👎.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 1, 2026
* refactor: persist discord thread bindings in sqlite

* test: read discord thread bindings from sqlite smoke
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
* refactor: persist discord thread bindings in sqlite

* test: read discord thread bindings from sqlite smoke
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord cli CLI command changes maintainer Maintainer-authored PR scripts Repository scripts size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant