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:
justsisyphus
2026-01-16 11:33:25 +09:00
parent 8c7ec8eb24
commit a1d7acac17
3 changed files with 133 additions and 0 deletions
+4
View File
@@ -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)