Skip to content

[Bug][Kiro] Large MCP tool catalogs trigger CONTENT_FILTERED before generation #719

Closed

Description

@minerva32

Client or integration

Codex App

Area

Provider adapter

Summary

With the Kiro provider, a large Codex MCP/App tool catalog can cause a request to terminate before generation with an upstream stop reason of CONTENT_FILTERED.

Using the same configured Kiro account and model with a trivial, non-sensitive prompt:

  • a reduced tool catalog completed normally;
  • the full Codex Desktop catalog repeatedly failed before producing an assistant response;
  • locally limiting the outbound catalog restored normal text generation and a real MCP tool call.

This isolates the failure to the aggregate request/tool-catalog shape, but does not establish Kiro's internal reason for returning CONTENT_FILTERED or an exact provider limit.

Expected behavior: OpenCodex should avoid forwarding an aggregate tool catalog that the upstream cannot accept, or fail locally with an actionable diagnostic.

Reproduction

  1. Configure the Kiro provider and select kiro/claude-opus-5.
  2. Use Codex Desktop with multiple MCP/App integrations enabled.
  3. Send a trivial prompt in a fresh or compacted session.
  4. Observe that the request can terminate before producing an assistant response.
  5. Repeat with the same account/model and a substantially reduced tool catalog; the request completes.

Measured cases:

Request shape Parsed/outbound tools Approx. serialized request body Result
Reduced catalog 12 parsed ~70 KB Completed
Full Desktop MCP/App catalog 289 parsed ~407 KB CONTENT_FILTERED before generation
Locally limited catalog 49 outbound ~108 KB Completed; an MCP tool call also completed

The byte values are local serialized-request approximations, not a documented Kiro threshold.

Possible approaches:

  • add a Kiro-specific tool-count and/or serialized-byte budget;
  • preserve core tools and a discovery mechanism such as tool_search, while deferring optional MCP/App tools;
  • expose parsed and outbound tool counts/bytes in provider debug logs;
  • add synthetic small/large-catalog regression tests.

Related precedent: #190 reports an analogous aggregate tool-catalog failure for Cursor. This report is Kiro-specific and has a different observed upstream error, so it is not claiming the same provider defect.

Version

2.7.43

Operating system

Windows 11

Provider and model

kiro / claude-opus-5

Logs or error output

# Reduced catalog: succeeds
[ocx:kiro:request] {"bodyBytes":70140,"messageCount":3,"toolCount":12}

# Full catalog: repeatedly terminates before generation
[ocx:kiro:request] {"bodyBytes":407036,"messageCount":29,"toolCount":289}
[ocx:kiro:attempt_complete] {"stopReason":"CONTENT_FILTERED"}

# Local mitigation observation: succeeds
outboundTools=49
bodyBytes~=108000
result="text response and MCP tool call completed"

The client-facing symptom can be:

Error running remote compact task: stream disconnected before completion:
Incomplete response returned, reason: empty_kiro_stream

Provider debug identified CONTENT_FILTERED as the upstream stop reason in the failing full-catalog case; empty_kiro_stream appears to be the surfaced stream symptom rather than the root cause.

Screenshots and supporting files

None. Reproduction data is included above with identifying details removed.

Redacted configuration

{
  "client": "Codex Desktop",
  "provider": "kiro",
  "model": "kiro/claude-opus-5"
}

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    on Jul 30, 2026
  2. github-actions commented on Jul 30, 2026

    @github-actions
    Contributor

    Automated translation bookkeeping — detected language: unknown.

  3. lidge-jun commented on Jul 31, 2026

    @lidge-jun
    Owner

    Fixed on dev in 6e1cdb7de.

    The catalog is now bounded as a whole, not just per description. src/adapters/kiro-tools.ts caps it at 48 tools and 96 KiB of converted JSON. Previously truncateDescription() shortened each tool's text but nothing limited the aggregate, so a session with many MCP tools shipped an unbounded spec list and Kiro rejected it before generating.

    The numbers come from your own report: the successful probe used 49 outbound tools at roughly 108 KiB, so the caps sit just under a size known to work, leaving a slot for Kiro's private completion tool and headroom for the enclosing request. These are not published Kiro limits and the constants say so in a comment — if you hit CONTENT_FILTERED under these caps, that is useful data and worth reopening with.

    What gets dropped is the part worth reviewing. Declaration order is preserved and only the oversized suffix is omitted, so the same session produces the same catalog every time. The omission is reported to the model with a count and the first omitted names, rather than tools silently vanishing — a tool the model cannot see is indistinguishable from one that does not exist, and it will confidently tell you the capability is unavailable. An explicit notice at least makes the truncation legible.

    Known limitation: tools after the retained prefix are unavailable for that turn, and a single converted spec larger than 96 KiB yields no ordinary tools at all.

    Ablated by raising both caps out of reach; the count and byte tests both fail, and neither passes on the old per-description truncation alone.

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

    bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions