fix(hooks): prevent start-work false trigger from command description

- Remove 'Start Sisyphus work session' text check, keep only <session-context> tag
- Update interactive_bash description with WARNING: TMUX ONLY emphasis
- Update tests to use <session-context> wrapper
This commit is contained in:
justsisyphus
2026-01-16 14:01:29 +09:00
parent d00c2e7439
commit 1ecb2bafdf
3 changed files with 25 additions and 29 deletions

View File

@@ -93,7 +93,7 @@ describe("start-work hook", () => {
const hook = createStartWorkHook(createMockPluginInput())
const output = {
parts: [{ type: "text", text: "Start Sisyphus work session" }],
parts: [{ type: "text", text: "<session-context></session-context>" }],
}
// #when
@@ -114,7 +114,7 @@ describe("start-work hook", () => {
parts: [
{
type: "text",
text: "Start Sisyphus work session\nSession: $SESSION_ID",
text: "<session-context>Session: $SESSION_ID</session-context>",
},
],
}
@@ -137,7 +137,7 @@ describe("start-work hook", () => {
parts: [
{
type: "text",
text: "Start Sisyphus work session\nTime: $TIMESTAMP",
text: "<session-context>Time: $TIMESTAMP</session-context>",
},
],
}
@@ -168,7 +168,7 @@ describe("start-work hook", () => {
const hook = createStartWorkHook(createMockPluginInput())
const output = {
parts: [{ type: "text", text: "Start Sisyphus work session" }],
parts: [{ type: "text", text: "<session-context></session-context>" }],
}
// #when
@@ -196,7 +196,7 @@ describe("start-work hook", () => {
const hook = createStartWorkHook(createMockPluginInput())
const output = {
parts: [{ type: "text", text: "Start Sisyphus work session" }],
parts: [{ type: "text", text: "<session-context></session-context>" }],
}
// #when
@@ -224,7 +224,7 @@ describe("start-work hook", () => {
const hook = createStartWorkHook(createMockPluginInput())
const output = {
parts: [{ type: "text", text: "Start Sisyphus work session" }],
parts: [{ type: "text", text: "<session-context></session-context>" }],
}
// #when
@@ -265,10 +265,9 @@ describe("start-work hook", () => {
parts: [
{
type: "text",
text: `Start Sisyphus work session
<user-request>
new-plan
</user-request>`,
text: `<session-context>
<user-request>new-plan</user-request>
</session-context>`,
},
],
}
@@ -298,10 +297,9 @@ new-plan
parts: [
{
type: "text",
text: `Start Sisyphus work session
<user-request>
my-feature-plan ultrawork
</user-request>`,
text: `<session-context>
<user-request>my-feature-plan ultrawork</user-request>
</session-context>`,
},
],
}
@@ -330,10 +328,9 @@ my-feature-plan ultrawork
parts: [
{
type: "text",
text: `Start Sisyphus work session
<user-request>
api-refactor ulw
</user-request>`,
text: `<session-context>
<user-request>api-refactor ulw</user-request>
</session-context>`,
},
],
}
@@ -362,10 +359,9 @@ api-refactor ulw
parts: [
{
type: "text",
text: `Start Sisyphus work session
<user-request>
feature-implementation
</user-request>`,
text: `<session-context>
<user-request>feature-implementation</user-request>
</session-context>`,
},
],
}
@@ -389,7 +385,7 @@ feature-implementation
const hook = createStartWorkHook(createMockPluginInput())
const output = {
parts: [{ type: "text", text: "Start Sisyphus work session" }],
parts: [{ type: "text", text: "<session-context></session-context>" }],
}
// #when - start-work command is processed

View File

@@ -59,9 +59,9 @@ export function createStartWorkHook(ctx: PluginInput) {
.join("\n")
.trim() || ""
const isStartWorkCommand =
promptText.includes("Start Sisyphus work session") ||
promptText.includes("<session-context>")
// Only trigger on actual command execution (contains <session-context> tag)
// NOT on description text like "Start Sisyphus work session from Prometheus plan"
const isStartWorkCommand = promptText.includes("<session-context>")
if (!isStartWorkCommand) {
return

View File

@@ -11,8 +11,8 @@ export const BLOCKED_TMUX_SUBCOMMANDS = [
"pipep",
]
export const INTERACTIVE_BASH_DESCRIPTION = `Execute tmux commands. Use "omo-{name}" session pattern.
export const INTERACTIVE_BASH_DESCRIPTION = `WARNING: This is TMUX ONLY. Pass tmux subcommands directly (without 'tmux' prefix).
For: server processes, long-running tasks, background jobs, interactive CLI tools.
Examples: new-session -d -s omo-dev, send-keys -t omo-dev "vim" Enter
Blocked (use bash instead): capture-pane, save-buffer, show-buffer, pipe-pane.`
For TUI apps needing ongoing interaction (vim, htop, pudb). One-shot commands → use Bash with &.`