fix: include sessionKey in session_start/session_end hook context#23525
Closed
p697 wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix: include sessionKey in session_start/session_end hook context#23525p697 wants to merge 1 commit intoopenclaw:mainfrom
p697 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
Author
|
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
18 tasks
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!