Skip to content

fix(agent-manager): decode JSON-encoded task arrays - #13608

Merged
marius-kilocode merged 1 commit into
mainfrom
fix-13596-agent-manager-tasks
Aug 31, 2026
Merged

fix(agent-manager): decode JSON-encoded task arrays#13608
marius-kilocode merged 1 commit into
mainfrom
fix-13596-agent-manager-tasks

Conversation

@marius-kilocode

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Agent Manager rejects a start request when a model returns tasks as a JSON-encoded array instead of an array. The outer tool arguments parse successfully, but CLI validation rejects the nested string before permission checks or the extension start event, so no session is created.

Fixes #13596.

Why This Change Was Made

The advertised schema already correctly describes tasks as array-or-null. Provider adapters parse the outer arguments but do not decode nested JSON strings. Changing the advertised schema would encourage the incorrect format and could disturb the existing flat, nullable schema used for provider compatibility.

Decode one JSON layer only for the runtime start operation, then validate the result with the existing task schema and 1–20 item bounds. Keep native arrays, management actions, permission checks, and the extension event contract unchanged. Malformed JSON, decoded non-arrays, double-encoded strings, invalid task objects, empty arrays, and oversized arrays still fail before permission or event publication.

This is a defensive compatibility fix. It does not establish that MiMo generated the reported payload or that an SDK change caused the reported version regression.

User Impact

Local and worktree session requests can proceed when the task list is otherwise valid but JSON-encoded. Models still receive the array-based schema, and genuinely invalid task lists remain rejected. A patch changeset is included.

Evidence

  • New regression cases failed on the original decoder and passed after the change. They exercise the actual runtime schema and initialized tool, including normalized task arrays in the published event and zero permission/event side effects for invalid input.
  • 49 focused CLI tests and 13 extension boundary tests passed. CLI typecheck, extension compile (including host/webview typechecks and lint), formatting, and the worktree annotation guard passed. Focused lint retained its seven pre-existing warnings with no new warnings.
  • vscode-self-test used a credential-free scripted OpenAI-compatible provider and the real extension/backend flow. Before the fix, encoded tasks failed. After the fix, the same payload created a session; native arrays still created sessions; invalid encoded tasks created none. The captured advertised task schema was identical before and after. The isolated test processes were stopped afterward.
  • Live MiMo and Windows were not tested. The extension rebuild completed through its installed-Bun fallback after the pinned Bun launcher failed.

Before, the encoded task array is rejected:

Agent Manager rejects a JSON-encoded task array before the fix

After, the same encoded task array succeeds and the extension creates a session:

Agent Manager accepts the encoded task array and creates a session after the fix

@kilo-code-bot

kilo-code-bot Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (3 files)
  • .changeset/agent-manager-json-tasks.md
  • packages/opencode/src/kilocode/tool/agent-manager.ts
  • packages/opencode/test/kilocode/agent-manager-tool.test.ts

Reviewed by grok-4.6 · Input: 170K · Output: 16K · Cached: 406.4K

Review guidance: REVIEW.md from base branch main

@marius-kilocode
marius-kilocode merged commit df24ce6 into main Aug 31, 2026
32 checks passed
@marius-kilocode
marius-kilocode deleted the fix-13596-agent-manager-tasks branch August 31, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

agent_manager: tasks serialized as string instead of array with certain models (regression since v7.5.0)

2 participants