LLM batches for large files exceed MAX_INPUT_BYTES on CLI providers, so the scan never reaches a verdict · Issue #853 · NVIDIA/SkillSpector · GitHub
Skip to content

LLM batches for large files exceed MAX_INPUT_BYTES on CLI providers, so the scan never reaches a verdict #853

Open

Description

@elliottwaves-20

Summary

With a CLI provider (claude_cli, opencode_cli, ...), large files are split into chunks that each fit the token budget, but the finished prompt is larger than MAX_INPUT_BYTES (1,000,000 bytes, providers/_agent_cli.py). run_agent_cli rejects it before the CLI starts, so every analyzer fails on the same chunks in every run. The scan ends without a verdict however long it is allowed to run.

Observed

Package: rea-agents@6.5.0 from npm (morluto/rea, a legitimate open-source project; it surfaced this only because it ships large bundled dist/ files). Provider opencode_cli, model with a 272k context window (input budget 204k tokens). SkillSpector main at cf5cac7b.

Four chunks of three bundled files (~19,000 lines and ~840 KB of content each) fail in all three semantic analyzers with AgentCLIError. Rebuilt with SkillSpector's own build_prompt, the prompts are 1,002,496 to 1,008,798 bytes.

Cause

LLMAnalyzerBase.get_batches and chunk_file_by_lines budget only estimated tokens (len(text) // 4). Two things are not counted:

  • the line prefix number_lines adds (L19239: , about 160 KB on 19,000 lines),
  • multi-byte UTF-8: a file of CJK text can fit the token budget whole and still be over 1 MB.

The CLI transport also appends the structured-output instructions and JSON schema after build_prompt (_StructuredAgentCLIModel._augment, 2.5–4.1 KB), which no budget accounts for.

Related

I have a fix ready and will link the PR.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions