MoonshotAI / MoonshotAI/kimi-code

Swarm + goal mode: quota 403 kills all subagents silently — session idles for hours with no surfaced error, failed subagents never resumed

Open
#2,389 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

Bug description

In /goal + /swarm mode (YOLO permission), when the Kimi subscription quota is exhausted mid-run, the API returns 403 permission_error to subagent and main-agent turns. Every affected turn fails terminally, and afterwards the entire session goes completely silent — zero log events for ~5.5 hours. No retries, no subagent respawn, no error aggregation, no surfaced status. The swarm looks alive but is dead. Manual "Resume the active goal" steers fail instantly (~1 s) with the same 403 and nothing is queued. After the user switched auth to an API key the next day, work resumed — but 8 of the 13 quota-killed subagents were never re-run (their wire files end exactly at the 403); the main agent spawned replacements instead, with no record of the original failures being tracked.

Environment

  • kimi-code 0.29.2 (npm @moonshot-ai/kimi-code, global install; verified via ~/.kimi-code/updates/rollout.log)
  • Node v22.23.1, Ubuntu 26.04 LTS x86_64 VPS
  • Mode: /goal + yolo + /swarm (manual; per wire events permission.set_mode, swarm_mode.enter, goal.create)
  • Model k3 (kimi-for-coding/k3); auth at incident start: Kimi subscription; later switched to API key
  • Swarm: 17 subagents in the first wave

Timeline (from logs/kimi-code.log and per-agent wire.jsonl, all UTC, 2026-07-27)

  • 16:3817:47 — session created, goal set, 17 subagents running normally.

  • 17:48:1517:49:26 — quota wall: 13 subagents + main agent all fail within ~70 s. Representative log lines:

    WARN  llm request failed  turnStep=0.39 attempt=1/10 model=k3 errorName=APIStatusError errorMessage="403 {\"error\":{\"type\":\"permission_error\",\"message\":\"You've reached your usage limit for this billing cycle. ...\"}}" statusCode=403 agentId=agent-4
    ERROR turn failed  turnId=0 agentId=agent-4
    

    Note attempt=1/10 immediately followed by turn failed — fine for a 403 — but nothing else happens either.

  • 17:49:2623:07:28: total silence, zero log events for ~5.5 h.

  • 23:07:28 user steers "Resume the active goal." → main turn fails ~1 s later with the identical 403. Same again at 2026-07-28T00:47:33. Another ~11.8 h of silence.

  • 12:37:44 (after API-key switch): resume succeeds. 5 of 13 killed subagents show later activity; 8 never ran again — wire files end exactly at the 403 moment.

Expected vs actual

  • Expected: on a non-retryable auth/quota error, the swarm/goal scheduler should surface a clear blocking status (pause the swarm, mark subagents failed, tell the user what happened and how to resume), and resume/retry failed subagents once auth is restored.
  • Actual: every turn failed independently and silently; the session idled for hours with no log activity; manual resumes failed in ~1 s with no queued retry; after auth was fixed, most failed subagents were never re-run and their failures are untracked.

Suspected cause (speculation)

Quota 403 is treated as a per-turn terminal error with no escalation path to the swarm/goal scheduler; subagent task state is not marked failed-and-resumable, so the scheduler has nothing left to do and goes idle while the UI (per user recollection, not in logs) still shows the swarm as active.

Repro notes

Not deterministic without a near-exhausted subscription quota, but conceptually: start a /goal + /swarm session with 10+ subagents on a subscription account, exhaust the billing-cycle quota mid-run, observe all turns fail with 403 and the session go idle with no surfaced status; then "Resume the active goal" and observe instant 403 with no queued retry.

Attachments (available on request)

Full session artifacts preserved: logs/kimi-code.log (quota errors at lines 803–925; silence gaps 17:49Z→23:07Z and 00:47Z→12:37Z), agents/main/wire.jsonl, per-subagent agents/agent-0…41/wire.jsonl (the 8 never-resumed subagents' wires end exactly at their 403 timestamps), state.json, and rollout.log proving version 0.29.2 at incident time. Happy to attach any of these.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with logs/kimi-code.log, the main and per-agent wire.jsonl files, state.json, and rollout.log to correlate the quota 403 failures with the later silent periods. Trace how failed turns and active goal/swarm state are recorded, then verify that a non-retryable quota failure is surfaced and that affected subagents become resumable after authentication is restored.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.