refactor(hooks): rename sisyphus-gpt-hephaestus-reminder to no-sisyphus-gpt

Shorter hook name, disableable via disabled_hooks config, migration added
for backward compatibility. Also forces agent switch to Hephaestus on
Sisyphus + GPT detection. Docs updated with new hook name.
This commit is contained in:
YeonGyu-Kim
2026-02-18 16:33:16 +09:00
parent 27ed1664e9
commit 2fbee82494
11 changed files with 57 additions and 26 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ export { createInteractiveBashSessionHook } from "./interactive-bash-session";
export { createThinkingBlockValidatorHook } from "./thinking-block-validator";
export { createCategorySkillReminderHook } from "./category-skill-reminder";
export { createRalphLoopHook, type RalphLoopHook } from "./ralph-loop";
export { createSisyphusGptHephaestusReminderHook } from "./sisyphus-gpt-hephaestus-reminder";
export { createNoSisyphusGptHook } from "./no-sisyphus-gpt";
export { createAutoSlashCommandHook } from "./auto-slash-command";
export { createEditErrorRecoveryHook } from "./edit-error-recovery";
export { createJsonErrorRecoveryHook } from "./json-error-recovery";
@@ -1,8 +1,8 @@
import type { PluginInput } from "@opencode-ai/plugin"
import { isGptModel } from "../../agents/types"
import { getSessionAgent } from "../../features/claude-code-session-state"
import { getSessionAgent, updateSessionAgent } from "../../features/claude-code-session-state"
import { log } from "../../shared"
import { getAgentConfigKey } from "../../shared/agent-display-names"
import { getAgentConfigKey, getAgentDisplayName } from "../../shared/agent-display-names"
const TOAST_TITLE = "NEVER Use Sisyphus with GPT"
const TOAST_MESSAGE = [
@@ -11,6 +11,7 @@ const TOAST_MESSAGE = [
"You are literally burning money.",
"Use Hephaestus for GPT models instead.",
].join("\n")
const HEPHAESTUS_DISPLAY = getAgentDisplayName("hephaestus")
function showToast(ctx: PluginInput, sessionID: string): void {
ctx.client.tui.showToast({
@@ -21,19 +22,21 @@ function showToast(ctx: PluginInput, sessionID: string): void {
duration: 10000,
},
}).catch((error) => {
log("[sisyphus-gpt-hephaestus-reminder] Failed to show toast", {
log("[no-sisyphus-gpt] Failed to show toast", {
sessionID,
error,
})
})
}
export function createSisyphusGptHephaestusReminderHook(ctx: PluginInput) {
export function createNoSisyphusGptHook(ctx: PluginInput) {
return {
"chat.message": async (input: {
sessionID: string
agent?: string
model?: { providerID: string; modelID: string }
}, output?: {
message?: { agent?: string; [key: string]: unknown }
}): Promise<void> => {
const rawAgent = input.agent ?? getSessionAgent(input.sessionID) ?? ""
const agentKey = getAgentConfigKey(rawAgent)
@@ -41,6 +44,11 @@ export function createSisyphusGptHephaestusReminderHook(ctx: PluginInput) {
if (agentKey === "sisyphus" && modelID && isGptModel(modelID)) {
showToast(ctx, input.sessionID)
input.agent = HEPHAESTUS_DISPLAY
if (output?.message) {
output.message.agent = HEPHAESTUS_DISPLAY
}
updateSessionAgent(input.sessionID, HEPHAESTUS_DISPLAY)
}
},
}
@@ -1,33 +1,45 @@
import { describe, expect, spyOn, test } from "bun:test"
import { _resetForTesting, updateSessionAgent } from "../../features/claude-code-session-state"
import { getAgentDisplayName } from "../../shared/agent-display-names"
import { createSisyphusGptHephaestusReminderHook } from "./index"
import { createNoSisyphusGptHook } from "./index"
const SISYPHUS_DISPLAY = getAgentDisplayName("sisyphus")
const HEPHAESTUS_DISPLAY = getAgentDisplayName("hephaestus")
describe("sisyphus-gpt-hephaestus-reminder hook", () => {
function createOutput() {
return {
message: {},
parts: [],
}
}
describe("no-sisyphus-gpt hook", () => {
test("shows toast on every chat.message when sisyphus uses gpt model", async () => {
// given - sisyphus (display name) with gpt model
const showToast = spyOn({ fn: async () => ({}) }, "fn")
const hook = createSisyphusGptHephaestusReminderHook({
const hook = createNoSisyphusGptHook({
client: { tui: { showToast } },
} as any)
const output1 = createOutput()
const output2 = createOutput()
// when - chat.message is called repeatedly with display name
await hook["chat.message"]?.({
sessionID: "ses_1",
agent: SISYPHUS_DISPLAY,
model: { providerID: "openai", modelID: "gpt-5.3-codex" },
})
}, output1)
await hook["chat.message"]?.({
sessionID: "ses_1",
agent: SISYPHUS_DISPLAY,
model: { providerID: "openai", modelID: "gpt-5.3-codex" },
})
}, output2)
// then - toast is shown for every message
expect(showToast).toHaveBeenCalledTimes(2)
expect(output1.message.agent).toBe(HEPHAESTUS_DISPLAY)
expect(output2.message.agent).toBe(HEPHAESTUS_DISPLAY)
expect(showToast.mock.calls[0]?.[0]).toMatchObject({
body: {
title: "NEVER Use Sisyphus with GPT",
@@ -40,37 +52,43 @@ describe("sisyphus-gpt-hephaestus-reminder hook", () => {
test("does not show toast for non-gpt model", async () => {
// given - sisyphus with claude model
const showToast = spyOn({ fn: async () => ({}) }, "fn")
const hook = createSisyphusGptHephaestusReminderHook({
const hook = createNoSisyphusGptHook({
client: { tui: { showToast } },
} as any)
const output = createOutput()
// when - chat.message runs
await hook["chat.message"]?.({
sessionID: "ses_2",
agent: SISYPHUS_DISPLAY,
model: { providerID: "anthropic", modelID: "claude-opus-4-6" },
})
}, output)
// then - no toast
expect(showToast).toHaveBeenCalledTimes(0)
expect(output.message.agent).toBeUndefined()
})
test("does not show toast for non-sisyphus agent", async () => {
// given - hephaestus with gpt model
const showToast = spyOn({ fn: async () => ({}) }, "fn")
const hook = createSisyphusGptHephaestusReminderHook({
const hook = createNoSisyphusGptHook({
client: { tui: { showToast } },
} as any)
const output = createOutput()
// when - chat.message runs
await hook["chat.message"]?.({
sessionID: "ses_3",
agent: HEPHAESTUS_DISPLAY,
model: { providerID: "openai", modelID: "gpt-5.2" },
})
}, output)
// then - no toast
expect(showToast).toHaveBeenCalledTimes(0)
expect(output.message.agent).toBeUndefined()
})
test("uses session agent fallback when input agent is missing", async () => {
@@ -78,17 +96,20 @@ describe("sisyphus-gpt-hephaestus-reminder hook", () => {
_resetForTesting()
updateSessionAgent("ses_4", SISYPHUS_DISPLAY)
const showToast = spyOn({ fn: async () => ({}) }, "fn")
const hook = createSisyphusGptHephaestusReminderHook({
const hook = createNoSisyphusGptHook({
client: { tui: { showToast } },
} as any)
const output = createOutput()
// when - chat.message runs without input.agent
await hook["chat.message"]?.({
sessionID: "ses_4",
model: { providerID: "openai", modelID: "gpt-5.2" },
})
}, output)
// then - toast shown via session-agent fallback
expect(showToast).toHaveBeenCalledTimes(1)
expect(output.message.agent).toBe(HEPHAESTUS_DISPLAY)
})
})
+1
View File
@@ -0,0 +1 @@
export { createNoSisyphusGptHook } from "./hook"
@@ -1 +0,0 @@
export { createSisyphusGptHephaestusReminderHook } from "./hook"