Skip to content

fix(acp): backport oversize-frame request failure to release/0.8.0 - #15575

Merged
bolichen97 merged 1 commit into
release/0.8.0from
backport/0.8.0-acp-oversize-frame
Sep 30, 2026
Merged

bolichen97 merged 1 commit into
release/0.8.0from
backport/0.8.0-acp-oversize-frame

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On a 0.8.0.x build, when kiro-cli's reply to a request is too large to read, the request fails at once with an error naming the reply's size and the limit, instead of timing out later with a misleading "MCP servers" message.

This backports #15278 to release/0.8.0; it is already merged on main (27619cb). On 0.8.0, a reply over the ACP reader's 10 MB stdout frame limit is dropped to keep the shared process alive. The request it answered then waits out its whole budget. A session/new reply that lists 50 agents with 113 KB welcomeMessage each (about 11.7 MB with skill-view aliases) surfaces as session/new timed out after 90s (0/N MCP server(s) reported). Root cause and evidence are in #15278.

Why it matters

0.8.0.x is on the stable channel, and this field report is on a 0.8.0.x build. Every session start on such a host fails the same way. Nothing the error points at (MCP servers, restarts, setup --clean) helps, while the frame size, the limit and the usual cause are enough to fix it in one step.

Not a goal

What changed (motivation → approach → change)

One commit, git cherry-pick -x 27619cb232 (authorship kept), in the #11339 / #11645 / #15314 backport shape:

  • acp/client.py _drain_oversize_line: keeps the dropped line's first 4 KB (head=, _OVERSIZE_HEAD_BYTES).
  • acp/runtime.py: when that head is a reply envelope (no "method") whose numeric id is a pending awaited request, that request fails at once with AcpFrameTooLarge, naming the size, the limit and the usual cause. The session/new and session/load arms tag it session_start_failed (and session/new releases its start permit), so a self-driving caller still backs off. Other dropped frames keep the timeout path.
  • acp/session_handle.py: AcpFrameTooLarge (not transient). acp-client.md documents it.

Backport adaptation. Two conflicts, both from #15153 not being on this branch. No behaviour differs from main:

  • On main the drain lives in acp/transport_framing.py, which does not exist here. On this branch _drain_oversize_line is still in acp/client.py, and runtime.py imports it from there. The source's three transport_framing.py hunks are applied to that function unchanged; the added and removed lines are identical.
  • On main, _record_session_start lives in acp/runtime_start.py; on this branch it is in acp/runtime.py. The new session/new arm calls the release name. test_an_oversize_session_new_reply_releases_its_start_permit patches it on runtime rather than runtime_start, with the same assertion. That test's import and patch target are the only test lines that differ from the source.

Dependencies: none beyond the adaptation. This PR and the skill-view backport (#15140/#15132/#15202/#15177) commute: either order, or a merge of both, gives the same tree.

Backwards compatibility

Compatible: only a request whose reply was already being dropped changes, from a late timeout to an immediate AcpFrameTooLarge. Other oversize frames are handled as before.

Tests

The five tests from #15278 in test/test_acp_runtime.py: the awaited request fails with the size and limit; a host request never fails one of ours; a start failure is tagged for both create and load; session/new releases its start permit; the id is read only from a reply envelope. Run on this branch (output in the PR comment):

  • Touched-module suites: 1976 passed (test_acp_runtime*.py, test_acp_client*.py, test_acp_session_handle_*.py).
  • With src/ reverted to release/0.8.0 and the tests kept: all 5 oversize tests fail.

Backend CI (ci.yml) does not run on release-branch PRs, so these local runs are the backend evidence.

Manual verification

N/A beyond #15278, whose field case was root-caused on the affected host. The reproduction here is the failing-then-passing unit contract on the release branch itself.

Related Issues

Backport of #15278 to release/0.8.0.

Pattern harvest

Rule candidate: review-prompt
Pattern: when a transport drops data to stay alive, fail the request the data answered with the real cause, rather than letting an unrelated timeout name it. (Harvested in #15278.)

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

A reply over the ACP reader's 10 MB stdout frame limit is dropped to
keep the demux alive, and the request it answered then timed out much
later under an unrelated name: a session/new reply listing 50 agents
with 113 KB welcomeMessage each surfaced as a "session/new timed out
... MCP server(s) reported" error.

The drain keeps the line's first 4 KB. When that head is a reply
envelope (no "method") whose numeric id is a pending awaited request,
the request fails at once with AcpFrameTooLarge, naming the frame size,
the limit and the usual cause. It is not transient, and a session/new
or session/load failure keeps its session_start_failed tag so a
self-driving caller still backs off. Other dropped frames keep the timeout
path and the in-flight ids in the warning.

Backport adaptation for release/0.8.0: the drain change is applied to
_drain_oversize_line in acp/client.py, where release keeps it (main moved
it to acp/transport_framing.py in #15153, which is not backported), and
the session/new arm and its test use release's _record_session_start in
acp/runtime.py (main: acp/runtime_start.py).

(cherry picked from commit 27619cb)
@bolichen97
bolichen97 requested a review from a team as a code owner September 30, 2026 21:08
@bolichen97
bolichen97 requested review from kyleseaman and removed request for a team September 30, 2026 21:08
@bolichen97

Copy link
Copy Markdown
Contributor Author

Local test evidence on the release/0.8.0 tree (head c747de0003)

Backend CI (ci.yml) does not run on release-branch PRs, so this is the backend evidence. Runs are from a worktree of this head, Python 3.12.13, on Linux; pytest's pythonpath = src resolves to the worktree.

$ /workplace/bolichen/KiroCrew/.venv/bin/python -m pytest -q -n 8 --dist loadgroup --max-worker-restart=2 test/test_acp_runtime.py test/test_acp_runtime_kill.py test/test_acp_runtime_retention.py test/test_acp_client.py \
    test/test_acp_client_more_coverage.py test/test_acp_client_capabilities.py test/test_acp_client_shutdown_reset.py \
    test/test_acp_session_handle_capabilities.py test/test_acp_session_handle_stream_command.py
1976 passed, 11 warnings in 33.05s

Regression tests fail without the change (tests kept, acp/client.py, acp/runtime.py, acp/session_handle.py reverted to release/0.8.0):

$ pytest test/test_acp_runtime.py -k oversize
FAILED test_an_oversize_reply_fails_its_awaited_request_with_the_size_and_limit
FAILED test_an_oversize_session_start_reply_is_a_tagged_start_failure[create]
FAILED test_an_oversize_session_start_reply_is_a_tagged_start_failure[load]
FAILED test_an_oversize_session_new_reply_releases_its_start_permit
FAILED test_the_oversize_frame_id_is_read_only_from_a_reply_envelope
5 failed, 7 passed

Adaptation check: the acp/client.py delta (+/- lines) is identical to the source's acp/transport_framing.py delta. This PR commutes with #15574 (same tree aa0360a4bf in either order or when both are merged).

Static gates on this head (run from the worktree, no flags): scripts/check_black_formatting.py passed (nothing in scope unformatted outside the baseline); scripts/check_subprocess_encoding.py rc=0; isort --check-only and flake8 on the changed .py files rc=0; mypy src/kiro_crew: Success: no issues found in 1860 source files. scripts/docs-lint.sh: All documentation checks passed.

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of c747de0003b509017b2bc90d13118912a283d7be — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify the cherry-pick is line-identical to 27619cb on main as claimed — this review cannot diff against main, and the whole provenance rests on that fidelity.

What this change ships

Inventory (7 items) — 7 justified

Intent: FIX — backport #15278 so a 0.8.0 request whose oversize reply was dropped fails at once naming the real cause, not a later "MCP servers" timeout.

  1. A request whose reply exceeds the 10 MB frame limit now fails immediately, naming the size, the limit and the usual cause — justified
  2. New non-transient error AcpFrameTooLarge, so no retry re-sends a request guaranteed the same oversize reply — justified
  3. An oversize session/new/session/load reply counts as a tagged start failure, so a self-driving caller backs off — justified
  4. A failed oversize session/new releases its start permit, so later starts are not blocked — justified
  5. The drain keeps the dropped line's first 4 KB in memory to identify the answered request; frames naming no pending request (or carrying "method") keep the old timeout path — justified
  6. acp-client.md documents the new failure path in the same commit — justified
  7. Five tests from fix(acp): fail a request whose reply is over the frame limit #15278, adapted only in one patch target (runtime vs runtime_start) — justified

[FIRST-PRINCIPLES-REVIEWED] c747de0

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of c747de0003b509017b2bc90d13118912a283d7be — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Confirm the PR comment carries the claimed 1976-passed local run — backend CI skips release-branch PRs, so that comment is the only test evidence.

[DESIGN-REVIEWED] c747de0

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of c747de0003b509017b2bc90d13118912a283d7be and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c747de0

False positive or not applicable? A repository writer can comment:
/ai-review override gpt c747de0003b509017b2bc90d13118912a283d7be: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed c747de0003b509017b2bc90d13118912a283d7be — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] c747de0

Verdict parsed from the review's SHA-scoped output markers for commit c747de0003b509017b2bc90d13118912a283d7be.

False positive or not applicable? A repository writer can comment:
/ai-review override fable c747de0003b509017b2bc90d13118912a283d7be: <one-sentence reason>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 30, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Byte-identity and combined-tree checks (the review lanes asked for these; they have no shell)

  • Against 27619cb: acp/session_handle.py and acp-client.md carry the same +/- lines. The acp/client.py +/- lines equal the source's acp/transport_framing.py ones. acp/runtime.py and the test differ only in the _record_session_start location described in the body.

Combined check across all eight 0.8.0 backports (#15574 to #15581). They octopus-merge cleanly onto release/0.8.0 @ 556bf8e (merge e948b10401). release/0.8.0 has since gained #15544 (adaptive concurrency), which touches none of these PRs' files, so no rebase is needed. On that merged tree, scripts/local-gate.py --base origin/release/0.8.0:

  • Backend related set, 4 batches: 26519 + 39518 + 41054 + 16738 passed. 24 tests were deselected because they fail identically on untouched release/0.8.0 on this host: PDF-extractor child processes, installed-version metadata (0.8.0-rc.1), fresh-interpreter import probes, a systemd service probe, aws_control packaging producer CLI, and a peak-RSS reading. The failure sets were compared file by file on both trees.
  • Frontend related set, 3 batches: 9805 + 13140 + 4400 passed. Batch 1's 12 failures (SchedulePage.secrets, ArtifactDetailPage, ChatInput.approval) fail identically on untouched release. Batch 2/3's failures were Denied ID .../node_modules/@pierre/diffs/... from my symlinked node_modules. Rerun with a real node_modules in the fix(chat): backport recycle-notice answer visibility to release/0.8.0 #15578 worktree, the only frontend change in the set, all 8 affected files pass (205 tests).

@bolichen97
bolichen97 merged commit 8a53b23 into release/0.8.0 Sep 30, 2026
22 checks passed
@bolichen97
bolichen97 deleted the backport/0.8.0-acp-oversize-frame branch September 30, 2026 23:42
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant