submit_assistant_reply schema has a duplicated enum value (assistant_tasks_save), breaking all draft submissions on strict clients
Summary
submit_assistant_reply's drafts[].tool enum registers assistant_tasks_save twice, which makes strict JSON Schema clients reject the whole tool definition. In our deployment (Kimi CLI, kimi-k3.1-pro-highspeed) every draft submission fails with a schema validation error, so no draft can ever be confirmed — the assistant can never save anything, no matter what the user asks for.
Environment
- LoopForge v0.4.2 (
ghcr.io/tencent/loopforge:0.4.2, digestsha256:a98a6c2c…fecb564) - Docker Compose deployment, MySQL 8.4, executor
kimi, CLI2.7.3, protocolchat - Also reproducible on v0.4.1 — the offending line already exists there
Root cause
internal/httpapi/agent_tool_terminal.go, submitAssistantReplySchema:
names := assistantWriteToolNameList() // every non-readonly public operation
toolSchema := map[string]any{"type": "string", ...}
if len(names) > 0 {
enum := make([]any, 0, len(names)+1)
for _, name := range names {
enum = append(enum, name)
}
enum = append(enum, "assistant_tasks_save") // <-- unconditional append
toolSchema["enum"] = enum
}
assistantWriteOperations is built from application.PublicOperations() filtered by !op.ReadOnly, and assistant_tasks_save is defined without ReadOnly: true (internal/application/operations.go:133), so it is already in names. The unconditional append therefore produces a duplicate enum value:
enum length: 86, unique: 85, duplicates: ["assistant_tasks_save"]
There is no test asserting enum uniqueness, and the platform does not validate the schema it emits.
Why it breaks the whole turn
The schema is handed to the executor CLI. A strict validator treats a duplicated enum entry as an invalid schema and rejects the tool definition, so the model can call submit_assistant_reply but every call is refused before it reaches the platform. The diagnostics for the affected turn show the tool as completed with no server-side draft, and the reply reports the schema error to the user.
Effect: in any conversation that needs a confirmable draft, submit_assistant_reply is unusable, so nothing can be saved through chat.
Reproduction
- Anything that makes Main Bot submit a draft (e.g. 「新建一条需求」 in a project).
- The model calls
mcp__agentflow_session__submit_assistant_reply. - The call fails on the duplicated enum and no draft appears.
Suggested fix
Only add the name when it is absent, or deduplicate while building the list:
if len(names) > 0 {
seen := make(map[string]struct{}, len(names)+1)
enum := make([]any, 0, len(names)+1)
for _, name := range append(names, "assistant_tasks_save") {
if _, ok := seen[name]; ok {
continue
}
seen[name] = struct{}{}
enum = append(enum, name)
}
toolSchema["enum"] = enum
}
A unit test over submitAssistantReplySchema asserting len(enum) == len(set(enum)) would catch the next regression of this kind. Root cause is arguably that assistant_tasks_save is marked writable while the comment calls it a legacy API — if it should stay available as a draft target, the dedup is enough.
Contribution
Happy to send a PR with the fix plus the uniqueness test. Say the word if you would rather have the enum built from a sorted, deduplicated helper shared with assistantWriteToolNames().
Thanks!
Adding the runtime evidence, and one correction to my own framing.
What the platform actually saw. For the failing turn the platform log records only:
2026-11-24 07:21:18 agent-tool call-start mode=assistant tool=agentflow__workflows_list
2026-11-24 07:21:18 agent-tool call mode=assistant tool=agentflow__workflows_list ok=1
2026-11-24 07:21:18 agent-tool call-start mode=assistant tool=workbench_tool_schema
There is no call-start line for submit_assistant_reply, yet the diagnostics list the tool as completed from source: cli. So the call never reached the platform gateway: the executor (Kimi CLI 2.7.3, engine=kimi, protocol=chat) refused it client-side. That is consistent with a validator rejecting the tool definition, but it also means the platform never got a chance to answer.
Enum state, measured. application.PublicOperations() has 117 entries; 61 are writable; assistant_tasks_save is one of them (no ReadOnly: true). Adding the unconditional append yields 62 entries with 61 unique values, so assistant_tasks_save appears twice and nothing else does. agent_tool_mcp.go reports 57 tools in the session catalog for that turn, which is where the definition travels.
Correction. In my original report I wrote "a duplicated enum entry is an invalid JSON Schema". That is too strong: JSON Schema does not require enum values to be unique, so a lenient validator accepts it. The accurate statement is that strict validators (and some OpenAPI 3.1 tooling) reject it, and at least one shipped executor CLI does, which takes the whole tool definition out of service. The fix is the same either way, and de-duplicating is strictly safer than relying on the executor's tolerance.
Why it matters beyond one executor. The defect is in the schema the platform emits, so any strict client is affected, not just Kimi. Since submit_assistant_reply is the only path for confirm-mode drafts, an affected conversation cannot save anything through chat at all.
Still happy to send the PR (dedup + a test asserting len(enum) == len(set(enum)) for every mode).
Opened #1289 with the fix and the regression test: de-duplicates the enum while keeping assistant_tasks_save as a draft target, plus a test that fails on v0.4.2 (assisted: tool enum repeats "assistant_tasks_save") and passes with the fix.
For anyone hitting this before a release ships, switching the conversation's approval mode to 完全权限 or 帮我批准 avoids the broken tool entirely: those modes execute platform writes directly instead of routing them through submit_assistant_reply. Creating the requirement from the project's requirement page by hand also works.
Thanks for the report. As I understand it, with Kimi CLI on LoopForge v0.4.2 (also on v0.4.1), calls to submit_assistant_reply are rejected on the client before they reach the platform, so drafts that need confirmation cannot be saved. You also pointed at a duplicated assistant_tasks_save entry in that tool's enum.
This is noted, and it will be reviewed along with the existing issue queue.