refactor: migrate delegate_task to task tool with metadata fixes
- Rename delegate_task tool to task across codebase (100 files) - Update model references: claude-opus-4-6 → 4-5, gpt-5.3-codex → 5.2-codex - Add tool-metadata-store to restore metadata overwritten by fromPlugin() - Add session ID polling for BackgroundManager task sessions - Await async ctx.metadata() calls in tool executors - Add ses_ prefix guard to getMessageDir for performance - Harden BackgroundManager with idle deferral and error handling - Fix duplicate task key in sisyphus-junior test object literals - Fix unawaited showOutputToUser in ast_grep_replace - Fix background=true → run_in_background=true in ultrawork prompt - Fix duplicate task/task references in docs and comments
This commit is contained in:
@@ -50,7 +50,7 @@ describe("category-skill-reminder hook", () => {
|
||||
|
||||
// then - reminder should be injected
|
||||
expect(output.output).toContain("[Category+Skill Reminder]")
|
||||
expect(output.output).toContain("delegate_task")
|
||||
expect(output.output).toContain("task")
|
||||
|
||||
clearSessionAgent(sessionID)
|
||||
})
|
||||
@@ -130,16 +130,16 @@ describe("category-skill-reminder hook", () => {
|
||||
})
|
||||
|
||||
describe("delegation tool tracking", () => {
|
||||
test("should NOT inject reminder if delegate_task is used", async () => {
|
||||
// given - sisyphus agent that uses delegate_task
|
||||
test("should NOT inject reminder if task is used", async () => {
|
||||
// given - sisyphus agent that uses task
|
||||
const hook = createHook()
|
||||
const sessionID = "delegation-session"
|
||||
updateSessionAgent(sessionID, "Sisyphus")
|
||||
|
||||
const output = { title: "", output: "result", metadata: {} }
|
||||
|
||||
// when - delegate_task is used, then more tool calls
|
||||
await hook["tool.execute.after"]({ tool: "delegate_task", sessionID, callID: "1" }, output)
|
||||
// when - task is used, then more tool calls
|
||||
await hook["tool.execute.after"]({ tool: "task", sessionID, callID: "1" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "2" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "3" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "4" }, output)
|
||||
@@ -329,15 +329,15 @@ describe("category-skill-reminder hook", () => {
|
||||
})
|
||||
|
||||
test("should handle delegation tool names case-insensitively", async () => {
|
||||
// given - sisyphus agent using DELEGATE_TASK in uppercase
|
||||
// given - sisyphus agent using TASK in uppercase
|
||||
const hook = createHook()
|
||||
const sessionID = "case-delegate-session"
|
||||
updateSessionAgent(sessionID, "Sisyphus")
|
||||
|
||||
const output = { title: "", output: "result", metadata: {} }
|
||||
|
||||
// when - DELEGATE_TASK in uppercase is used
|
||||
await hook["tool.execute.after"]({ tool: "DELEGATE_TASK", sessionID, callID: "1" }, output)
|
||||
// when - TASK in uppercase is used
|
||||
await hook["tool.execute.after"]({ tool: "TASK", sessionID, callID: "1" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "2" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "3" }, output)
|
||||
await hook["tool.execute.after"]({ tool: "edit", sessionID, callID: "4" }, output)
|
||||
|
||||
@@ -30,9 +30,8 @@ const DELEGATABLE_WORK_TOOLS = new Set([
|
||||
* Tools that indicate the agent is already using delegation properly.
|
||||
*/
|
||||
const DELEGATION_TOOLS = new Set([
|
||||
"delegate_task",
|
||||
"call_omo_agent",
|
||||
"task",
|
||||
"task",
|
||||
"call_omo_agent",
|
||||
])
|
||||
|
||||
function formatSkillNames(skills: AvailableSkill[], limit: number): string {
|
||||
@@ -63,7 +62,7 @@ function buildReminderMessage(availableSkills: AvailableSkill[]): string {
|
||||
"> User-installed skills OVERRIDE built-in defaults. ALWAYS prefer YOUR SKILLS when domain matches.",
|
||||
"",
|
||||
"```typescript",
|
||||
`delegate_task(category=\"visual-engineering\", load_skills=${loadSkills}, run_in_background=true)`,
|
||||
`task(category=\"visual-engineering\", load_skills=${loadSkills}, run_in_background=true)`,
|
||||
"```",
|
||||
"",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user