Skip to content

Curator LLM review enters multi-hour loop on symlinked skill clusters, consuming 91M input tokens #44771

Open

Description

@atdy

Summary

The built-in curator background task entered a 4-hour loop during its weekly LLM review pass, making 811 API calls and consuming ~91M input tokens before hitting the Kimi Code rate limit. The trigger appears to be a cluster of 26 symlinked lark-* skills that curator tried to consolidate into umbrella skills.

Environment

  • Hermes version: 0.16.0 (gateway service on Ubuntu 24.04, Tencent Cloud)
  • Model used by curator: kimi-k2.6 via kimi-coding
  • Curator config (default):
    curator:
      enabled: true
      interval_hours: 168
      min_idle_hours: 2
      stale_after_days: 30
      archive_after_days: 90
      prune_builtins: true

What happened

On 2026-06-11 at 19:56 CST, curator started an auto review session 20260611_195641_84bd7f. It ran until 23:55 CST, when the provider returned:

HTTP 429: You've reached your usage limit for this period.

During those ~4 hours:

  • 811 successful API calls logged in ~/.hermes/logs/agent.log
  • ~91,400,370 input tokens, ~224,670 output tokens
  • Input context grew from ~23K tokens per call to ~106K tokens per call
  • Primary tools used: skill_view (264 times) and terminal (393 times)

Candidate skills

Curator saw 36 agent-created candidates, including 26 lark-* skills that are symlinks from ~/.hermes/skills/lark-* to ~/.agents/skills/lark-*. Examples:

lark-approval, lark-apps, lark-attendance, lark-base, lark-calendar,
lark-contact, lark-doc, lark-drive, lark-event, lark-im, lark-mail,
...

These skills share the lark- prefix, so curator's umbrella-building prompt treated them as a single large cluster and repeatedly inspected each skill's full directory package.

Root cause (observed)

  1. Curator's review prompt asks it to "scan the full candidate list" and "identify prefix clusters".
  2. For each cluster, it inspects skills as "complete directory packages" via skill_view + terminal.
  3. The conversation context accumulates previously viewed skill contents, causing input tokens to grow monotonically.
  4. There appears to be no per-task token budget or turn limit that would stop this runaway growth.

Related issues

Suggested fixes

  1. Add a per-curator-run token/turn budget with graceful shutdown.
  2. Limit context window for curator review (e.g., summarize already-inspected skills instead of retaining full content).
  3. Treat symlinked external skills more conservatively during consolidation.
  4. Expose curator cost/running status to the user before large runs.

Logs available

I can provide ~/.hermes/logs/agent.log and ~/.hermes/logs/gateway.log excerpts for the session 20260611_195641_84bd7f if helpful.

