#14218·kilocode

Sub-agent reasoning loop in review workflow (business logic track)

Author: DahgothCreated Sep 17, 2026Updated Sep 17, 2026

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_FINDINGS

or 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.js classifiers match CI path filters + pre-push patterns
  • pnpm --dir frontend test runs correctly (19/19 tests pass)
  • packageManager: [email protected] pinned in both package.json
  • allowBuilds: {esbuild: true} in frontend/pnpm-workspace.yaml (pnpm 12 setting)
  • pnpm --dir frontend test delegation works correctly
  • check-docs.js on 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

  1. Output format enforcement: Validate sub-agent output matches expected schema before accepting; retry on mismatch
  2. Reasoning loop detection: Detect repetitive meta-reasoning patterns and force termination with NO_FINDINGS
  3. Explicit "no findings" sentinel: Make NO_FINDINGS a required token; empty string ≠ no findings
  4. 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