Skip to content

fix(orchestration): read_artifact bypasses scratchpad, causes context overflow on large artifacts #125

Description

@teriyakichild

Problem

When a follow-up question requires accessing large artifacts from prior orchestration runs, workers (and the coordinator) call read_artifact which returns the full artifact content directly. This bypasses the scratchpad interception mechanism, causing context overflow when artifacts are large.

The scratchpad tools (head, slice, grep, etc.) are registered on the worker, but read_artifact is an internal orchestration tool — not an MCP tool — so it never hits the scratchpad token-threshold check.

Observed behavior

A worker reads a 12MB deduplicate_logs artifact via read_artifact. The full 12MB content is placed into the conversation, exceeding OpenAI's per-message string limit (10MB). The worker fails with context_overflow. The coordinator then also calls read_artifact during re-planning and hits the same error.

Expected behavior

read_artifact should respect scratchpad limits — either by routing large results through scratchpad interception, or by saving the content to scratchpad storage and returning a summary/pointer with instructions to use scratchpad tools for exploration.

Logs

2026-05-13T20:22:21.900Z INFO  aura::orchestration::tools::read_artifact: read_artifact cross-run: filename=task-0-log-analyst-iter-1-deduplicate-logs-relative-time-0-output.txt, run_id=019e22fa-b702-7b33-9455-21369e1b819e
2026-05-13T20:22:21.940Z DEBUG aura::orchestration::orchestrator: Worker task: tool result received (id=call_NOEIvT6Md0QHf78vXrgz7z2S, call_id=-)
2026-05-13T20:22:21.957Z INFO  rig::agent::prompt_request::streaming: Current conversation depth: 2/16
2026-05-13T20:22:27.021Z ERROR rig::providers::openai::completion::streaming: SSE error error=InvalidStatusCodeWithMessage(400, "{\n  \"error\": {\n    \"message\": \"Invalid 'messages[3].content': string too long. Expected a string with maximum length 10485760, but got a string with length 12152840 instead.\",\n    \"type\": \"invalid_request_error\",\n    \"param\": \"messages[3].content\",\n    \"code\": \"string_above_max_length\"\n  }\n}")
2026-05-13T20:22:27.025Z WARN  aura::orchestration::orchestrator: Worker 'log-analyst' failed task 0 after 8015ms (context_overflow): Worker failed task 0 after 1 attempts: Worker context limit exceeded for task 0. Task context too large. The plan may need smaller, more focused tasks.

Coordinator also hits the same wall during re-planning:

2026-05-13T20:22:28.531Z INFO  aura::orchestration::tools::read_artifact: read_artifact cross-run: filename=task-0-log-analyst-iter-1-deduplicate-logs-relative-time-0-output.txt, run_id=019e22fa-b702-7b33-9455-21369e1b819e
2026-05-13T20:22:32.615Z ERROR rig::providers::openai::completion::streaming: SSE error error=InvalidStatusCodeWithMessage(400, "{\n  \"error\": {\n    \"message\": \"Invalid 'messages[11].content': string too long. Expected a string with maximum length 10485760, but got a string with length 12152840 instead.\",\n    \"type\": \"invalid_request_error\",\n    \"param\": \"messages[11].content\",\n    \"code\": \"string_above_max_length\"\n  }\n}")
2026-05-13T20:22:32.615Z WARN  aura::orchestration::orchestrator: Post-execute coordinator call failed: Context limit exceeded during planning.

Context

  • Artifact: deduplicate_logs_relative_time output (~12MB JSON)
  • Worker has scratchpad tools registered but read_artifact doesn't use them
  • Scratchpad interception only applies to MCP tool outputs, not internal tools

Activity

  1. self-assigned this
    on May 13, 2026
  2. added 2 commits that reference this issue on Jun 18, 2026
    43fafc2
    c6138fd
  3. added a commit that references this issue on Jun 22, 2026
    0596c43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions