Skip to content

[BUG] Agentic workflow can exceed context budget despite tool-level truncation #70

@gudzenkov

Description

@gudzenkov

Summary

Tool-level truncation exists, but accumulated agent memory/tool results can still exceed the configured context budget. A limit: 1 request overflowed the workflow context instead of returning a bounded or partial result.

Related

  • No standalone context-budget or agentic overflow issue/PR found during search.

Clean Reproduction

Fresh clone at:

ce5bf27 Merge pull request #59 from Jakedismo/wip-indexing-analyzers-doc

Clean OpenAI LLM run after indexing src:

Files: 264 indexed
Nodes: 2099
Edges: 4269
Embeddings: 2157 chunks, 1536-dim, provider openai

MCP call:

{
  "name": "agentic_context",
  "arguments": {
    "query": "Build context for a large feature touching several modules and API routes. Include files, functions, dependencies, risks, and next steps.",
    "focus": "builder",
    "limit": 1
  }
}

Observed error:

Context length 199958 bytes exceeds 192000 byte limit

Earlier non-clean troubleshooting run hit the same class of failure at:

215830 bytes exceeds 192000 byte limit

Expected

The agentic workflow should enforce a global budget across:

  • Tool results
  • Conversation history
  • Agent memory
  • Final synthesis prompt

If the budget would be exceeded, the tool should reduce retrieval, summarize intermediate state, or return a partial bounded result.

Actual

The workflow accumulates enough context to exceed its configured budget and fails before returning usable output.

Impact

The error tells callers to reduce scope/limits, but the public limit parameter is not applied by the agentic wrapper. The budgeting guard catches the overflow too late, after the orchestration has already accumulated excessive context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions