Repository navigation
Conversation
|
Local review before opening, on the extracted CI contracts (
fixed: that copy says the growth limit, like the other four.
fixed: a
rebutted: a spawn-time baseline counts MCP start-up as growth, which is the loop this PR fixes. Measured on the reporting host: the runtime spawned at +0 s, its first prompt was queued at +3 s with the tree at about 1.0 GB, and MCP servers kept starting until +15 s, when the tree reached 3.8 GB. A baseline before the first prompt would read the 1.0 GB, so the next turn would see about 2.8 GB of "growth" and recycle every replacement after its first turn. The exemption this leaves is one background one-liner's growth plus readings inside the settle window, and the 40-prompt blind backstop still bounds the runtime's lifetime.
fixed: the baseline is provisional until the first reading at least
fixed: the first reading past the window fixes the baseline instead of being compared with it; |
ebfb9d5 to
6aa5939
Compare
|
Five of my fork PRs are blocked on "Approve and run" for their workflows.
On #32030, #30786 and #26459 the Main takes about 350 commits a day, so a rebased head picks up new conflicts within a day or two while it waits. An approval soon after a push would save those rounds. @bolichen97 @iamwhatever @buluoray @CrysisDeu could one of you approve these workflows? Thanks. |
Code change approver recommendation: A person should decideWhy: the decider thinks the change is probably fine but estimates a 14% chance that this change introduces a defect, above the 12% limit for approving on its own. The background runtime's RSS recycle now measures growth past a per-pid baseline instead of the absolute tree size. The baseline is set after the provider's first turn, can only rise during a 30 s settle window, and is then fixed. A 0 reading sets none, and the baseline is dropped when a recycle adopts its replacement. State is written only in _rss_recycle_reason and at adoption; a pid change also forces a fresh baseline. The earlier context, compaction and 40-prompt criteria are unchanged, so the runtime still has a lifetime bound. The new tests would fail on main, and the docs and config help are updated consistently. The looser bound for small trees is intended and stated in the PR. No blocking issues found. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
…servers The background runtime was recycled when its whole process tree reached 1536 MiB. On the claude backend it launches every configured MCP server, so a healthy tree can start above that and was recycled after every background turn: the conversation never warmed, status cards written from scratch ran past their 45 s timeout, and the on-send title attempt timed out behind them. The limit now applies to growth past the provider's first reading, which keeps the bound on transcript growth the value was chosen for. A recycle that adopts a replacement drops the reading, so the replacement re-baselines. Closes kirodotdev#31900
6aa5939 to
f8af7e0
Compare
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The limit now measures growth from a baseline taken after the settle window, which still catches the oversized-transcript leak and no longer fires on every turn because of a large MCP footprint. Notes
[DESIGN-REVIEWED] f8af7e0 Description read[DESCRIPTION-READ] 89afeb9fa198b2931cb140b0580a672f39e0ef232d253ebfec703479d4ef28c4 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5, fork) — 🔴 BLOCKPremise-level review of First-Principles-Verdict: BLOCK The new background RSS baseline duplicates the per-pid start-up footprint that Notes
What this change shipsInventory (6 items) — 3 justifiedIntent: keep the background runtime warm on hosts with many MCP servers, so titles and status cards stop timing out. FIX.
BlockersSecond spelling of the RSS start-up footprint — duplicate of [FIRST-PRINCIPLES-REVIEWED] f8af7e0 Description read[DESCRIPTION-READ] 90aca8167c0bb86e1c72e6b8f376c1b039741faba6c6a19e62be3bacc938e5d2 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
|
Stale-PR cleanup note. I rebased this onto main (f8af7e0; only the help-text wording conflicted, I kept main's text and applied your growth wording) and approved the fork runs. One blocker is left for @rinbn: the First Principles Review says the new |
Problem / Motivation
Goal: Keep the background runtime warm across turns on hosts whose MCP servers alone put its process tree above 1536 MiB, so session titles and status cards stop timing out.
On the
claudebackend the background runtime launches every configured MCP server. With about 15-20 servers its process tree is around 3.7 GB the moment it starts. The RSS recycle compared that whole tree against a 1536 MiB ceiling, so it fired after every background turn. Each turn then started a cold conversation: status cards written from scratch ran past their 45 s timeout, and the title requested when a chat's first message is sent timed out behind them. A new chat stayed "Untitled session" until its whole first turn ended. Numbers and the full loop are in #31900.Why it matters
Anyone on the
claudebackend with a typical MCP setup is hit on every gateway start since the 1536 MiB cap began to overridesession.watchdog_rss_max_mb. Titles arrive late or never, dynamic status cards mostly time out (77 of 106 in one measurement), and every background turn pays a cold prompt of about 50k uncached tokens.Not a goal
claudebackend. That is the larger design change named in claude backend: the background runtime is recycled after every turn because its MCP servers alone exceed the 1536 MiB RSS ceiling #31900.session_cleanup, which uses its own 4096 MiB default sized above a healthy MCP tree.What changed (motivation → approach → change)
The 1536 MiB bound exists to catch a background transcript of oversized records growing the runtime. That is growth, so the check in
BackgroundSessionRuntime._rss_recycle_reason(src/kiro_crew/session_background.py) measures growth.0reading (a host that cannot measure the tree)watchdog_rss_max_mbwhen lower than 1536, else 1536A tree that rests at 3.7 GB is kept turn after turn, and still recycles once it grows by the limit. The recycle log line names the growth and the baseline. The help text for
session.watchdog_rss_max_mb(src/kiro_crew/config/sections_session.py, regenerated intoconfig-baseline.json),src/kiro_crew/docs/configuration.md,docs/system-specs/modules/config.mdand the background-recycle section ofdocs/system-specs/modules/session.mddescribe the growth limit.Backwards compatibility
Compatible: no config key, API or record changes; the same knob and fallback set the limit, and a runtime whose tree starts below the limit recycles at the same point as before, plus its first reading.
Removes nothing: the RSS criterion still exists and still bounds the runtime; it measures growth instead of the absolute size.
Tests
test/test_background_rss_recycle.pypins the growth semantics: growth at and over the limit recycles and names the baseline, growth under it keeps the session, a 3.7 GB starting tree survives several turns and still recycles on growth, servers still starting after a short first turn raise the baseline instead of counting as growth, a start-up reading followed by a quiet gap fixes the baseline instead of recycling, the window counts from the first reading rather than the latest raise, the replacement re-baselines on the same pid, a new pid is a new baseline, a0reading (a host that cannot measure the tree) sets no baseline, and the0and shipped-default fallbacks apply to growth. The permit-handoff and unreadable-tree cases are unchanged apart from recording a baseline first.Proof: PROVEN test/test_background_rss_recycle.py::TestTreeRssGrowthRecyclesTheBackgroundSession::test_growth_at_the_limit_recycles_and_names_the_rss_reason, test/test_background_rss_recycle.py::TestTreeRssGrowthRecyclesTheBackgroundSession::test_growth_far_over_the_limit_recycles, test/test_background_rss_recycle.py::TestTreeRssGrowthRecyclesTheBackgroundSession::test_growth_below_the_limit_keeps_the_session, test/test_background_rss_recycle.py::TestTheBaseline::test_a_tree_that_starts_above_the_limit_survives_its_turns, test/test_background_rss_recycle.py::TestTheBaseline::test_a_tree_that_starts_above_the_limit_still_recycles_on_growth (head 6aa5939)
Determinism: 20/20 runs at
-n0; 10/10 at-n 4 --dist loadgroup --max-worker-restart=2withtest/test_artifact_companion.pyandtest/test_background_turn_accounting.pyas co-tenants; a shuffled order (seed 29379) passes.Manual verification
On a host with this MCP footprint (60 processes, about 3.7 GB tree at rest), raising the fallback to 8192 on 0.12.0.9 and restarting the gateway reproduced the intended behavior: one background conversation served 7+ turns, the first from-scratch card took 57 s and the next ones 16-18 s, and titles took 2 s. This branch was not run live; the growth check is covered by the unit tests above.
Related Issues
Closes #31900
Sibling sweep
Swept: git grep -nE "tree_rss_mb|get_session_rss_mb(|rss_max_mb(" -- src
Sibling: src/kiro_crew/session_cleanup.py -- not affected -- the chat-session sweep skips persistent keys and its 4096 MiB default is sized above a healthy MCP tree
Pattern harvest
Not generalizable: the only absolute tree-RSS ceiling that can sit below the tree's resting size is this one; the chat-session ceiling is user-set and sized above it.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.