Skip to content

perf(acp): size session_start_concurrency from the host by default - #17072

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:perf/session-start-auto-sizing
Oct 6, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
Pearcekieser:perf/session-start-auto-sizing

Conversation

@Pearcekieser

@Pearcekieser Pearcekieser commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On a host with spare cores and memory, a burst of agent starts no longer queues two at a time at the session-start gate.

agent.session_start_concurrency (the SessionStartGate around ACP session/new) defaults to 2 on every host. One kirocrew-agent session/new takes about 3.8 s, so at width 2 a burst of starts finishes one every 1.9 s however idle the host is. On a 128 vCPU load box with real kiro-cli, a 25-start burst had a 54 s median start at width 2 and 37 s at width 8, and at width 8 each session/new still took its isolated 3.8 s.

Why it matters

Anyone who fans subagents out on a workstation or a large cloud host waits tens of seconds for starts the host could run in parallel. Raising the cold-start limits alone does not help: the extra processes queue at this gate instead.

Not a goal

What changed (motivation → approach → change)

The width was a fixed 2, chosen for a laptop, so a big host idles behind it. The gate now defaults to auto and the gateway sizes it once at start from what the process can use. An explicit integer in config still wins.

Host the gateway can use auto width
8 cores, or under docker --cpus 8 on a big host 2
16 cores 4
32 cores 8
64 cores or more 16
little free memory lower: at most one start per 3 GB available

