Skip to content

Commit 42bd8b9

Browse files
Chris Hassonhassoncs
authored andcommitted
fix: correctly report sub-task results in Orchestrator mode
The `rootTask` and `parentTask` properties in the `Task` class were incorrectly initialized, preventing sub-tasks from properly reporting their results back to the main Orchestrator task. This commit fixes the initialization to ensure correct task hierarchy and result propagation. The issue is with how TypeScript handles `readonly` properties when they have explicit initializers. Let me demonstrate: ```typescript readonly rootTask: Task | undefined readonly parentTask: Task | undefined ``` ```typescript readonly rootTask: Task | undefined = undefined readonly parentTask: Task | undefined = undefined ``` When you declare a `readonly` property with an explicit initializer like `= undefined`, TypeScript treats this as a **definitive assignment** that happens at the class field level, **before** the constructor runs. Here's what happens: 1. Class is instantiated 2. Constructor runs 3. `this.parentTask = parentTask` successfully assigns the parent task 4. Property now contains the actual parent task reference 1. Class is instantiated 2. **TypeScript immediately sets `this.parentTask = undefined` due to the field initializer** 3. Constructor runs 4. `this.parentTask = parentTask` tries to assign, but TypeScript may optimize this away or the field initializer takes precedence 5. Property remains `undefined` even though we tried to assign it Fixes RooCodeInc#1742
1 parent 2882d99 commit 42bd8b9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/heavy-jeans-ask.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"kilo-code": patch
3+
---
4+
5+
Fix bug preventing Orchestrator mode sub-tasks from reporting their results properly

src/core/task/Task.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
124124
readonly taskId: string
125125
readonly instanceId: string
126126

127-
readonly rootTask: Task | undefined = undefined
128-
readonly parentTask: Task | undefined = undefined
127+
readonly rootTask: Task | undefined
128+
readonly parentTask: Task | undefined
129129
readonly taskNumber: number
130130
readonly workspacePath: string
131131

0 commit comments

Comments
 (0)