Repository navigation
feat(hooks): add sessionMode option for persistent hook sessions - #27193
ryanrhughes wants to merge 1 commit into
Conversation
Greptile SummaryAdds optional
Confidence Score: 5/5
Last reviewed commit: 7788c2d |
88fa45f to
efd6af2
Compare
efd6af2 to
c6db22c
Compare
98dc373 to
a76dac5
Compare
a76dac5 to
434e34a
Compare
…nclaw#11665) Add sessionMode: 'isolated' | 'persistent' to hook mapping config. When set to 'persistent', hook sessions reuse existing sessionId for multi-turn conversation history. Default 'isolated' preserves current behavior. Transforms can also override sessionMode per-request. Fixes openclaw#11665
434e34a to
632de9a
Compare
|
Hi OpenClaw team — just wanted to bump this PR for review. We're hitting the exact same issue in production: routing per-group chat messages via The current docs say "Use a consistent key for multi-turn conversations in hook context", but the actual behavior doesn't match — each hook call starts a completely new session regardless of the key. This PR's Could this get a review and merge? Persistent hook sessions are a real need for any webhook integration that requires multi-turn context. Thanks! |
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Summary
Adds
sessionMode: "isolated" | "persistent"to hook mapping config, enabling multi-turn conversation history for webhook-dispatched sessions.Problem
Every hook dispatch creates a fresh session transcript, losing all conversation history. The
sessionKeypreserves metadata but not the conversation itself. This causes orphaned.jsonlfiles and breaks use cases like project management integrations where multiple webhooks (card created, assigned, commented) should share context.Solution
New optional
sessionModefield on hook mappings:isolated(default): fresh session per dispatch — current behavior, zero change for existing userspersistent: reuse existing sessionId when sessionKey matchesTransforms can also override
sessionModeper-request.Changes
src/config/types.hooks.ts— type definitionsrc/config/zod-schema.hooks.ts— schema validationsrc/gateway/hooks-mapping.ts— threaded through resolve/build/mergesrc/gateway/hooks.ts— payload normalizationsrc/gateway/server-http.ts— mapping dispatch pathsrc/gateway/server/hooks.ts— passed to isolated agent runnersrc/cron/isolated-agent/run.ts—forceNewrespectssessionModeTesting
persistent: 2 webhooks → same sessionId, 2 turns in 1 file ✅isolated: subsequent webhook → new sessionId, 1 turn ✅AI-Assisted
Built with Claude & ChatGPT (OpenClaw agents of course). Fully tested locally and live. We understand the full change.
Fixes #11665
Fixes #42332