變更摘要

Agent: programmer (programmer)
Confidence: 53%
Cost: $1.3174
Duration: 3m 58s
Task ID: 38258984-4777-4e43-aa26-901923d31063


All done. Here’s a summary of the changes:

變更摘要

修改檔案

src/agents/worker-scheduler.ts — 1 file, +64/-2 lines

修改內容

  1. AgentTask.source type (line 112): Added 'handoff' to the union type

    • Before: 'manual' | 'scheduled' | 'agent-dispatch'
    • After: 'manual' | 'scheduled' | 'agent-dispatch' | 'handoff'
  2. enqueueTask opts (line 217-224): Extended optional parameters to support handoff metadata

    • Added: parentTaskId, originAgent, worktreePath, branchName
    • These fields are assigned to the new AgentTask during creation (lines 244-247)
  3. HANDOFF auto-dispatch block (lines 661-710): New logic after task completion log

    • Guard: !task.pipelineRunId && task.result — prevents double-dispatch with pipeline-engine.ts
    • Dynamic import of parseHandoff/stripHandoff from pipeline-engine.js
    • On valid handoff with intent === 'handoff': strips HANDOFF from result, builds downstream prompt with worktree context, enqueues downstream task(s)
    • ESCALATE target is logged but not dispatched
    • Entire block is wrapped in try-catch (non-fatal on failure)

驗證結果

  • tsgo --noEmit: 通過 (only pre-existing error in search-index.ts re: missing tail-read.js)
  • Commit: 4f32565 on branch agent/task-38258984

—HANDOFF—
TO: reviewer
INTENT: handoff
ARTIFACT_TYPE: code-change
SUMMARY: HANDOFF auto-dispatch for dispatch_task completed tasks in worker-scheduler.ts