fix: store session agent in chat.message for prometheus-md-only hook
The prometheus-md-only hook was not enforcing file restrictions because getSessionAgent() returned undefined - setSessionAgent was only called in message.updated event which doesn't always provide agent info. - Add setSessionAgent call in chat.message hook when input.agent exists - Add session state tests for setSessionAgent/getSessionAgent - Add clearSessionAgent cleanup to prometheus-md-only tests This ensures prometheus-md-only hook can reliably identify Prometheus sessions and enforce .sisyphus/*.md write restrictions.
This commit is contained in:
@@ -310,6 +310,10 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
|
||||
},
|
||||
|
||||
"chat.message": async (input, output) => {
|
||||
if (input.agent) {
|
||||
setSessionAgent(input.sessionID, input.agent);
|
||||
}
|
||||
|
||||
const message = (output as { message: { variant?: string } }).message
|
||||
if (firstMessageVariantGate.shouldOverride(input.sessionID)) {
|
||||
const variant = resolveAgentVariant(pluginConfig, input.agent)
|
||||
|
||||
Reference in New Issue
Block a user