Skip to content

feat(mate): let the owner cap how many workers a Bot keeps open - #37381

Merged
buluoray merged 1 commit into
mainfrom
crew/slack/bot-worker-cap
Nov 15, 2026
Merged

buluoray merged 1 commit into
mainfrom
crew/slack/bot-worker-cap

Conversation

@buluoray

@buluoray buluoray commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A Bot's owner can set how many worker sessions the Bot keeps open at once, and the Bot cannot go past that number or raise it.

A Bot that plans "two or three workers" can open 16 at once today (#37361). Nothing writes the plan's number down as a limit. A Bot's chat is held only by the gateway-wide per-creator session cap (session.max_per_creator, 50 by default), which is a fairness share between callers, not the owner's plan for one Bot.

Why it matters

Every open worker spends credits and opens pull requests. In #37361 the owner could not stop the fan-out without stopping the Bot by hand. A limit the owner sets, with a default that stops a runaway, is the first of the per-goal limits that issue asks for.

Not a goal

What changed (motivation → approach → change)

The plan's worker count binds nothing, so a Bot opened a worker per finding. Each Bot now has its own max_workers setting, set by the owner on the Bot's settings page in a new Workers at once row. It is 0 by default, which means no limit of the Bot's own, so nothing changes until the owner picks a number from 1 to 32. That keeps rfc-work-ledger-concurrency-cap.md section 7: the bound comes from the host's resources unless a person chooses one.

With a limit set, every verb that would leave one more of the Bot's workers open is refused with bot_worker_cap_reached (409): session_create from the Bot's chat or from one of its workers, session_revive of an archived worker, and session_fork of a worker. Each asks one check, worker_cap_refusal, with the execution record the new slot will run under, and counts the Bot's open workers across all its chats. A new worker is counted in the same step that makes its slot, so two parallel creates cannot both pass. A worker that a restart brought back is counted from its saved execution record, read off the event loop before the check. A worker keeps its seat until it is closed, and the refusal says so. A handoff opens no slot, so it is not checked. The cap counts the Bot's own worker sessions, on its worker template. A session that a worker opens on another template keeps the Bot's member id but is not counted; the per-creator cap still bounds it, and counting it is #37538. Only the owner route PUT /api/agents/<name> writes the field, and no Bot tool calls that route. The field is shipped on GET /api/members for the settings card and withheld from GET /api/agents, like the other worker settings.

Where: the field and its range in src/kiro_crew/config/sections_session.py (read in config/loader_pipeline.py, re-exported by config/sections.py, listed in config-baseline.json); the owner write in dashboard/agent_admin/crew_update.py; the read in dashboard/handlers/members_roster.py; the count and refusal in the new dashboard/state_parts/bot_worker_cap.py, called from dashboard/session_control_parts/session_create.py, session_revive.py and session_tree.py; the doc in src/kiro_crew/docs/session-control.md; the row in website/src/pages/members/CrewProfileSettings.tsx, the type in website/src/api/client/agents.ts, and three strings in all 12 website/src/i18n/locales/*.json (plus the regenerated en-XA.json).

Backwards compatibility

Compatible: a record with no max_workers loads as 0, no limit, so every Bot behaves as it does on main until its owner sets a number. A hand-edited value outside 0-32 is held in range.

Removes nothing: the change adds a field and a refusal that only fires once an owner sets a limit; no field, route or key is removed or renamed.

Tests

  • test/test_bot_worker_cap.py: no limit by default (three creates pass); a hand-edited -1, 99 or a string is held in range; the create past a limit is refused with bot_worker_cap_reached and creates nothing; a closed worker frees its seat; a worker whose in-memory count was dropped (as after a restart) still takes its seat; with the birth write's own registration switched off, the second create is still refused; a worker's own create, a fork of a worker and a revive of an archived worker are each refused past the limit. Mutation check: removing any one of the create, fork or revive checks, the restore read, or the count at mint turns at least one of these red.
  • website/src/pages/members/CrewProfileSettings.test.tsx: the row reads "No limit" by default, the caption says only the owner changes it, a pick writes { max_workers: 3 } as a number and touches no thread, "No limit" is sent as 0, and a stored value off the step list is offered checked.
  • test/test_agents_roster_contract.py: max_workers is listed as withheld from GET /api/agents.

Manual verification

Component render with mocked data (website/capture/bot-worker-cap.html, opened in a headless browser): the row reads the stored limit, the picker checks it, and the page logs no errors, in dark and light. Not run on a live gateway.

Screenshots / video

Component render, not the live page (mocked data).

Bot settings with the Workers at once row and its picker, dark

Light theme

Bot settings with the Workers at once row and its picker, light

Related Issues

Part of #37361

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

@buluoray
buluoray requested review from a team and KiroCrewCaptain as code owners November 14, 2026 22:18
@buluoray
buluoray requested a review from iamwhatever November 14, 2026 22:18
@buluoray
buluoray enabled auto-merge (squash) November 14, 2026 22:18
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 5b7860985b66e4d499c561178d052181a3b6a301 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns. The limit is owned by the operator and is off by default, so nothing changes on upgrade. The check runs in the same step that makes the slot, it covers create, revive and fork, and the PR removes nothing.

Notes

  • The Bot can still write config.json through a shell, so "the Bot cannot raise it" only holds as far as the tool gate does. The other worker settings already have this gap; this PR doesn't widen it.

[DESIGN-REVIEWED] 5b78609

Description read

[DESCRIPTION-READ] 3ed133511e7064dd4c67f526a8193b856b4149c0aaed0e8590b32a33c8395707

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 Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 5b7860985b66e4d499c561178d052181a3b6a301 — 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 does not.

First-Principles-Verdict: PASS

The cap is opt-in (default 0) and has a cause behind it (#37361). It doesn't copy the work ledger's item cap, because that cap counts board items, not sessions. Two framing gaps remain.

Notes

  • Item 3 — oversized: ## Not a goal says "Counting workers a Bot revives or forks; only session_create is checked", but the diff checks both (worker_cap_refusal in session_revive.py and session_tree.py). Subtraction: drop the revive and fork checks in session_revive.py and session_tree.py. Clears when: the mechanism is removed, or a human amends the Goal.
  • Item 6 — undeclared: ## Why it matters promises "a default that stops a runaway", but the diff ships BOT_MAX_WORKERS_DEFAULT = 0, which means "no limit". The A Bot given a goal does not converge: it creates work for itself faster than it closes it, and the owner cannot tell where it stands #37361 fan-out still happens for every Bot until its owner sets a number.

What this change ships

Inventory (7 items) — 5 justified

Intent: let a Bot's owner put a hard limit on how many workers the Bot keeps open at once. This is an ADDITION.

  1. New "Workers at once" picker on the Bot settings page (No limit, or 1–32) — justified
  2. Creating a worker past the limit is refused with 409 bot_worker_cap_reached, whether the Bot's chat or one of its workers asks — justified
  3. Reviving or forking a worker past the limit is also refused — oversized
  4. Workers brought back by a restart are counted from their saved records — justified
  5. New owner-only max_workers field: written by PUT /api/agents/<name>, shipped on /api/members, held out of /api/agents — justified
  6. Default is 0 (no limit), so nothing changes until the owner sets a number — undeclared
  7. New doc paragraph, config-baseline row, and strings in 12 locales — justified

[FIRST-PRINCIPLES-REVIEWED] 5b78609

Description read

[DESCRIPTION-READ] 89102bf444a8bf327036cfddab5149d563ddaaee208bdc0de9c8b17bad9b5696

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 Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 5b7860985b66e4d499c561178d052181a3b6a301 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks. The blind reader understood the "Workers at once" row and its picker, and said it would use them.

Notes

  • profile_worker_cap_hint doesn't say what happens when the Bot reaches the limit. The reader hesitated over "No limit" and the big numbers because they couldn't tell what those cost. Add one clause, e.g. "A new worker is refused until one closes."
  • The default state, where the row reads "No limit", appears in no screenshot. The picker list does show "No limit" as an option, so this is not a gap.

[UX-REVIEWED] 5b78609

Description read

[DESCRIPTION-READ] 51e0c940e9d970ee6feca0cad219e6704c212292884f7e24f8e184c393282b7b

That sha256 names everything this verdict read: the PR description, plus the 5 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 Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

Notes:

  • The English hint "can run at the same time" doesn't match what the backend counts. The backend counts open worker sessions, and a finished worker counts until it is closed. The backend's refusal text and the field help already say this.
  • fork_session marks its child as a worker in _stamp, which runs after the bind await. So two forks of a Bot worker running at the same time can both pass _recheck. The per-creator cap already has the same gap.

[OPUS-REVIEWED] 5b78609

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable 5b7860985b66e4d499c561178d052181a3b6a301 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ human override accepted

Human judgment by @buluoray overrides the GPT 6.1 finding for 5b7860985b66e4d499c561178d052181a3b6a301; the recorded reason is authoritative for this commit.

[GPT-OVERRIDE] 5b78609

This comment is updated in place on each push.

The model was not re-run because an authorized human decision supersedes it.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 5b7860985b66e4d499c561178d052181a3b6a301 false-positive: <reason, 20 to 500 characters>

@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 Nov 14, 2026
@buluoray
buluoray force-pushed the crew/slack/bot-worker-cap branch from 384b0aa to cd48e00 Compare November 15, 2026 04:44
@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 Nov 15, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

span=18a6f75e1e3c
self-added: yes
mechanism: Bot worker count read only from the turn-time member map

  • Worker count omits restored and in-flight sessions

fixed in cd48e00: create_session now counts the new worker in the same synchronous step that mints its slot, before any await, so parallel creates cannot both pass.
A restarted gateway's worker slots are read from their saved execution records (_count_restored_workers, off the loop) before the check.
Tests: test_a_worker_a_restart_brought_back_still_takes_its_seat and test_a_worker_is_counted_from_the_moment_its_slot_is_made; each turns red when its half of the fix is removed.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=420fdb4ad597
self-added: yes
mechanism: Bot worker count read only from the turn-time member map

  • Restored workers are not counted against max_workers

fixed in cd48e00: before the check, create_session reads the saved execution record of every worker slot not yet counted (_count_restored_workers, off the loop) and enters it with note_worker_session.
Test: test_a_worker_a_restart_brought_back_still_takes_its_seat drops the in-memory count and the next create is still refused; it turns red without the read.

@buluoray
buluoray force-pushed the crew/slack/bot-worker-cap branch from cd48e00 to 1c363f5 Compare November 15, 2026 05:05
@buluoray

Copy link
Copy Markdown
Contributor Author

span=935618037b85
self-added: yes
mechanism: Bot worker cap asked only by session_create from the Bot's chat

  • session_revive bypasses max_workers

fixed in 1c363f5: one check, worker_cap_refusal(state, execution) in the new dashboard/state_parts/bot_worker_cap.py, keyed on the record the new slot runs under. session_revive reads the target's saved record in _containment and refuses in _final_check; session_fork refuses in its mint-time _recheck, since a fork runs under its source's record.
Handoff moves a slot to another manager and opens nothing, so it is not checked.
Tests: test_reviving_an_archived_worker_takes_a_seat, test_a_fork_of_a_worker_takes_a_seat; each turns red when its check is removed.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=420fdb4ad597
self-added: yes
mechanism: refusal text named a remedy that frees no seat

  • "wait for one to finish" frees no seat

fixed in 1c363f5: the refusal and session-control.md now say a worker keeps its seat until it is closed, and name session_close as the only remedy.

@buluoray

Copy link
Copy Markdown
Contributor Author

span=3c50665586b6
self-added: yes
mechanism: Bot worker cap gated on the caller being the Bot's chat

  • Worker-originated creates bypass the Bot's cap

fixed in 1c363f5: session_create asks worker_cap_refusal with child_execution, the record the child runs under, instead of gating on own_worker; the mint-time count uses the same record. A worker's own create is held to its Bot's limit.
Test: test_a_worker_cannot_open_a_second_worker_past_the_limit; it turns red when the check is removed.

@KiroCrewCaptain

KiroCrewCaptain commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 25% chance that this change introduces a defect, above the 12% limit for approving on its own.

The PR adds an owner-set max_workers limit per Bot (0 means no limit), enforced on session_create, session_fork and session_revive. The check is synchronous and the new worker is counted at mint (create), at stamp after a recheck (fork) and in the revive's final check, so parallel creates cannot both pass. Workers a restart brought back are counted from their saved records, read off the loop. The default of 0 preserves today's behaviour. On trust: only the owner route PUT /api/agents writes the field, change cards cannot reach agents.* paths, and the relay teammate roster is an allowlist. Core enforcement tests are solid. The gaps are a stale non-goal bullet, the owning system spec not updated, no backend test for the PUT route's write and validation, and no test that a fork or revive under the limit succeeds. None of these is a concrete failing path, so the recommendation is to approve with notes.

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 5b7860985b · 717 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@buluoray
buluoray force-pushed the crew/slack/bot-worker-cap branch from 1c363f5 to d611b6f Compare November 15, 2026 05:24
@buluoray

Copy link
Copy Markdown
Contributor Author

span=f99e9f510116
self-added: yes
mechanism: restored-worker records read in one batch under one except

  • One malformed restored record disables counting for healthy Bots

fixed in d611b6f: count_restored_workers reads each saved record on its own; an unreadable one is logged and leaves only its own slot uncounted, and every readable worker is still counted.
Test: test_one_unreadable_restored_record_does_not_stop_the_others_counting fails on the previous head and passes here.

@buluoray
buluoray force-pushed the crew/slack/bot-worker-cap branch from d611b6f to 054aaac Compare November 15, 2026 06:01
@buluoray

Copy link
Copy Markdown
Contributor Author

span=652d198adb29
self-added: yes
mechanism: cap read of a saved execution record raised instead of answering

  • Revive raises on an undecodable execution record

fixed in 054aaac: new read_worker_execution in bot_worker_cap.py returns None when a record cannot be read, so it is not a counted worker. Revive and fork both use it; neither verb raises from the cap's read. count_restored_workers uses it too.
Test: test_a_revive_whose_record_cannot_be_read_is_not_an_exception fails with ValueError on the previous head and passes here. The note on agents.ts is fixed too: 0 means no limit.

@buluoray
buluoray force-pushed the crew/slack/bot-worker-cap branch from 054aaac to 66afd4e Compare November 15, 2026 06:36
@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 Nov 15, 2026
@buluoray
buluoray force-pushed the crew/slack/bot-worker-cap branch from 66afd4e to 698edac Compare November 15, 2026 06:58
@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 Nov 15, 2026
@buluoray
buluoray force-pushed the crew/slack/bot-worker-cap branch 2 times, most recently from dc9519a to 4f867c6 Compare November 15, 2026 08:33
@buluoray

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in test/metrics/test_kiro_export_destination.py (the main-red fix #37545) since this head ran (3887f88 -> 09b0ddc); CI re-running.

@buluoray
buluoray force-pushed the crew/slack/bot-worker-cap branch from 4f867c6 to 5b78609 Compare November 15, 2026 08:55
@buluoray

Copy link
Copy Markdown
Contributor Author

span=f99e9f510116
self-added: yes
mechanism: restart read applied a result after its own await without checking the table again

  • A stale restoration read erases an in-flight fork's worker count

fixed in 5b78609: after the off-loop read, count_restored_workers applies a record only when it read as something, the slot is still open, and the slot was not counted during the read. An empty read never reaches note_worker_session, so it can neither uncount a worker nor move it off its Bot's harness.
Test: test_a_restart_read_never_uncounts_a_worker_counted_while_it_ran fails on the previous head ('' == 'pixel') and passes here.

@buluoray

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 5b78609 deferred #37538: agent: the fork post-bind recheck can count its own child when a parallel restart read counts it during the bind. The result is a loud 409 bot_worker_cap_reached that clears on retry, and the owner limit is never passed. Leaving the child out needs the child key in fork_slot recheck contract, so it is deferred to #37538 with the cap registry work.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@buluoray recorded a deferred release (class deferred) for the gpt AI finding on 5b7860985b66e4d499c561178d052181a3b6a301.

agent: the fork post-bind recheck can count its own child when a parallel restart read counts it during the bind. The result is a loud 409 bot_worker_cap_reached that clears on retry, and the owner limit is never passed. Leaving the child out needs the child key in fork_slot recheck contract, so it is deferred to #37538 with the cap registry work.

This decision applies only to this commit. A new push requires a new judgment.

@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 Nov 15, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this. The cap logic is well contained. One thing is missing before this can move forward.

  1. website/src/pages/members/CrewProfileSettings.tsx:515: on this head, nobody has seen the new "Workers at once" row rendered. Both images in the PR body point at local file paths, which GitHub cannot load, so they show as removed. The diff commits the capture harness (website/capture/bot-worker-cap.html and .tsx) but no rendered image. The result is that the Design and UX lanes both said they could not evaluate the row. A UI control would then merge with neither its layout nor its copy reviewed. Smallest fix: render the existing harness in dark and light. Include the open picker and a row with a limit set. Attach the images as GitHub uploads in the PR body, or commit them under temp-screenshots/. Then re-run the Design and UX lanes on that head. No code change is needed for this item.

Optional:

  • A worker can still start runs through spawn_run / spawn_sub_agents. Those runs never land in state._slots, so bot_worker_cap.py:64 does not count them. Consider adding this path to #37538.
  • The settings caption (en.json:9182, plus zh-CN) says workers that "can run at the same time". But a finished worker that is still open also takes a seat, as the backend refusal text says. Wording about open sessions would match the behaviour.
  • ## Not a goal says only session_create is checked, but the diff also checks revive and fork. Please keep those checks. A maintainer can correct the bullet and the members_roster.py:445 comment. docs/system-specs/modules/session-control.md could also mention the new refusal next to the per-creator ceiling.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 15, 2026
@buluoray

Copy link
Copy Markdown
Contributor Author

@KiroCrewCaptain the required item is done, with no code change and no new head (still 5b7860985b66).

  • The dark and light renders of website/capture/bot-worker-cap.html are now GitHub uploads in the PR body. Both show the open picker and a row with a limit of 3 set.
  • I re-ran the Design and UX lanes on this head. Design: PASS, "No design-level concerns." UX: PASS, and the blind reader understood the "Workers at once" row and its picker.

On the optional notes:

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

This adds a new concept, so it needs a design sign-off from a maintainer before it can merge. A maintainer will post the decision here.

Earlier review, item 1 (no rendered view of the "Workers at once" row): fixed. The body now has dark and light uploads of the open picker and a row with a limit set, and the Design and UX reviews both passed on this head after the uploads.

Review result on head 5b78609: no blocking defect found. The cap check runs before the slot is made on create, revive and fork, and the new worker is counted in the same step that makes it, so parallel creates cannot both pass. The default of 0 keeps current behaviour, and read errors do not turn into refusals. Only the owner route writes max_workers, and it checks the type and the 0 to 32 range. Linked issue #37361 is marked as a design-level change, which is why this waits for a maintainer.

Optional:

  • test/test_bot_worker_cap.py: fork and revive are only tested on the refused side. A test that a fork and a revive under the limit both succeed would catch a check that refuses too often. The two unreadable-record tests swallow SessionControlError, so they pass on either outcome.
  • The body says every verb that opens a Bot worker is refused, but a worker run started through spawn_run(crew=<bot>) is not counted. That path is deferred to Count a Bot worker's children on other templates toward the Bot's worker cap #37538. A note in the body, or a test that pins the current behaviour, would keep the claim accurate.
  • docs/system-specs/modules/session-control.md lists the per-creator ceiling but not max_workers or bot_worker_cap_reached. One short paragraph there would keep the spec in step.

@KiroCrewCaptain
KiroCrewCaptain dismissed their stale review November 15, 2026 10:40

Withdrawn: every item in this review is fixed or answered on the current head (see the follow-up comment). Other holds on this PR are listed there.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 15, 2026

@bolichen97 bolichen97 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.

Approve. Read the whole diff on this head, including the tests, every locale and config-baseline.json.

  • Default matches main: max_workers is 0, meaning no limit, and worker_cap_refusal returns None whenever the cap is 0 or the record is not the Bot's own worker. The baseline only adds agents.*.max_workers with defaultValue: 0. So nothing is refused until the owner picks a number, which keeps the stricter path opt-in.
  • Only the owner route (PUT /api/agents/<name> in crew_update.py) writes it, validated as an int in 0..32 with bools rejected; no Bot tool writes it.
  • Fail-open is right: an unreadable config or execution record gives cap 0 or an uncounted slot, never a refusal or a raw error, and tests pin both for revive and fork.
  • The seat is taken at mint (note_new_worker) inside the same synchronous window as the check, so parallel creates cannot both pass; revive checks in _final_check before publish, fork in _recheck.
  • No regex in product code.

Non-blocking: count_restored_workers runs a threaded record read on every own-worker create even when the cap is 0. It only reads slots not yet counted, so it is cheap after the first pass, but it could skip entirely when bot_max_workers is 0.

Not checked: no local run; I relied on the 106 green checks.

@buluoray
buluoray merged commit 161876f into main Nov 15, 2026
112 of 113 checks passed
@buluoray
buluoray deleted the crew/slack/bot-worker-cap branch November 15, 2026 17:12
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 15, 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.

3 participants