Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

Runaway spec-task sub-agent burned ~7h/1000+ credits, was silently killed at 300 iterations, then reported as succeeded and task marked [x]

Open kunitaya opened this issue 2 months ago • 6 comments

Operating System

Ubuntu 24.04.5 LTS on WSL2 (kernel 6.6.114.1-microsoft-standard-WSL2)

Kiro Version

1.2.4 (model: claude-opus-5.5, Spec mode, "Run all tasks")

Bug Description

This is a formal complaint, not a feature request. A spec-task-execution sub-agent dispatched by the Spec "Run all tasks" orchestrator ran unattended for about 7 hours, burned an estimated 1,000+ credits, and then was silently killed by the 300-iteration limit. Kiro then reported the execution as succeeded, returned an empty result to the orchestrator, and marked the task [x] complete in tasks.md, even though the task was unfinished and its last test run was failing.

This is not the first time. Our team has repeatedly hit runaway sub-agent behavior in Spec task execution. Each time, the paying user absorbs the cost and gets an unusable, unreported, half-finished result.

Specific defects, all observed in one execution:

  1. No budget control or checkpoint for sub-agents. One sub-agent made 592 tool calls over ~7 hours. Its final request payload was ~2.3 million characters with 600 history messages. The user had no warning, progress report, or chance to stop it before the limit.
  2. Silent termination. Termination was logged only internally: [IterationLimit] Reached iteration limit: 300/300. Stopping agent to prevent runaway execution. Nothing was shown in the UI. The orchestrator received "Tool ran without output or errors".
  3. False success. Immediately after that warning, the log records [ACPEventAdapter] Execution succeeded. A run killed by a safety limit is not a success.
  4. False task completion. About 30 seconds after the forced stop, the task checkbox in tasks.md was changed to [x], while the task tool still reported in_progress. For a project that uses tasks.md as review and traceability evidence, a fabricated completion mark is a serious integrity problem, not a cosmetic one.
  5. No handoff of partial work. Because the sub-agent never wrote a final report, 7 hours of work (60+ changed files) came back with zero summary. The user had to dig through ~/.kiro/logs/*/kiro.log and ~/.kiro/sessions/.../sub-executions/*.jsonl to find what happened.
  6. Ignored explicit scope instructions. The dispatch prompt said "No full test suite". The sub-agent still ran several 20-to-25-minute broad test runs, which used much of the budget.

Steps to Reproduce

  1. Open a Spec whose next task is large (a multi-module refactor touching ~60 test files).
  2. Click "Run all tasks". The orchestrator dispatches the task to the spec-task-execution sub-agent.
  3. Let it run. The sub-agent keeps iterating (edit, long test run, edit) and accumulates history until it reaches 300 iterations.
  4. Observe:
    • invoke_sub_agent returns no output;
    • the log says Execution succeeded;
    • tasks.md shows the task as [x];
    • the UI never shows that the agent was stopped by the iteration limit.

Expected Behavior

  • Hard, visible budgets: sub-agents must have user-visible iteration, time, and credit budgets, with a warning (for example at 50% and 80%) and a confirmation prompt before continuing past a threshold.
  • Never report a limit-terminated execution as success. It must surface as a failure or "stopped: iteration limit" status in both the UI and the parent agent's tool result.
  • Never mark a task complete automatically unless the sub-agent explicitly reports completion. Set it to in-progress or failed on forced termination.
  • Mandatory partial-progress handoff: before forced termination, reserve iterations for the sub-agent to write a summary of what changed, what passed, and what remains, and return it to the parent.
  • Context hygiene: a 2.3M-character, 600-message sub-agent context should trigger compaction or a stop long before 300 iterations.
  • Credit transparency: show the credits consumed per sub-agent execution.
  • Make limits configurable (see related #10848).

Conversation ID

Root session: sess_ba46a3cb-9fa3-4ccb-aaca-883c3af11be1 Parent execution (turn): e4b74d60-bf6f-4e76-b772-fe5699c35c9a Sub-execution: 023395e3-a0bf-402d-ae51-0a50fffc9985 (sub-agent conversation 33aadfba-db80-42f4-92eb-48d662a0153f) Iteration-limit stop: 2026-10-05T08:19:40.708Z

Additional Context

Log sequence for the sub-execution (timestamps UTC):

08:19:30.514Z [q-developer-converse] Request payload: 2318185 chars, 600 history messages
08:19:40.708Z [IterationLimit] Reached iteration limit: 300/300. Stopping agent to prevent runaway execution.
08:20:13.254Z [ACPEventAdapter] Execution succeeded {"executionId":"e4b74d60-..."}
08:20:13     tasks.md task checkbox changed to [x]

Sub-execution log: 592 tool_call and 592 tool_result entries, 206 assistant messages.

Related: #10848 (300-iteration ceiling is hardcoded and silent). This report is broader. The ceiling is only the trigger. The defects are the missing budget and visibility controls, the false "succeeded" status, the fabricated task completion, and the lost partial-work handoff, all of which cost real money.

Please treat this as a high-priority billing and integrity defect. We expect a response on remediation and on credits consumed by runaway executions that ended in a forced stop.

kunitaya avatar Oct 05 '26 08:10 kunitaya

🤖 Potential Duplicate Detected

This issue appears to be similar to:

What happens next?

  • ⏰ This issue will be automatically closed in 3 days
  • 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message.
  • 💬 Comment on the original issue if you have additional information

Why is this marked as duplicate? Both issues report runaway/uncontrolled agent execution consuming excessive credits on bounded tasks, with the core problem being disproportionate credit consumption, lack of budget controls, and the orchestration system not properly handling or reporting when agents exceed expected bounds. Both are formal complaints about billing and integrity defects in Kiro's spec/agent execution system.

github-actions[bot] avatar Oct 05 '26 08:10 github-actions[bot]

Supplement: measured time breakdown, and why this is not acceptable for business use

Our conclusion after this incident is plain. Kiro's agent execution, in its current form, is not acceptable as an AI for business work. We are moving this implementation to another tool. What we object to most is the time lost, more than the credits.

Where the 7.07 hours went (measured from kiro.log and the sub-execution JSONL)

Category Time Notes
Shell commands 3.15 h 72 commands; 42 pytest runs account for 3.14 h
Model round-trips ~1-3 h 295 calls; mean latency grew from ~10 s to ~16 s
Remainder rest Kiro's logs do not allow model, tool and platform overhead to be separated
  • The full test suite was never run. The sub-agent instead re-ran large multi-file selections (26-31 files, 21-24 min each) four times, and eight runs exceeded 10 minutes. This happened despite explicit instructions to run only focused tests.
  • Context was never compacted. Each model call resent the whole history. The payload grew from ~0.6M to ~2.3M characters (600 messages), and per-call latency grew with it. There is no evidence of compaction inside the sub-agent.
  • The logs are hard to diagnose. Shell executions are logged as toolId: "list_directory" in acp.policy-eval.complete, which makes the logs misleading.

Systemic behaviour: repeated, redundant checking

Most of the time was not spent on implementation. It went into a loop of "run a check on an unverified assumption, fix one thing, run it again". This pattern is not limited to the sub-agent. The orchestrating agent did the same thing in the follow-up session while investigating this incident:

  • It ran six analysis scripts to answer one question. It did not inspect the log format first, then patched one wrong assumption per run. One or two runs were sufficient.
  • It re-ran verification commands because a previous command was written incorrectly and printed nothing.

Repository steering (AGENTS.md and .kiro/steering/*) explicitly requires proportionate verification, a predefined stopping condition, and avoiding repeated broad runs. These instructions were loaded into the context and still were not followed.

Why this is unacceptable

A business user needs three guarantees from an autonomous agent:

  1. it can be controlled, with a budget, checkpoints and the ability to stop it;
  2. its work is observable, with progress and a handoff when stopped;
  3. its records are truthful, meaning it never reports false success and never marks incomplete work complete.

This execution failed all three. It also consumed a full working day on avoidable trial-and-error, while ignoring the user's written instructions.

Requested in addition to the original report

  • Enforce user-provided verification and scope constraints (for example "do not run the full suite", "run focused tests only"), or at least surface violations to the user.
  • Compact or summarise sub-agent context automatically, well before payloads reach millions of characters.
  • Show per-execution elapsed time, tool time and test time in the UI.
  • Log shell executions under the correct tool ID.

kunitaya avatar Oct 05 '26 09:10 kunitaya

Thank you for your feedback! 🙏

The duplicate label has been removed and this issue has been sent back for maintainer review.

A maintainer will review this issue shortly.

github-actions[bot] avatar Oct 05 '26 09:10 github-actions[bot]

Supplement 2: the Spec task dependency graph was silently ignored

The Spec tasks.md declares an explicit task dependency graph so that independent tasks can run in parallel and dependent tasks run in order:

{
  "waves": [
    { "wave": 1, "tasks": [1] },
    { "wave": 2, "tasks": [2, 3] },
    { "wave": 3, "tasks": [4] },
    ...
  ]
}

During this same "Run all tasks" execution, Kiro logged this warning:

2026-10-05T08:19:56.297Z warn DAG pipeline: parse error, using sequential ordering. Error: Wave at index 0 has non-numeric id: undefined

Kiro could not read the declared graph and silently fell back to sequential ordering.

  • Nothing was shown in the UI, and the run continued automatically.
  • The orchestrating agent was not told either. It never reported or acted on the failure, even though the Spec explicitly says to confirm native graph recognition before automatic execution.
  • The expected graph format is not documented, as far as we can tell. We cannot determine from Kiro's side whether our format is wrong or the parser is.

In this Spec the affected later waves happen to be serial, so the practical impact here was limited. In general, though, this defeats one of the main reasons for using Spec-driven development. Parallel work that the operator deliberately planned turns into serial work without any notice, which costs exactly the time this report is about.

Requested

  • Document the dependency-graph format that the Spec task pipeline accepts.
  • Treat a graph parse failure as an error that is visible to the operator. At minimum, show a warning and ask before falling back. Never fall back silently.
  • Return the parse result, including any failure, to the orchestrating agent so it can stop or report.

kunitaya avatar Oct 05 '26 10:10 kunitaya

Supplement 3: the agent knowingly does not follow loaded instructions

This report is about the agent itself, not only the platform's limits. It shows the root behaviour behind the earlier supplements.

During a code review the operator requested in the same session, the agent did the following, in this order:

  1. It explicitly read the repository's review guidance. That guidance says expensive verification such as a full regression suite must be reused, and must be re-run only when a review-driven change or a commit mismatch invalidates it, "not for additional certainty".
  2. It read the task record, which already contained focused verification for the latest correction, as that guidance prescribes.
  3. It then started a full regression suite anyway, which takes about 87 minutes, in the background. It justified this to itself afterwards:
    • "running in the background costs no review time", which bypasses the cost/benefit rule;
    • "the change touches a shared lifecycle, so everything is invalidated", which stretches the invalidation condition to fit the decision it had already made.
  4. It then presented its review verdict as pending on that unnecessary run.

It stopped only when the operator intervened and asked who had instructed a full-suite run. Nobody had. The written instructions said the opposite.

When asked why, the agent acknowledged the mechanism. It decided first to verify more, and only then looked for a reading of the rules that would allow it. The same pattern caused the earlier waste in this issue:

  • the sub-agent repeated broad test runs despite explicit focused-test instructions;
  • the orchestrator ran six scripts for one analysis question;
  • it re-ran verification commands it had written incorrectly.

Why this matters

Spec-driven development depends on the agent following the documented process: steering files, AGENTS.md, and the Spec's own validation scope. Here the instructions were present, loaded and even quoted correctly. They still lost to the model's default bias toward "verify once more", and the cost was the operator's time.

An agent that must be fenced in with hooks to obey instructions it has already read is not usable for business work. This is not a request for more prompt text. Prompt text demonstrably did not work.

Requested

  • Treat compliance with loaded steering and AGENTS.md as a product-quality defect to be tracked and fixed in the agent and harness, not as a user-configuration problem.
  • Before an expensive or long-running action (for example a test run above a time or size threshold), require the agent to cite the instruction that authorises it. If it cannot cite one, the harness should surface this to the user before the action runs.
  • Make long-running background actions launched by the agent visible and cancellable in the UI, with their elapsed time.

kunitaya avatar Oct 05 '26 23:10 kunitaya

Thanks for the detailed report. The six defects you've identified are all real and serious: a sub-agent running for 7 hours with no visibility or budget warning, being killed by the iteration limit and returning "succeeded" to the orchestrator, the task getting marked [x] complete when it was neither finished nor explicitly reported as complete, and no partial-work handoff. Each of these individually is a product integrity issue; together they caused real financial and time harm.

To address your specific question on credits: please contact support at https://support.aws.amazon.com/#/contacts/kiro with the sub-execution ID (023395e3-a0bf-402d-42e1-0a50fffc9985) and the session ID for review.

Marking this as a bug to investigate further. The related issue #10848 on the hardcoded iteration ceiling is linked; this report covers the broader gaps in budget visibility, false success reporting, and incomplete handoff.

AnilMaktala avatar Oct 06 '26 17:10 AnilMaktala