-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix(cli): return the real subagent answer instead of an empty task result #13493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@kilocode/cli": patch | ||
| --- | ||
|
|
||
| Fix the task tool intermittently returning an empty result. Subagents that ran with memory context had a synthetic marker part appended after their answer, which was picked up as the final text part and surfaced as an empty `<task_result>` to the parent agent. The task tool now ignores synthetic, ignored, and empty text parts, and background jobs no longer let an empty run overwrite an earlier successful result, so resumed tasks keep their real output. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -274,7 +274,13 @@ export const TaskTool = Tool.define( | |
| return yield* Effect.fail(new Error(`${errorMessage(result.info.error)}\n${resumeHint(nextSession.id)}`)) | ||
| } | ||
| // kilocode_change end | ||
| return result.parts.findLast((item) => item.type === "text")?.text ?? "" | ||
| // kilocode_change start - ignore synthetic/ignored/empty text parts (e.g. the memory marker) when picking the task result (#13469) | ||
| return ( | ||
| result.parts | ||
| .filter((item): item is MessageV2.TextPart => item.type === "text") | ||
| .findLast((item) => !item.synthetic && !item.ignored && item.text.length > 0)?.text ?? "" | ||
|
Comment on lines
+278
to
+281
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This adds Kilo-specific result-selection logic directly to the shared upstream AGENTS.md reference: packages/opencode/AGENTS.md:L76-L78 Useful? React with 👍 / 👎. |
||
| ) | ||
| // kilocode_change end | ||
| }, | ||
| Effect.ensuring(KiloTaskBackgroundProcess.finish(nextSession.id)), | ||
| ) // kilocode_change - transfer inherited processes when the child run ends | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This text is published directly in release notes, but most of it explains internal marker-part selection and background-job overwrite behavior rather than concisely describing the user-visible fix. Reduce it to an imperative, feature-oriented statement such as “Prevent resumed subagent tasks from returning empty results.”
AGENTS.md reference: AGENTS.md:L158-L160
Useful? React with 👍 / 👎.