Sub-agent reasoning loop in review workflow (business logic track)
Kilo Code Sub-Agent Reasoning Loop Report
Date: 2026-09-17
Repository: kompmaster-server (worktree: migrate-to-pnpm)
Sub-agent ID: ses_f526ad446ffeeqzUbZdMT3mg3l (business logic track)
Trigger: /review uncommitted for npm→pnpm migration
Symptom
The business logic review sub-agent entered an infinite meta-reasoning loop instead of producing the required output format (NO_FINDINGS or findings table).
Loop Output Pattern (repeated verbatim):
We need continue task. Need infer user original request likely review findings exact shape. We have summary and current context. Need finish next steps and final answer likely findings.
<...>This exact text repeated indefinitely in the sub-agent's reasoning trace.
Expected Behavior
Per the review workflow, the sub-agent should have returned exactly:
NO_FINDINGSor a findings table with path/line/confidence/why/finding/suggestion for each issue.
Actual Output
The sub-agent returned an empty string ("") instead of the required format. The review framework interpreted this as "no findings" but the reasoning trace shows the model was stuck in self-referential reasoning about "what the user wants" rather than executing the review task.
Context
- Review scope: npm→pnpm migration (uncommitted changes in worktree)
- Track: Business logic / config correctness
- Files reviewed: 21 modified + 2 deleted + 3 new (lockfiles/config)
- Prompt instructions: Explicit format requirements, "return exactly NO_FINDINGS if no solid issue"
Manual Verification
All business logic checks pass when verified manually:
- ✅
check-docs.jsclassifiers match CI path filters + pre-push patterns - ✅
pnpm --dir frontend testruns correctly (19/19 tests pass) - ✅
packageManager: [email protected]pinned in both package.json - ✅
allowBuilds: {esbuild: true}infrontend/pnpm-workspace.yaml(pnpm 12 setting) - ✅
pnpm --dir frontend testdelegation works correctly - ✅
check-docs.json current diff: OK (27 files, all required docs touched)
Impact
- No functional impact: Manual review confirmed zero actual business logic issues
- Workflow impact: Review framework received empty output instead of structured
NO_FINDINGS - Time cost: Required manual re-verification of the track
Reproduction Notes
- Sub-agent type:
general(research-only, instructed "do not edit") - Prompt included explicit output format requirements
- Other three sub-agents (security, deploy safety, duplication) completed cleanly with
NO_FINDINGS - Only the business logic track exhibited the loop
Suggested Fixes for Kilo Code
- Output format enforcement: Validate sub-agent output matches expected schema before accepting; retry on mismatch
- Reasoning loop detection: Detect repetitive meta-reasoning patterns and force termination with
NO_FINDINGS - Explicit "no findings" sentinel: Make
NO_FINDINGSa required token; empty string ≠ no findings - Token budget for reasoning: Cap reasoning tokens for review sub-agents to prevent runaway loops
Evidence Artifacts
- Sub-agent ID:
ses_f526ad446ffeeqzUbZdMT3mg3l - Worktree:
migrate-to-pnpm(kompmaster-server) - Other sub-agents completed cleanly: security (
ses_f526ad7ceffe9EpZkg36d6LCtT→ NO_FINDINGS), deploy safety, duplication - Manual verification commands and results available in session transcript
Source: Kilo-Org/kilocode