Activity

  1. added
    type/bugSomething isn't working
    comp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint
    tool/skillsSkills system (list, view, manage)
    P2Medium — degraded but workaround exists
    on Jun 12, 2026
  2. AIalliAI commented on Jun 12, 2026

    @AIalliAI

    Verified the core of this on main. The curator fork is created with max_iterations=9999 (agent/curator.py, _run_llm_review) — the in-code comment says a pass "typically takes 50-100 API calls" — and IterationBudget is the only stop condition; there is no token budget on the curator path, so your 811-call/91M-token run was bounded only by the provider 429. The review prompt also pushes long runs explicitly ("Iterate… Don't stop after 3 merges", "fewer than 10 archives → you stopped too early").

    One correction on the symlink framing: the candidate list is built from tools/skill_usage.py which still uses Path.rglob("SKILL.md") and does not traverse symlinked skill dirs (the #8293 fix migrated skills_list/skill_view to iter_skill_index_files/os.walk(followlinks=True) but not skill_usage.py) — so the lark-* symlinks shouldn't appear in the rendered candidate list, though the review agent can still find them via skills_list mid-run. The runaway doesn't need symlinks: any large prefix cluster triggers it. (Separate latent hazard: os.walk(followlinks=True) in agent/skill_utils.py:639 has no cycle protection — a true symlink cycle would hang the tool call itself.)

    Smallest fix per the contribution rubric: bridge a curator.max_iterations (or auxiliary.curator.max_iterations) config.yaml key to replace the hardcoded 9999, with a graceful final-summary turn on exhaustion (the _budget_grace_call machinery already exists).

  3. michcu10 commented on Jul 16, 2026

    @michcu10

    🤖 AI-generated comment. This was drafted by GitHub Copilot (an AI agent) from a live reproduction on my system; I (@michcu10) reviewed it and am posting it. Happy to clarify or provide raw logs.

    Another reproduction of this on a different trigger — a bundled-heavy skill library (rather than symlinked clusters), plus a couple of adjacent findings that connect this to #64393 / #53959.

    Environment

    • Hermes 0.18.2 [3f2a389c] (2026-07-16), Python 3.11.15, Linux (DGX Spark, GB10 / aarch64)
    • Curator model: nvidia/Qwen3.6-35B-A3B-NVFP4 via custom (local vLLM, 256k context, max_model_len=262144)
    • curator.consolidate: true, interval_hours: 168, prune_builtins: true
    • Library: 123 skills — agent=49, bundled=71, hub=3 (≈58% bundled)

    What happened

    Two distinct failure modes on the same library, neither of which committed anything (75 → 75 (+0)):

    1. Runaway context growth (matches this issue). With curator reasoning on, the review session grows monotonically as it skill_views full skill packages, then dies:

    Duration: 8m 59s · tool calls: 68 (skill_view=39, read_file=9, terminal=11, write_file=4, skill_manage=5)
    consolidated into umbrellas: 0
    LLM final summary: Context length exceeded: max compression attempts (3) reached.
    

    Even a 256k-context model overflows because compression triggers at the global compression.threshold (0.5 → 131k) and then can't compress back under target. Setting auxiliary.curator.extra_body.reasoning.effort: low let the dry-run (analysis) complete with a good plan, but the mutating run still overflowed — so this is not only a reasoning-token issue; it's the "no per-run budget / retain full content" problem described here.

    2. same_tool_failure_halt on bundled-skill refusals (new angle, ties into #64393). With curator reasoning disabled to cut context, it no longer overflows and reaches the mutation step — but the LLM's umbrella plan targets bundled skills, which skill_manage correctly refuses (the #20273 protection), so it loops on refusals until the guardrail hard-stops it:

    Duration: 5m 27s · tool calls: 60 (skill_view=42, skill_manage=14, terminal=3, write_file=1)
    skill_manage error: {"success": false, "error": "Refusing background curator delete for bundled skill 'systematic-debugging'"}
      (same for python-debugpy, node-inspect-debugger, test-driven-development, spike, simplify-code, requesting-code-review, …)
    LLM final summary: I stopped retrying skill_manage because it hit the tool-call guardrail (same_tool_failure_halt) after 8 repeated non-progressing attempts.
    

    Root cause of this variant: the curator includes bundled/hub skills in the consolidation candidate set (consistent with #64393's provenance-labeling bug), but the execution layer forbids modifying them. On a bundled-heavy library, the LLM's plan is dominated by operations it is structurally unable to perform, so the umbrella pass can never commit and just burns the run (and, with reasoning off, can't adapt → same_tool_failure_halt, cf #53959).

    3. Secondary: write to a non-existent parent dir. During the same run the curator attempted to create an umbrella at a doubled path without creating the directory first:

    `…/skills/github/github/SKILL.md` — [write_file] Failed to write file:
    bash: line 3: `…/skills/github/github/.hermes-tmp.47781`: No such file or directory
    

    (possibly related to the subfile-handling in #44762.)

    Why it matters

    On a bundled-heavy library the curator's LLM consolidation is effectively a no-op that still consumes a full multi-minute pass every cycle, because the majority of its candidates are immutable.

    Suggestions (in addition to this issue's existing list)

    Happy to provide the full per-run REPORT.md/run.json if useful.

  4. GottZ commented on Jul 28, 2026

    @GottZ

    This was generated by AI during triage.

    Summary

    Three PRs address #44771: #44887 replaces the 9,999-iteration value with a configurable setting defaulting to 200 and excludes externally resolved skill symlinks, while #44923 and #70669 impose a fixed 200-iteration ceiling; #44923 additionally deduplicates identical resolved skill targets. The iteration bound addresses the contributor-verified absence of any earlier stop condition, whereas the symlink changes cover only one trigger and are not required for the reproduced non-symlink runaway.

    Related pull requests

    • fix(curator): cap review iterations and exclude external symlinked skills (#44771) #44887 [closed] fixes — (+159/-6) — fixes, but closed and superseded: the diff defaults curator reviews to 200 iterations but permits arbitrary configured values, including values above 9,999, and adds external-symlink exclusion plus regression tests. Despite the APPROVED review, its closure notes that external ownership is now handled upstream by skills.external_dirs/is_external_skill_path() and that 9,999 was considered intentional; however, the contributor verification and a non-symlink reproduction show that external symlinks are not the underlying requirement for runaway context growth.
    • fix(curator): deduplicate symlinked skills and cap iteration limit (#44771) #44923 [closed] fixes — (+17/-1) — fixes, but closed/stale: it hard-caps reviews at 200 and deduplicates candidate directories only when their resolved targets are identical. It overlaps the effective iteration-bound fix but its symlink rationale does not cover distinct targets or non-symlink triggers, and the contributor marked the PR stale.
    • fix(curator): cap max_iterations at 200 instead of 9999 #70669 best fix — (+1/-1) — fixes and is the best minimal active patch: it changes the sole curator stop condition from 9,999 to a fixed 200 iterations, directly bounding API calls for symlinked, bundled-heavy, and other large-cluster triggers without coupling the fix to disputed symlink handling.

    Duplicates

    #44887, #44923, and #70669 all overlap on reducing the default 9,999-iteration review path to 200; #44923 and #70669 make the same fixed one-line cap, while #44887 instead makes the value configurable and includes broader symlink handling.

    Suggested consolidation

    Merge #70669 as the smallest trigger-independent bound on the contributor-verified runaway path. This recommendation acknowledges #44887's closure rationale that 9,999 was intentional and external skills were addressed upstream: those changes resolve ownership of one candidate source, but they do not bound the documented non-symlink runaway, while #70669 does; keep closed #44887 and #44923 as superseded duplicates rather than reopening them.

    Complex graph

    flowchart LR
        classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
        classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
        classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
        classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
        classDef best stroke-width:3px,stroke:#b45309
        classDef target stroke-width:3px,stroke:#4338ca
        I44771(["issue #44771 (open)"])
        subgraph Dup44887 ["PRs duplicating each other"]
            P44887["PR #44887 (closed)"]
            P44923["PR #44923 (closed)"]
            P70669["PR #70669 (open)"]
        end
        P44887 -->|fixes| I44771
        P44923 -->|fixes| I44771
        P70669 -->|best fix| I44771
        class I44771 open
        class I44771 target
        class P44887 closed
        class P44923 closed
        class P70669 open
        class P70669 best
        click I44771 "https://github.com/NousResearch/hermes-agent/issues/44771"
        click P44887 "https://github.com/NousResearch/hermes-agent/pull/44887"
        click P44923 "https://github.com/NousResearch/hermes-agent/pull/44923"
        click P70669 "https://github.com/NousResearch/hermes-agent/pull/70669"
    
    Loading

    Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed or no verify verdict yet (state tag in the node label).

    Cross-PR triage: Reviewed 3 pull requests and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 10 kB of PR diffs, 5 kB of issue/PR text, 7 kB of discussion (8 comments), 7 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

  5. GottZ commented on Jul 30, 2026

    @GottZ

    This was generated by AI during triage.

    Delta since our previous triage comment

    @teknium1 confirmed the complete enforcement path for #70669: the curator’s max_iterations value becomes the IterationBudget used as the conversation loop’s API-call bound. They also identified a missing regression assertion in the existing constructor-kwargs test, so the patch should remain open until that assertion is added.

    Changed pull requests

    • fix(curator): cap max_iterations at 200 instead of 9999 #70669 best fix — (+1/-1) — best fix, changes requested: The diff directly bounds the verified runaway path at 200 iterations, but the contributor keep_open review requires a regression assertion that the curator review fork passes max_iterations == 200; add that test before merge.

    Suggested consolidation

    The recommendation remains #70669, but keep it open and merge only after the contributor-requested regression assertion is added.

    Complex graph unchanged since our previous triage comment.

    Cross-PR triage: Reviewed 3 pull requests and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 10 kB of PR diffs, 5 kB of issue/PR text, 9 kB of discussion (10 comments), 4 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpointtool/skillsSkills system (list, view, manage)type/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions