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:
parent
440e53ad9d
commit
cc7160b3b5
@ -14,7 +14,7 @@ describe("sisyphus-task-retry", () => {
|
|||||||
|
|
||||||
const patternTexts = DELEGATE_TASK_ERROR_PATTERNS.map(p => p.pattern)
|
const patternTexts = DELEGATE_TASK_ERROR_PATTERNS.map(p => p.pattern)
|
||||||
expect(patternTexts).toContain("run_in_background")
|
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("category OR subagent_type")
|
||||||
expect(patternTexts).toContain("Unknown category")
|
expect(patternTexts).toContain("Unknown category")
|
||||||
expect(patternTexts).toContain("Unknown agent")
|
expect(patternTexts).toContain("Unknown agent")
|
||||||
@ -26,7 +26,7 @@ describe("sisyphus-task-retry", () => {
|
|||||||
// #when detecting error
|
// #when detecting error
|
||||||
// #then should return matching error info
|
// #then should return matching error info
|
||||||
it("should detect run_in_background missing error", () => {
|
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)
|
const result = detectDelegateTaskError(output)
|
||||||
|
|
||||||
@ -34,17 +34,17 @@ describe("sisyphus-task-retry", () => {
|
|||||||
expect(result?.errorType).toBe("missing_run_in_background")
|
expect(result?.errorType).toBe("missing_run_in_background")
|
||||||
})
|
})
|
||||||
|
|
||||||
it("should detect skills missing error", () => {
|
it("should detect load_skills missing error", () => {
|
||||||
const output = "❌ Invalid arguments: 'skills' parameter is REQUIRED. Use skills=[] if no skills needed."
|
const output = "[ERROR] Invalid arguments: 'load_skills' parameter is REQUIRED. Use load_skills=[] if no skills are needed."
|
||||||
|
|
||||||
const result = detectDelegateTaskError(output)
|
const result = detectDelegateTaskError(output)
|
||||||
|
|
||||||
expect(result).not.toBeNull()
|
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", () => {
|
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)
|
const result = detectDelegateTaskError(output)
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ describe("sisyphus-task-retry", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("should detect unknown category error", () => {
|
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)
|
const result = detectDelegateTaskError(output)
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ describe("sisyphus-task-retry", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it("should detect unknown agent error", () => {
|
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)
|
const result = detectDelegateTaskError(output)
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ describe("sisyphus-task-retry", () => {
|
|||||||
it("should provide fix for unknown category with available list", () => {
|
it("should provide fix for unknown category with available list", () => {
|
||||||
const errorInfo = {
|
const errorInfo = {
|
||||||
errorType: "unknown_category",
|
errorType: "unknown_category",
|
||||||
originalOutput: '❌ Unknown category: "bad". Available: visual-engineering, ultrabrain'
|
originalOutput: '[ERROR] Unknown category: "bad". Available: visual-engineering, ultrabrain'
|
||||||
}
|
}
|
||||||
|
|
||||||
const guidance = buildRetryGuidance(errorInfo)
|
const guidance = buildRetryGuidance(errorInfo)
|
||||||
@ -107,7 +107,7 @@ describe("sisyphus-task-retry", () => {
|
|||||||
it("should provide fix for unknown agent with available list", () => {
|
it("should provide fix for unknown agent with available list", () => {
|
||||||
const errorInfo = {
|
const errorInfo = {
|
||||||
errorType: "unknown_agent",
|
errorType: "unknown_agent",
|
||||||
originalOutput: '❌ Unknown agent: "fake". Available agents: explore, oracle'
|
originalOutput: '[ERROR] Unknown agent: "fake". Available agents: explore, oracle'
|
||||||
}
|
}
|
||||||
|
|
||||||
const guidance = buildRetryGuidance(errorInfo)
|
const guidance = buildRetryGuidance(errorInfo)
|
||||||
|
|||||||
@ -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)",
|
fixHint: "Add run_in_background=false (for delegation) or run_in_background=true (for parallel exploration)",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pattern: "skills",
|
pattern: "load_skills",
|
||||||
errorType: "missing_skills",
|
errorType: "missing_load_skills",
|
||||||
fixHint: "Add skills=[] parameter (empty array if no skills needed)",
|
fixHint: "Add load_skills=[] parameter (empty array if no skills needed). Note: Calling Skill tool does NOT populate this.",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
pattern: "category OR subagent_type",
|
pattern: "category OR subagent_type",
|
||||||
@ -60,7 +60,7 @@ export interface DetectedError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function detectDelegateTaskError(output: string): DetectedError | null {
|
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) {
|
for (const errorPattern of DELEGATE_TASK_ERROR_PATTERNS) {
|
||||||
if (output.includes(errorPattern.pattern)) {
|
if (output.includes(errorPattern.pattern)) {
|
||||||
@ -110,7 +110,7 @@ delegate_task(
|
|||||||
prompt="Detailed prompt...",
|
prompt="Detailed prompt...",
|
||||||
category="unspecified-low", // OR subagent_type="explore"
|
category="unspecified-low", // OR subagent_type="explore"
|
||||||
run_in_background=false,
|
run_in_background=false,
|
||||||
skills=[]
|
load_skills=[]
|
||||||
)
|
)
|
||||||
\`\`\`
|
\`\`\`
|
||||||
`
|
`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user