Spec sub-intent classifier returns prose; fallback defaults to specGeneration
Operating System
macOS 27.0.1 (build 26A434), Darwin arm64 27.0.0, shell: zsh
Kiro Version
Version: 1.1.70
VSCode Version: 1.131.0
Commit: 8ce1870416c7dc7e51fffb01765d93ef7ad55102
Date: 2026-09-23T21:42:34Z
Electron: 42.7.0
Chromium: 148.0.7778.280
Node.js: 24.18.0
V8: 14.8.178.38-electron.0
OS: Darwin arm64 27.0.0
Bug Description
In Spec sessions, the sub-intent classifier ([SpecSubIntentDetection], request
modelId=simple-task agentMode=intent-classification) often returns prose instead of JSON. The
replies read like the model is answering the user's message rather than classifying it, which is the
likely cause:
Unexpected token 'N', "No worries"... is not valid JSON ← after a short conversational reply
Unexpected token 'G', "Got it. T2"... is not valid JSON ← after "ready"
Unexpected token 'I', "I'll chang"... is not valid JSON ← after "Now change `probe: 2` to `probe: 3`…"
When the parse fails, the classifier falls back to a local heuristic. That fallback returned exactly
{"specGeneration":0.9,"taskExecution":0.1} → specGeneration in all 13 of 13 failures,
identical regardless of input. That points to a fixed default, not a real classification.
This affects routing. In the one case where the LLM call succeeded and returned taskExecution (the only taskExecution
result we observed), the request went to a different path ([Tool agent TaskOrchestrator] setup node, with no
[SPEC_GRAPH] Tool selection). Every specGeneration result went to the spec-generation graph. So
each fallback forces the spec-generation path, even for task-style requests. Example: a one-line file
edit ("change probe: 2 to probe: 3") was routed as spec generation
(agent_controller.triggered {"agentType":"spec-generation"}).
Frequency (with a caveat): in one extension log, 13 of 25 classifications failed across 6 spec sessions. These were diagnostic sessions with many short or meta messages. One session (a coordinator session) accounts for 7 of the 13. The rate in typical use may be lower, but the fallback bias applies whenever the call fails. There was no clear pattern by message type. The same 5-character message ("ready") failed 2 of 5 times, and long (500–1,900 character) task prompts failed too.
All 13 parse errors (12 distinct messages):
Unexpected token 'N', "No worries"... is not valid JSON
Unexpected token 'v', "validate_s"... is not valid JSON
Unexpected token 'I', "I understa"... is not valid JSON (×2)
Unexpected token 'G', "Got it. T2"... is not valid JSON
Unexpected token 'I', "I'll chang"... is not valid JSON
Unexpected token 'I', "I'll compl"... is not valid JSON
Unexpected non-whitespace character after JSON at position 4 (line 1 column 5)
Unexpected token 'I', "I need to "... is not valid JSON
Unexpected token 'I', "I apprecia"... is not valid JSON
Unexpected token '*', "**T6 Diagn"... is not valid JSON
Unexpected token 'I', "I'll read "... is not valid JSON
Unexpected token 'I', "I'm ready "... is not valid JSON
Steps to Reproduce
- In a Spec session, send a short acknowledgement (
ready) or a one-line edit request ("change X to Y in file Z"). Repeat a few times. The failure is intermittent. - In the extension log (
Kiro Logs.log), look for[SpecSubIntentDetection] LLM classification failed ... is not valid JSON, where the quoted text is conversational prose. - Check the following
classification result. It shows"source":"localFallback"withspecGeneration 0.9 / taskExecution 0.1, and the request is routed tospec-generation.
Expected Behavior
- The classifier call reliably returns parseable JSON, e.g. via structured output / JSON mode, a stricter prompt, or extracting the JSON object from the reply instead of parsing the whole text.
- The local fallback shouldn't return a fixed
specGenerationdefault. It should at least apply a heuristic that can returntaskExecutionfor obvious edit/task requests, or surface that classification failed.
Conversation ID
Sessions with classifier failures (count):
sess_75ed1e6b-f1a5-4ab8-b777-fb3a067a6eda(7)sess_6d74e3da-03b7-44e3-b485-c6773f5c99c1(2)sess_70df80d9-ee43-40a5-9db5-0f95009f8db8(1, the one-line edit routed as spec generation)sess_0a7ef33b-7f18-493f-92f7-c56039592420(1)sess_3827d7f3-8c54-43d3-8fe5-608a9444ad52(1)sess_36b3e37f-012d-4ff8-813f-c4a67c607d6f(1)
Additional Context
Found while investigating #11695, in the same sessions. Not a duplicate of #8480 or #8985: those
logs show SpecSubIntentDetection classifying successfully, and their failures are elsewhere.
Thanks for filing this detailed issue — the thorough logs and analysis are really helpful! We understand the sub-intent classifier is returning prose instead of valid JSON, causing the fallback to always route to spec generation regardless of the actual user intent. A maintainer will take a closer look at this soon, and your breakdown of the failure patterns should make it much easier to track down. We appreciate you taking the time to dig into this! 🙏
Thanks for raising this, and for the detailed diagnostic logs. The spec sub-intent classifier is returning conversational prose instead of the expected JSON classification, and the fallback is a fixed constant (specGeneration: 0.9) rather than a meaningful heuristic. This means every classification failure routes to spec-generation behavior, which is wrong for most tasks.
From your logs, 13 of 25 classification attempts failed. The issue is likely the model not receiving or following the JSON-format instruction on the classification call. We are tracking this for a fix.