fix: include sessionKey in session_start/session_end hook context#23525
fix: include sessionKey in session_start/session_end hook context#23525p697 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
arosstale
left a comment
There was a problem hiding this comment.
Correct fix. session_start and session_end hooks were missing sessionKey in the payload, making it impossible for plugins to correlate hook events back to a specific session or routing context. Import ordering cleanup is cosmetic but welcome.
|
Thanks @arosstale! Good catch on the import ordering — that was actually unintentional. Our local oxfmt was on 0.32.0 while CI uses 0.34.0, so the pre-commit hook reformatted imports with the wrong rules. Updated to 0.34.0 and pushed a fix. |
The PluginHookSessionContext type was missing sessionKey, making it impossible for plugins to use session-scoped APIs (e.g. enqueueSystemEvent) from session lifecycle hooks. - Add sessionKey to PluginHookSessionContext type - Pass sessionKey in runSessionStart and runSessionEnd calls - Update tests to verify sessionKey is forwarded
7db7482 to
90379df
Compare
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Problem
PluginHookSessionContext(used bysession_startandsession_endhooks) was missingsessionKey, while other hook context types likePluginHookAgentContextalready included it. This made it impossible for plugins to call session-scoped APIs such asenqueueSystemEventfrom session lifecycle hooks.Changes
sessionKey?: stringtoPluginHookSessionContexttype definitionsessionKeyin bothrunSessionStartandrunSessionEndcalls insession.tswired-hooks-session.test.tsto verifysessionKeyis forwardedUse Case
Plugins that need to inject system messages on session start (e.g., reminding the agent to read context files after
/newor/reset) currently cannot do so becauseenqueueSystemEventrequires asessionKeythat the hook context doesn't provide.Testing
npx vitest run src/plugins/wired-hooks-session.test.ts— 3/3 passednpx vitest run src/auto-reply/reply/session.test.ts— 34/34 passednpx tsc --noEmit— no new errorsGreptile Summary
Added
sessionKeytoPluginHookSessionContextto enable session-scoped API calls likeenqueueSystemEventfromsession_startandsession_endhooks. This aligns session hook contexts with other hook contexts (PluginHookAgentContextandPluginHookToolContext) which already includesessionKey.Confidence Score: 5/5
Last reviewed commit: 2fd6979
(4/5) You can add custom instructions or style guidelines for the agent here!