fix: resolve publish blockers for v3.7.4→v3.8.0 release

- Fix #1991 crash: optional chaining for task-history sessionID access
- Fix #1992 think-mode: add antigravity entries to HIGH_VARIANT_MAP
- Fix #1949 Copilot premium misattribution: use createInternalAgentTextPart
- Fix #1982 load_skills: pass directory to discoverSkills for project-level skills
- Fix command priority: sort scopePriority before .find(), project-first return
- Fix Google provider transform: apply in userFallbackModels path
- Fix ralph-loop TUI: optional chaining for event handler
- Fix runtime-fallback: unify dual fallback engines, remove HTTP 400 from retry,
  fix pendingFallbackModel stuck state, add priority gate to skip model-fallback
  when runtime-fallback is active
- Fix Prometheus task system: exempt from todowrite/todoread deny
- Fix background_output: default full_session to true
- Remove orphan hooks: hashline-edit-diff-enhancer (redundant with hashline_edit
  built-in diff), task-reminder (dead code)
- Remove orphan config entries: 3 stale hook names from Zod schema
- Fix disabled_hooks schema: accept arbitrary strings for forward compatibility
- Register json-error-recovery hook in tool-guard pipeline
- Add disabled_hooks gating for question-label-truncator, task-resume-info,
  claude-code-hooks
- Update test expectations to match new behavior
This commit is contained in:
YeonGyu-Kim
2026-02-21 16:24:18 +09:00
parent ee5df1683e
commit fe415319e5
33 changed files with 179 additions and 770 deletions
-59
View File
@@ -1,59 +0,0 @@
import type { PluginInput } from "@opencode-ai/plugin"
const TASK_TOOLS = new Set([
"task",
"task_create",
"task_list",
"task_get",
"task_update",
"task_delete",
])
const TURN_THRESHOLD = 10
const REMINDER_MESSAGE = `
The task tools haven't been used recently. If you're tracking work, use task with action=create/update (or task_create/task_update) to record progress.`
interface ToolExecuteInput {
tool: string
sessionID: string
callID: string
}
interface ToolExecuteOutput {
output: string
}
export function createTaskReminderHook(_ctx: PluginInput) {
const sessionCounters = new Map<string, number>()
const toolExecuteAfter = async (input: ToolExecuteInput, output: ToolExecuteOutput) => {
const { tool, sessionID } = input
const toolLower = tool.toLowerCase()
if (TASK_TOOLS.has(toolLower)) {
sessionCounters.set(sessionID, 0)
return
}
const currentCount = sessionCounters.get(sessionID) ?? 0
const newCount = currentCount + 1
if (newCount >= TURN_THRESHOLD) {
output.output += REMINDER_MESSAGE
sessionCounters.set(sessionID, 0)
} else {
sessionCounters.set(sessionID, newCount)
}
}
return {
"tool.execute.after": toolExecuteAfter,
event: async ({ event }: { event: { type: string; properties?: unknown } }) => {
if (event.type !== "session.deleted") return
const props = event.properties as { info?: { id?: string } } | undefined
const sessionId = props?.info?.id
if (!sessionId) return
sessionCounters.delete(sessionId)
},
}
}
-150
View File
@@ -1,150 +0,0 @@
import { describe, test, expect, beforeEach } from "bun:test"
import { createTaskReminderHook } from "./index"
import type { PluginInput } from "@opencode-ai/plugin"
const mockCtx = {} as PluginInput
describe("TaskReminderHook", () => {
let hook: ReturnType<typeof createTaskReminderHook>
beforeEach(() => {
hook = createTaskReminderHook(mockCtx)
})
test("does not inject reminder before 10 turns", async () => {
//#given
const sessionID = "test-session"
const output = { output: "Result" }
//#when
for (let i = 0; i < 9; i++) {
await hook["tool.execute.after"]?.(
{ tool: "bash", sessionID, callID: `call-${i}` },
output
)
}
//#then
expect(output.output).not.toContain("task tools haven't been used")
})
test("injects reminder after 10 turns without task tool usage", async () => {
//#given
const sessionID = "test-session"
const output = { output: "Result" }
//#when
for (let i = 0; i < 10; i++) {
await hook["tool.execute.after"]?.(
{ tool: "bash", sessionID, callID: `call-${i}` },
output
)
}
//#then
expect(output.output).toContain("task tools haven't been used")
})
test("resets counter when task tool is used", async () => {
//#given
const sessionID = "test-session"
const output = { output: "Result" }
//#when
for (let i = 0; i < 5; i++) {
await hook["tool.execute.after"]?.(
{ tool: "bash", sessionID, callID: `call-${i}` },
output
)
}
await hook["tool.execute.after"]?.(
{ tool: "task", sessionID, callID: "call-task" },
output
)
for (let i = 0; i < 9; i++) {
await hook["tool.execute.after"]?.(
{ tool: "bash", sessionID, callID: `call-after-${i}` },
output
)
}
//#then
expect(output.output).not.toContain("task tools haven't been used")
})
test("resets counter after injecting reminder", async () => {
//#given
const sessionID = "test-session"
const output1 = { output: "Result 1" }
const output2 = { output: "Result 2" }
//#when
for (let i = 0; i < 10; i++) {
await hook["tool.execute.after"]?.(
{ tool: "bash", sessionID, callID: `call-1-${i}` },
output1
)
}
for (let i = 0; i < 9; i++) {
await hook["tool.execute.after"]?.(
{ tool: "bash", sessionID, callID: `call-2-${i}` },
output2
)
}
//#then
expect(output1.output).toContain("task tools haven't been used")
expect(output2.output).not.toContain("task tools haven't been used")
})
test("tracks separate counters per session", async () => {
//#given
const session1 = "session-1"
const session2 = "session-2"
const output1 = { output: "Result 1" }
const output2 = { output: "Result 2" }
//#when
for (let i = 0; i < 10; i++) {
await hook["tool.execute.after"]?.(
{ tool: "bash", sessionID: session1, callID: `call-${i}` },
output1
)
}
for (let i = 0; i < 5; i++) {
await hook["tool.execute.after"]?.(
{ tool: "bash", sessionID: session2, callID: `call-${i}` },
output2
)
}
//#then
expect(output1.output).toContain("task tools haven't been used")
expect(output2.output).not.toContain("task tools haven't been used")
})
test("cleans up counters on session.deleted", async () => {
//#given
const sessionID = "test-session"
const output = { output: "Result" }
//#when
for (let i = 0; i < 10; i++) {
await hook["tool.execute.after"]?.(
{ tool: "bash", sessionID, callID: `call-${i}` },
output
)
}
await hook.event?.({ event: { type: "session.deleted", properties: { info: { id: sessionID } } } })
const outputAfterDelete = { output: "Result" }
for (let i = 0; i < 9; i++) {
await hook["tool.execute.after"]?.(
{ tool: "bash", sessionID, callID: `call-after-${i}` },
outputAfterDelete
)
}
//#then
expect(outputAfterDelete.output).not.toContain("task tools haven't been used")
})
})
-1
View File
@@ -1 +0,0 @@
export { createTaskReminderHook } from "./hook";