openclaw/src/plugins
Vincent Koc 0954b6bf5f
fix(hooks): propagate ephemeral sessionId through embedded tool contexts (#32273)
* fix(plugins): expose ephemeral sessionId in tool contexts for per-conversation isolation

The plugin tool context (`OpenClawPluginToolContext`) and tool hook
context (`PluginHookToolContext`) only provided `sessionKey`, which
is a durable channel identifier that survives /new and /reset.
Plugins like mem0 that need per-conversation isolation (e.g. mapping
Mem0 `run_id`) had no way to distinguish between conversations,
causing session-scoped memories to persist unbounded across resets.

Add `sessionId` (ephemeral UUID regenerated on /new and /reset) to:
- `OpenClawPluginToolContext` (factory context for plugin tools)
- `PluginHookToolContext` (before_tool_call / after_tool_call hooks)
- Internal `HookContext` for tool call wrappers

Thread the value from the run attempt through createOpenClawCodingTools
→ createOpenClawTools → resolvePluginTools and through the tool hook
wrapper.

Closes #31253

Made-with: Cursor

* fix(agents): propagate embedded sessionId through tool hook context

* test(hooks): cover sessionId in embedded tool hook contexts

* docs(changelog): add sessionId hook context follow-up note

* test(hooks): avoid toolCallId collision in after_tool_call e2e

---------

Co-authored-by: SidQin-cyber <sidqin0410@gmail.com>
2026-03-02 15:11:51 -08:00
..
runtime Add runtime.stt.transcribeAudioFile for plugin STT access 2026-03-02 21:43:01 +00:00
bundled-dir.ts
bundled-sources.test.ts refactor: harden plugin install flow and main DM route pinning 2026-03-02 21:22:38 +00:00
bundled-sources.ts fix(plugins): allow hardlinks for bundled plugins (fixes #28175, #28404) (openclaw#32119) thanks @markfietje 2026-03-02 16:10:31 -06:00
cli.test.ts
cli.ts
commands.test.ts fix: harden plugin command registration + telegram menu guard (#31997) (thanks @liuxiaopai-ai) 2026-03-02 19:04:56 +00:00
commands.ts fix: harden plugin command registration + telegram menu guard (#31997) (thanks @liuxiaopai-ai) 2026-03-02 19:04:56 +00:00
config-schema.ts
config-state.test.ts refactor: dedupe cli config cron and install flows 2026-03-02 19:57:33 +00:00
config-state.ts
discovery.test.ts refactor(core): dedupe infra, media, pairing, and plugin helpers 2026-03-02 21:32:11 +00:00
discovery.ts fix(plugins): allow hardlinks for bundled plugins (fixes #28175, #28404) (openclaw#32119) thanks @markfietje 2026-03-02 16:10:31 -06:00
enable.test.ts
enable.ts
hook-runner-global.ts
hooks.before-agent-start.test.ts refactor: dedupe cli config cron and install flows 2026-03-02 19:57:33 +00:00
hooks.model-override-wiring.test.ts refactor: dedupe cli config cron and install flows 2026-03-02 19:57:33 +00:00
hooks.phase-hooks.test.ts
hooks.test-helpers.ts fix: restore helper imports and plugin hook test exports 2026-03-02 19:57:33 +00:00
hooks.ts
http-path.ts
http-registry.test.ts refactor(core): dedupe infra, media, pairing, and plugin helpers 2026-03-02 21:32:11 +00:00
http-registry.ts refactor(gateway): harden plugin http route contracts 2026-03-02 16:48:00 +00:00
install.test.ts test: micro-optimize slow suites and CLI command setup 2026-03-02 23:00:49 +00:00
install.ts refactor: harden plugin install flow and main DM route pinning 2026-03-02 21:22:38 +00:00
installs.test.ts
installs.ts refactor: dedupe cli config cron and install flows 2026-03-02 19:57:33 +00:00
loader.test.ts fix(plugins): allow hardlinks for bundled plugins (fixes #28175, #28404) (openclaw#32119) thanks @markfietje 2026-03-02 16:10:31 -06:00
loader.ts fix(plugins): allow hardlinks for bundled plugins (fixes #28175, #28404) (openclaw#32119) thanks @markfietje 2026-03-02 16:10:31 -06:00
logger.test.ts
logger.ts
manifest-registry.test.ts fix(plugins): allow hardlinks for bundled plugins (fixes #28175, #28404) (openclaw#32119) thanks @markfietje 2026-03-02 16:10:31 -06:00
manifest-registry.ts fix(plugins): allow hardlinks for bundled plugins (fixes #28175, #28404) (openclaw#32119) thanks @markfietje 2026-03-02 16:10:31 -06:00
manifest.ts fix(plugins): allow hardlinks for bundled plugins (fixes #28175, #28404) (openclaw#32119) thanks @markfietje 2026-03-02 16:10:31 -06:00
path-safety.ts fix(windows): normalize namespaced path containment checks 2026-02-26 18:49:48 +00:00
providers.ts
registry.ts refactor(gateway): harden plugin http route contracts 2026-03-02 16:48:00 +00:00
runtime.ts
schema-validator.ts perf(runtime): reduce startup import overhead in logging and schema validation 2026-03-02 18:21:13 +00:00
services.test.ts
services.ts
slots.test.ts
slots.ts
source-display.test.ts
source-display.ts
status.ts
toggle-config.ts
tools.optional.test.ts refactor(core): dedupe infra, media, pairing, and plugin helpers 2026-03-02 21:32:11 +00:00
tools.ts
types.ts fix(hooks): propagate ephemeral sessionId through embedded tool contexts (#32273) 2026-03-02 15:11:51 -08:00
uninstall.test.ts
uninstall.ts
update.test.ts refactor: harden plugin install flow and main DM route pinning 2026-03-02 21:22:38 +00:00
update.ts refactor: harden plugin install flow and main DM route pinning 2026-03-02 21:22:38 +00:00
voice-call.plugin.test.ts
wired-hooks-after-tool-call.e2e.test.ts fix(hooks): propagate ephemeral sessionId through embedded tool contexts (#32273) 2026-03-02 15:11:51 -08:00
wired-hooks-compaction.test.ts test: align compaction hook usage expectation 2026-02-26 22:03:26 +00:00
wired-hooks-gateway.test.ts
wired-hooks-llm.test.ts
wired-hooks-message.test.ts
wired-hooks-session.test.ts
wired-hooks-subagent.test.ts