refactor(hooks): update delegate-task-retry naming consistency

Rename agent parameter to subagent_type for consistency with delegate-task tool changes.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
justsisyphus 2026-01-22 22:47:01 +09:00
parent 440e53ad9d
commit cc7160b3b5
2 changed files with 15 additions and 15 deletions

View File

@ -14,7 +14,7 @@ describe("sisyphus-task-retry", () => {
const patternTexts = DELEGATE_TASK_ERROR_PATTERNS.map(p => p.pattern)
expect(patternTexts).toContain("run_in_background")
expect(patternTexts).toContain("skills")
expect(patternTexts).toContain("load_skills")
expect(patternTexts).toContain("category OR subagent_type")
expect(patternTexts).toContain("Unknown category")
expect(patternTexts).toContain("Unknown agent")
@ -26,7 +26,7 @@ describe("sisyphus-task-retry", () => {
// #when detecting error
// #then should return matching error info
it("should detect run_in_background missing error", () => {
const output = " Invalid arguments: 'run_in_background' parameter is REQUIRED. Use run_in_background=false for task delegation."
const output = "[ERROR] Invalid arguments: 'run_in_background' parameter is REQUIRED. Use run_in_background=false for task delegation."
const result = detectDelegateTaskError(output)
@ -34,17 +34,17 @@ describe("sisyphus-task-retry", () => {
expect(result?.errorType).toBe("missing_run_in_background")
})
it("should detect skills missing error", () => {
const output = "❌ Invalid arguments: 'skills' parameter is REQUIRED. Use skills=[] if no skills needed."
it("should detect load_skills missing error", () => {
const output = "[ERROR] Invalid arguments: 'load_skills' parameter is REQUIRED. Use load_skills=[] if no skills are needed."
const result = detectDelegateTaskError(output)
expect(result).not.toBeNull()
expect(result?.errorType).toBe("missing_skills")
expect(result?.errorType).toBe("missing_load_skills")
})
it("should detect category/subagent mutual exclusion error", () => {
const output = " Invalid arguments: Provide EITHER category OR subagent_type, not both."
const output = "[ERROR] Invalid arguments: Provide EITHER category OR subagent_type, not both."
const result = detectDelegateTaskError(output)
@ -53,7 +53,7 @@ describe("sisyphus-task-retry", () => {
})
it("should detect unknown category error", () => {
const output = ' Unknown category: "invalid-cat". Available: visual-engineering, ultrabrain, quick'
const output = '[ERROR] Unknown category: "invalid-cat". Available: visual-engineering, ultrabrain, quick'
const result = detectDelegateTaskError(output)
@ -62,7 +62,7 @@ describe("sisyphus-task-retry", () => {
})
it("should detect unknown agent error", () => {
const output = ' Unknown agent: "fake-agent". Available agents: explore, librarian, oracle'
const output = '[ERROR] Unknown agent: "fake-agent". Available agents: explore, librarian, oracle'
const result = detectDelegateTaskError(output)
@ -95,7 +95,7 @@ describe("sisyphus-task-retry", () => {
it("should provide fix for unknown category with available list", () => {
const errorInfo = {
errorType: "unknown_category",
originalOutput: ' Unknown category: "bad". Available: visual-engineering, ultrabrain'
originalOutput: '[ERROR] Unknown category: "bad". Available: visual-engineering, ultrabrain'
}
const guidance = buildRetryGuidance(errorInfo)
@ -107,7 +107,7 @@ describe("sisyphus-task-retry", () => {
it("should provide fix for unknown agent with available list", () => {
const errorInfo = {
errorType: "unknown_agent",
originalOutput: ' Unknown agent: "fake". Available agents: explore, oracle'
originalOutput: '[ERROR] Unknown agent: "fake". Available agents: explore, oracle'
}
const guidance = buildRetryGuidance(errorInfo)

View File

@ -13,9 +13,9 @@ export const DELEGATE_TASK_ERROR_PATTERNS: DelegateTaskErrorPattern[] = [
fixHint: "Add run_in_background=false (for delegation) or run_in_background=true (for parallel exploration)",
},
{
pattern: "skills",
errorType: "missing_skills",
fixHint: "Add skills=[] parameter (empty array if no skills needed)",
pattern: "load_skills",
errorType: "missing_load_skills",
fixHint: "Add load_skills=[] parameter (empty array if no skills needed). Note: Calling Skill tool does NOT populate this.",
},
{
pattern: "category OR subagent_type",
@ -60,7 +60,7 @@ export interface DetectedError {
}
export function detectDelegateTaskError(output: string): DetectedError | null {
if (!output.includes("")) return null
if (!output.includes("[ERROR]") && !output.includes("Invalid arguments")) return null
for (const errorPattern of DELEGATE_TASK_ERROR_PATTERNS) {
if (output.includes(errorPattern.pattern)) {
@ -110,7 +110,7 @@ delegate_task(
prompt="Detailed prompt...",
category="unspecified-low", // OR subagent_type="explore"
run_in_background=false,
skills=[]
load_skills=[]
)
\`\`\`
`