The new module src/kiro_crew/session_start_sizing.py computes clamp(min(cpus // 4, available_GB // 3), 2, 16). One start uses about 3 to 4 cores while it runs and a started session tree holds about 2.6 GB. cpus is the affinity count capped by the tightest cgroup v2 cpu.max quota on the process's cgroup path, because a CFS quota sets no affinity mask. Memory comes from the same probe resource_status uses. The module reads the host once per process (host_capacity()), and every reader of the setting uses that one reading.

Both readers of the setting resolve auto through effective_session_start_concurrency(): the gate itself (acp/runtime_start.py, off the event loop) and the subagent startup cap (subagent.py). Nothing on the gateway boot path probes the host. After the dashboard/API socket binds, slack/gateway.py schedules a background task that resolves the width in a worker thread, so READY never waits for the probe. The subagent manager's startup cap runs on the event loop, so it never probes or takes the host lock: cached_session_start_concurrency() sizes auto from the cached reading once it exists and uses the floor (2) until then. The gate itself resolves its width with asyncio.to_thread. It logs the value in force with its inputs, for example Session start concurrency: 16 (auto: cpus=128 affinity=128 cpu.max=none available=240.5GB; ...). kirocrew doctor (doctor_checks/workload.py) runs in its own process, so it prints what auto picks for the host at that moment and says the running value is in the boot log. The loader accepts auto in any case or an integer clamped to 1..64; junk falls back to auto. The setting uses the string auto rather than the 0 = auto integer that agent.max_subagents uses, because 0 already has a meaning here: the loader has always clamped this key to 1..64, so a stored 0 runs a 1-wide gate today, and reading 0 as auto would silently widen it to as much as 16. config/schema.py gives an int | str field both JSON types so validation does not strip either spelling. A config/superseded_defaults.py row reports a stored 2 from an older build. Config docs, the acp-client spec, the subagent-sizing guide (src/kiro_crew/docs/dynamic-subagent-sizing.md), the RFC §4.4 line and config-baseline.json name the new default.

Relation to open work: #17017 and #17030 (bolichen97) change subagent count caps and doctor_checks/workload.py lines next to this one (the adaptive-concurrency print), not the session-start gate. Whichever lands second has a small textual rebase in that file and in config/sections.py; nothing overlaps in behaviour.

Backwards compatibility

Compatible: an explicit integer in config keeps its exact meaning and 1..64 clamp. Hosts with fewer than 12 usable cores, or under 9 GB available, still resolve to 2. New installs on bigger hosts get a wider gate. An existing config.json holds the old default materialized as 2, and that stays in force: the new superseded_defaults row is report-only, like agent.subagent_spawn_stagger_secs, because 2 is the value an operator sets on purpose when the host or provider is the bottleneck. kirocrew doctor lists it, and kirocrew config defaults --adopt moves an install to auto.

Removes nothing: no key, value or reader goes away; the field type widens from int to int | str.

Tests

test/test_session_start_sizing.py (new):

  • the sizing table for 8, 16, 32, 64 and 128 cores, memory-limited and memory-starved hosts, and unknown inputs
  • cpu.max parsing, the tightest-ancestor walk, the cgroup-namespace root, a v1 or .. path, and 128 cores under an 8-core quota resolving to 2
  • the host is read once per process; an explicit integer never probes
  • the loader for absent, auto, Auto, 8, "8", 0, 500, junk and bool; the schema type
  • the runtime resolver, the gate's live-snapshot path and the doctor line resolve auto; doctor labels an auto value as a probe and an explicit one as config
  • the gateway does not probe before the socket binds; it schedules the probe on a worker thread after the bind, and the subagent manager only reads the cached reading (floor 2 until it exists)

On origin/main with only the new module copied in, 9 of these fail (the default, the auto/junk/bool loader cases, the schema, the runtime resolver, the doctor line). All pass with the change. test/test_config_schema.py learns that a scalar union flattens to its first member's type, and test/test_config_superseded_defaults.py places the new row on the report-only side.

Manual verification

On the 128 vCPU dev host (no cpu.max quota) the gateway resolves 16. On the 128 vCPU load box, width 8 cut a 25-start burst median from 54 s to 37 s with each session/new at its isolated 3.8 s. The wave runs there also ran this auto formula at 16 alongside the other load fixes (burst:25 p50 18.7 to 39.5 s against 59.1 s on main), but per-call session/new time at 16 was not broken out. Hosts with 16 or 32 cores were not measured.

Related Issues

Closes #17055

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

@Pearcekieser
Pearcekieser requested a review from a team as a code owner October 5, 2026 17:01
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — 🟡 CONCERNS

Premise-level review of 2ecb02aaffac4e9ebbe532094dd93042358b9e96 via the fork AI-review pipeline — 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: CONCERNS

The new cgroup ancestry walk re-implements the existing subagent._cgroup_memory_roots walk, and the report-only row means existing installs mostly keep width 2, the queueing the Goal removes.

Not justified as shipped

  • Item 3 — duplicate of src/kiro_crew/subagent.py:1868: cgroup_cpu_quota reads /proc/self/cgroup and walks ancestors under a hardcoded /sys/fs/cgroup. _cgroup_memory_roots already does this walk, using mountinfo to find the mount boundary. A grep for /proc/self/cgroup in src finds 3 existing readers.
    Subtraction: drop the hand-rolled membership parse and root walk; get the v2 process directory and mount boundary from _cgroup_memory_roots, then read cpu.max along it.
    Clears when: cpu.max is read through the existing walk, or the author shows that walk cannot reach cpu.max.
  • Item 8 — inherited: the report-only row rests on symmetry, "REPORT-ONLY on the stagger's reasoning… 2 is an ordinary deliberate value". But the description says existing config.json files hold "the old default materialized as 2". A materialized 2 was never chosen, so those installs keep queueing two at a time.
    Clears when: evidence that stored 2 values are operator-chosen rather than materialized defaults.
  • Item 9 — one consumer, generalized: HostCapacity/host_capacity() are framed as "every auto start limit sizes from the same reading". A grep for host_capacity( finds 1 consumer, resolve_session_start_sizing. The second user is "a follow-up PR".
    Subtraction: fold the reading into the session-start sizing and drop the "start limits" generality until the follow-up lands.
    Clears when: the follow-up consumer is in this diff, or the layer is folded.

What this change ships

Inventory (9 items) — 6 justified

Intent: let a burst of agent starts use a big host's spare capacity instead of queueing two at a time. FIX (perf).

  1. Session-start width now defaults to host-sized auto instead of 2 — justified
  2. Config accepts auto in any case; junk falls back to auto — justified
  3. Core count is capped by a cgroup v2 cpu.max quota found by walking cgroup ancestors — duplicate of subagent._cgroup_memory_roots
  4. Gateway logs the resolved width and its inputs after the socket binds — justified
  5. kirocrew doctor prints what auto picks now — justified
  6. Subagent startup cap uses floor 2 until the host reading is cached — justified
  7. Schema emits both JSON types for an int | str field — justified
  8. Existing configs with a stored 2 stay at 2 (report-only row) — inherited
  9. Shared per-process HostCapacity layer for "every auto start limit" — one consumer, generalized

[FIRST-PRINCIPLES-REVIEWED] 2ecb02a

Description read

[DESCRIPTION-READ] 66ef6508c0a1638cb047ffdbe0041be868f7b514b8c461e311adcad6f0272d01

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 2ecb02aaffac4e9ebbe532094dd93042358b9e96 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check per-call session/new latency at width 16. The description admits it "was not broken out", and 16 is what every 64-core-plus host now gets by default.

[DESIGN-REVIEWED] 2ecb02a

Description read

[DESCRIPTION-READ] a4ed272b5092c7e00189174292ef95428b0779d698e956c32c755551093e2471

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 2ecb02aaffac4e9ebbe532094dd93042358b9e96 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2ecb02a

@Pearcekieser
Pearcekieser force-pushed the perf/session-start-auto-sizing branch from eb2d328 to 2572080 Compare October 5, 2026 17:45
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • size_from_host had one caller passing constants: fixed in 2572080

fixed: size_from_host is deleted. size_session_start_concurrency does the clamp itself with the module constants, so the sizing is unchanged and git grep size_from_host is empty.
The once-per-process host reading (host_capacity()) stays. The gate, the subagent startup cap, the gateway boot log and kirocrew doctor all read it, so it is not a one-consumer generalization.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 5, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • AUTO_CEILING = 16 rests on no measurement: rebutted, body corrected

Width 16 did run. The 128 vCPU / 512 GB load box resolves auto to 16, and the wave runs w-a, w-c and w-c3 ran the same F9 auto formula, alongside the other wave fixes, for burst:25 (p50 39.5 s, 18.7 s, 20.4 s against 59.1 s on main). The wave summary records that the session/new gate stopped being the limiting queue there.
What was not broken out is per-call session/new latency at 16. Only 2 and 8 have that number. The body now says this instead of "16 was not measured".
16 is reached only on hosts with 64+ usable cores and 48+ GB available. Every smaller host gets 15 or less, and the measured box is in the class that reaches 16.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • available_GB // 3 duplicates the subagent memory admission: rebutted

The two cover different starts. spawn_min_memory_gb and the start price admit subagents only. This gate sits on every ACP session/new: person chat starts, cron and _bg one-liners as well as subagents. None of those other starts pass a memory check.
The memory is spent inside the gated window. session/new blocks while kiro-cli spawns the session's MCP servers (acp/runtime_start.py, the gate's own comment), and that is where a session tree's ~2.6 GB comes from. So N parallel starts allocate about N x 2.6 GB while holding the gate.
The term only binds on a host with little memory per core. There it stops a burst of chat starts from allocating more than the host has.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • int | str widening where a 0 = auto sentinel exists: rebutted

0 is taken for this key. The loader has clamped it to 1 since the key shipped (main's _safe_int(..., 2, 1, 64)), and test_loader_accepts_auto_or_int[below-range-clamped] pins 0 -> 1. A stored 0 today means a 1-wide gate, so reusing 0 for auto would silently change it to up to 16.
The default is spelled "auto" because that is the requested contract and what doctor and the boot log print. The follow-up for the cold-start limits (agent.cold_start_concurrency, agent.runtime_spawn_concurrency) is planned with the same "auto" default (F4b in the load-fix plan), so _scalar_union_types is the schema rule for that family, not for one field.

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 2ecb02aaffac4e9ebbe532094dd93042358b9e96 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2ecb02a

@Pearcekieser
Pearcekieser force-pushed the perf/session-start-auto-sizing branch from 2572080 to c261d03 Compare October 5, 2026 18:46
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in docs/system-specs/modules/config.md, config/sections.py and slack/gateway.py since this head went green (6f70008 -> c6bfd72); CI re-running. No code change.

This push also re-runs two lanes that failed on 2572080 for reasons outside the diff. The fork GPT 6.1 Review published "review incomplete" because its passes did not finish. Backend Tests (Windows) (7) failed on test_mcp_gateway_spawn_gate.py::TestTheRefusalArrivesBeforeTheStubGivesUp::test_a_queue_aware_stub_receives_the_capacity_refusal_not_a_timeout, a timing test in a module this PR does not touch. It passes locally on this head.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 5, 2026
@Pearcekieser
Pearcekieser force-pushed the perf/session-start-auto-sizing branch from c261d03 to c520193 Compare October 5, 2026 22:15
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Re-run, no code change: c520193 has the same tree as c261d03 and sits on the same base (c6bfd72).

On c261d03 every review lane passed (GPT, Opus, Design, First Principles, UX, Security Scope). Seven small gate jobs in Fast Gate, Fork Workflow-Change Guard and the macOS decide step waited about 1 h 40 m without getting a runner while the repo had about 1,600 queued runs, and GitHub cancelled them at 20:33 UTC. A fork contributor cannot rerun them, so this push starts them again.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 5, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • String "auto" where the sibling knobs use 0 = auto: rebutted, reason now in the description

0 already has a meaning for this key. The loader has clamped it to 1..64 since it shipped, so a stored 0 runs a 1-wide gate today and test_loader_accepts_auto_or_int[below-range-clamped] pins 0 -> 1. Reading 0 as auto would silently widen that gate to as much as 16.
agent.max_subagents and taskrunner max_parallel never gave 0 another meaning, so the sentinel was free there. It is not free here. The PR description's What changed section now says this.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • host_capacity() has one consumer: rebutted

The owner of this work asked for the host reading to stay reusable because the cold-start limits change (F4, a separate PR) reads the same cached reading as soon as this lands. Folding it into resolve_session_start_sizing now means the next PR undoes the fold.
The layer is one frozen dataclass and a lock-guarded cache, no parameters or hooks. The earlier one-caller helper with free parameters (size_from_host) was removed.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Function-local session_start_sizing imports: accepted, not fixed on this head

Correct: none of the four imports avoids a cycle (config/loader.py already imports the module at top level). The rule is non-blocking.
Moving them needs a push, and a push now restarts the full CI matrix that just got runners after a 3-hour Actions backlog (about 800 runs still queued). The move goes into the next push this PR makes, and if none is needed before merge, into the follow-up PR that reuses this module.

@Pearcekieser
Pearcekieser force-pushed the perf/session-start-auto-sizing branch from c520193 to c36e9cf Compare October 5, 2026 23:45
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Function-local session_start_sizing imports: fixed in c36e9cf

fixed: the import now sits at module top in acp/runtime_start.py, subagent.py, doctor_checks/workload.py and slack/gateway.py. None of them avoided a cycle: session_start_sizing imports only the stdlib and kiro_crew.cpu_affinity at module level, and each of the four modules imports cleanly.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Pushed c36e9cf, rebased on main 231561d. It moves the four session_start_sizing imports to module scope (GPT span f8c2f2e6a075) and changes nothing else.

The push also restarts Backend Lint & Type Check (3.12). On c520193 that job hit its 25-minute limit during mypy because black alone took 15 minutes on a slow runner. The same job passed in about 19 minutes on five other PRs at the same time, and mypy is clean locally on the changed modules.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 6, 2026
@Pearcekieser
Pearcekieser force-pushed the perf/session-start-auto-sizing branch from 4466337 to 287c1ab Compare October 6, 2026 08:04
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • First-use sizing blocks the gateway event loop: fixed in 287c1ab

fixed: _startup_cap() is now an in-memory read. SubagentManager.__init__ captures the configured value (the same config read it always made), and _resolved_session_start_width() calls the new cached_session_start_concurrency(), which never probes and never takes _host_lock. It sizes auto from the cached host reading once the gateway's post-bind worker thread has published it, and uses the floor (2) until then. The SessionStartGate already resolves its width through asyncio.to_thread.
Test: test_subagent_manager_never_probes_the_host replaces _host_lock with one that fails on entry. It fails on 4466337 and passes here. Rebased onto main 6f2d2c7.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 6, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • auto ceiling of 16 not measured per call: needs a decision (same class as 152de73dbd55)

Unchanged from the needs-a-decision reply on 4466337: width 8 is the widest per-call measurement. It clears with a per-call run at width 16 on the shared load box, or AUTO_CEILING = 8. The PR owner is choosing between them.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • PR edits its own RFC §4.4 line: needs a maintainer confirmation (same class as 58326354b042)

The review keeps this as a judgement call, not a block. It clears when a maintainer confirms §4.4's overload-resilience scope covers a host-sized default, or posts /ai-review override first-principles 287c1abfb2493740477fcb762702bb1aa1af1bc4: <decision>.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Width 16 without a per-call measurement: needs a decision (tracked with first-principles 5b82c3c530fd)

Same open question as the First Principles ceiling item: measure width 16 per call, or ship AUTO_CEILING = 8. Either answer clears both lanes.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Windows shard 3 failure on 287c1ab is inherited from main, not this diff: test_source_pin_budget.py::test_no_test_module_reads_more_of_the_turns_source_than_its_budget reports test/test_session_control_owner_dm.py at 3 reads against a budget of 1. That file came from #15301 (merged 07:26 UTC) while #17218 set the budget, and the test fails the same way on a clean main 6f2d2c7 checkout. This PR does not touch either file.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author

More failures on 287c1ab, none from this diff:

  • Windows shard 2: test_native_skill_projection.py::test_prune_scans_the_lease_directory_once_for_many_candidates. This PR touches no skill code, and the test passes locally on this head.
  • Backend Lint & Type Check (3.12): hit the 25-minute job limit with mypy still running. On the hosted runner that fork PRs use, the black step alone took 15 minutes (08:20-08:35). The same lane timed out on this PR's previous two heads and on other fork PRs today (perf/mcp-lazy-numpy twice, perf/cold-start-autosize), and it passes in 24-25 minutes when it does finish.
  • Coverage Gate fails closed because backend tests failed.
    Shard 3 and Linux shard 3 are the main-red source-pin budget test described above.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 6, 2026
agent.session_start_concurrency now defaults to "auto": the gateway sizes
the SessionStartGate once per process as
clamp(min(cpus // 4, available_GB // 3), 2, 16), with cpus the affinity
count capped by the tightest cgroup v2 cpu.max quota and memory from the
resource_status probe. An explicit integer still wins (clamped 1..64).

session_start_sizing.py reads the host once (host_capacity) and keeps the
width math separate (size_from_host) so other start limits can reuse the
same reading. The gate, the subagent startup cap, the boot log and
kirocrew doctor resolve "auto" through it. The config schema gives an
int | str field both JSON types.
@Pearcekieser
Pearcekieser force-pushed the perf/session-start-auto-sizing branch from 287c1ab to 2ecb02a Compare October 6, 2026 10:19
@Pearcekieser

Copy link
Copy Markdown
Contributor Author

Rebased onto main cc7e798 as 2ecb02a, no behaviour change and no conflicts. This picks up #17309, which fixes the source-pin budget test that failed shard 3 on Linux and Windows. Sizing and source-pin tests (97) pass on the new base. The push also reruns the lint lane that hit its time limit and the Windows shard 2 flake.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 6, 2026
@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • cpu.max walk duplicates _cgroup_memory_roots: accepted, lands with the next push

accepted: cgroup_cpu_quota no longer parses /proc/self/cgroup or assumes /sys/fs/cgroup. It takes the v2 (process directory, mount boundary) pairs from subagent._cgroup_memory_roots(), imported function-locally the way resource_status already imports the memory probe, and reads cpu.max from the process directory up to the mount. _CGROUP_V2_ROOT is gone.
Tests: the existing ancestry, namespace-root and no-quota cases now drive the shared walk, plus test_cgroup_quota_stops_at_the_mount_boundary and test_cgroup_quota_reads_the_shared_cgroup_walk. Committed locally; it ships with the push for the open ceiling decision so CI and review run once.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • Report-only row leaves materialized 2 in place: needs a decision

The finding is right that a stored 2 cannot be told apart from the old default written back by a full-document save(), so on existing installs auto mostly never takes effect. The alternative is a MIGRATE row in superseded_defaults, which rewrites a stored 2 to "auto". auto floors at 2, so the migration can only keep or widen the start width, but it would also widen a host whose operator chose 2 on purpose. That trade-off belongs to the PR owner; no rebuttal will be posted.

@Pearcekieser

Copy link
Copy Markdown
Contributor Author
  • HostCapacity generalized for one consumer: accepted, folds with the memory-term decision

accepted: resolve_session_start_sizing is the only caller. The open memory-term decision (span 26fcc94c4d80) decides what the reading holds: dropping available_gb // 3 leaves cores only. The fold into session-start sizing, with the "every auto start limit" wording removed, ships in that same push.

@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 Oct 6, 2026

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The auto width stays safe at both ends. size_session_start_concurrency clamps to 2..16. An unknown CPU or memory reading drops out of the min instead of collapsing it to 0, and with neither known the width is the floor of 2. An explicit config value still gets the 1..64 clamp, junk falls back to auto, and the gate keeps its max(FLOOR, …), so no path gives a 0-wide gate. The cpus // 4 term already scales the width to the host. 16 is only reached at 64 or more usable cores and at least 48 GB available, so I'm fine shipping the 16 ceiling without a per-call measurement at that width. Capping usable cores by the cgroup cpu.max quota is a good touch, and so is refusing .. in the cgroup path, so docker --cpus hosts are not oversized. Moving the probe off the boot path and off the event loop is the right shape. The RFC §4.4 wording and the report-only handling of a stored 2 still need a maintainer's ruling. Neither is a correctness problem.

@iamwhatever
iamwhatever enabled auto-merge (squash) October 6, 2026 16:42
@iamwhatever
iamwhatever merged commit 1c0a134 into kirodotdev:main Oct 6, 2026
103 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Size agent.session_start_concurrency from the host by default

2 participants