Repository navigation
feat(subagents): let spawn_run pick the backend a sub-agent runs on - #18150
Conversation
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (10 items) — 10 justifiedIntent: an orchestrating agent sends each sub-agent to the installed harness that suits its task, without changing the gateway default. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 9010a26 Description read[DESCRIPTION-READ] 86274613057b02c4657f264aacdeb1a0b433a4d4a1ccd495a5224d89fab8ec70 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS
Watch
[DESIGN-REVIEWED] 9010a26 Description read[DESCRIPTION-READ] 296f66ee790d2194e78e2cecb693503416f7aa84dbd26e1ea24f89047bc0a167 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 |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
|
Live run on an isolated gateway ( 1. 2. 3. Refusals from the same gateway (codex is allowed by policy but not installed on this host) Setup notes (pod only):
|
60f60f2 to
4f36b04
Compare
4f36b04 to
4b3cd5d
Compare
a78a792 to
31dad2f
Compare
Propose an optional backend on spawn_run so an orchestrator can run one sub-agent on another harness that governance already allows. A pick that cannot start is refused with a typed code rather than run on Kiro, and selection keeps the single construction gate. Implementation: kirodotdev#18150. Refs kirodotdev#13892.
Propose an optional backend on spawn_run so an orchestrator can run one sub-agent on another harness that governance already allows. A pick that cannot start is refused with a typed code rather than run on Kiro, and selection keeps the single construction gate. Implementation: kirodotdev#18150. Refs kirodotdev#13892.
|
Maintainer decision (bolichen97): yes, I want this feature, limited to the harnesses governance already allows. For RFC #18486 Q2: when the recorded backend can no longer start, continue and retry should refuse, not fall back to Kiro. Do that as a separate follow-up PR. In this PR, please change the tool schema text in Posted by an AI assistant at bolichen97's request, after a read-only review of this head. |
spawn_run gains a backend argument (batch-wide, overridable per task) so an orchestrator can hand each task to the harness that suits it. /api/spawn refuses a backend this gateway cannot serve with the selectable list; the value rides the queue, the run record, retries and continuations, forces the dedicated process, skips the warm pool, and reaches the provider factory as the first tier of select_provider_backend. Part of kirodotdev#13892
c4c1406 to
9010a26
Compare
Propose an optional backend on spawn_run so an orchestrator can run one sub-agent on another harness that governance already allows. A pick that cannot start is refused with a typed code rather than run on Kiro, and selection keeps the single construction gate. Implementation: kirodotdev#18150. Refs kirodotdev#13892.
|
Done, and rebased onto main:
RFC #18486 records both answers. Refusing on continue and retry is Phase 2, which will be a follow-up PR after this one. |
Propose an optional backend on spawn_run so an orchestrator can run one sub-agent on another harness that governance already allows. A pick that cannot start is refused with a typed code rather than run on Kiro, and selection keeps the single construction gate. Implementation: kirodotdev#18150. Refs kirodotdev#13892.
iamwhatever
left a comment
There was a problem hiding this comment.
This adds spawn_run(backend=...), so an orchestrator can start a child on another allowed harness. The product question we held on is now settled. Maintainer bolichen97 approved the feature, limited to governance-allowed harnesses, and ruled that refusal on continue and retry ships as a separate follow-up (RFC #18486 Q2). Head 9010a26 does both things asked: the schema text and subagents.md promise refusal only at spawn time, and a backend_not_installed refusal shows install_command, with a test. I re-read the production diff and tried to get past the gate. The name is held to ^[a-z0-9][a-z0-9_-]*$, so it cannot inject into logs. An unknown name, or a known but governance-denied one, misses the selectable-only probe map and gets unknown_backend, listing only what can start. Missing and restart_required backends are refused, not degraded. The paths that skip /api/spawn (continuation from state.json, retry, admission pump, session rebuild) still pass members.select_provider_backend through resolve_selected_backend, so a tampered state.json can only pick a governance-allowed backend. Shared runtime and the warm pool are bypassed for an override, so a child cannot land on the parent's harness. The last Design Watch (follow-ups degrade silently) is the maintainer-ruled follow-up, not a defect here. Checks are green, it is mergeable on main, and there is no change request. — crew-pr-reviewer (deep re-check)
Propose an optional backend on spawn_run so an orchestrator can run one sub-agent on another harness that governance already allows. A pick that cannot start is refused with a typed code rather than run on Kiro, and selection keeps the single construction gate. Implementation: kirodotdev#18150. Refs kirodotdev#13892.
Propose an optional backend on spawn_run so an orchestrator can run one sub-agent on another harness that governance already allows. A pick that cannot start is refused with a typed code rather than run on Kiro, and selection keeps the single construction gate. Implementation: kirodotdev#18150. Refs kirodotdev#13892.
Problem / Motivation
Goal: an orchestrating agent can start each sub-agent on whichever installed backend (Kiro, Claude, Codex, ...) suits the task.
Today every sub-agent runs on the gateway's configured backend.
spawn_runcan pick a model and an effort, but not the harness, so an orchestrator cannot send a review to Claude and a refactor to Codex in one wave. The only workaround is to change the gateway default, which moves every chat with it.Why it matters
Different harnesses are good at different work. Without a per-spawn backend, multi-harness orchestration means a human switching the global default between waves. This is the core of the backend-selection plan in #13892.
Not a goal
spawn_sub_agents(the blocking variant) is unchanged; it does not takemodeleither.What changed (motivation → approach → change)
Goal → reuse the one backend-selection gate the provider factory already calls (
members.select_provider_backend), giving it a first tier for an explicit backend, and carry that value from the tool to the factory → the change:mcp_tools/spawn.py,validation.py):spawn_runtakesbackendbatch-wide, and atasks[]object can override it per task. Names are spelled the way governance rules spell them (kiro,claude,codex), so Kiro is nameable and a falsy value is never mistaken for a pick.messaging_api/spawn.py):/api/spawnmaps the name to the backend id. It refuses a backend this gateway cannot start, before the manager counts the spawn:selectable_backend_values()(governance): 400unknown_backend.backend_install.probe_backend, run off the event loop and cached; a probe that cannot decide does not block): 400backend_not_installedwith itsinstall_command.restart_required: the gateway still caches its absence, so a start would fail): 400backend_restart_required.subagent.py): the tool'seffort_dropped/effort_appliedline is judged on the requested backend. The model is translated into that backend's namespace, and a backend that advertises its own effort levels at session start (Pi) gets no verdict instead of a false "dropped". Aneffort_appliednote names the channel that delivers the level: kiro-cli'scli.jsonkey for the Kiro family, or the harness's live config option (e.g.reasoning_efforton Codex). The channel is decided by opt-in membership in the sets the provider gates on (ACP_BACKENDS_KIRO_SLASH_COMMANDS,ACP_BACKENDS_EFFORT_VIA_CONFIG_OPTION). A backend in neither (opencode, goose) never receives the level, so it is reported as dropped.subagent.py,admission/gate.py,admission/pump.py,subagent_persistence.py):SubagentInfo.backend(None= the default) rides the stagger queue and the run record (state.jsonbackend).subagent_manager/run.py): a backend rules out the shared runtime, which is the parent's process on the parent's backend. The value reaches the factory asbackend_override.config/loader.py,members.py,session_allocation.py):backend_overrideis a named factory kwarg, so it can never be swallowed by**_kwargs. It is the first tier of the selection gate (override → member-DM route → configured default), and it still passesresolve_selected_backend. The allocator skips the warm pool for it (bypass_backend_override), because a pooled child runs the default backend.session.py,session_allocation.py,session_lifecycle.py): the session records thebackend_overrideit started with, andallocation_identitycarries it. A reset respawn or a compaction restart of that session therefore comes back on the same harness instead of the default.continuation.py,run_control.py):spawn_continueinherits the run's backend from the live record orstate.json, because the conversation lives on that harness. A retry also runs on the original backend.src/kiro_crew/docs/subagents.mdanddocs/system-specs/modules/subagent.md.Backwards compatibility
Compatible:
backendis optional and absent by default. A spawn without it takes exactly the old path: no factory kwarg, same sharing and pool decisions, samestate.jsonkeys. Old queue rows and run records lack the key and read as "default".Removes nothing: the change only adds an optional argument, field and record key.
Tests
test/test_spawn_backend.py(52 tests):claudereachesspawn.kiroreaches it as"". An absent value reaches it asNone. A known-but-disallowed backend and an unknown one are refused withunknown_backendand the list. An allowed-but-missing backend is refused withbackend_not_installed, its install command, and a list that leaves it out. A backend installed after the gateway started is refused withbackend_restart_required. A probe that cannot decide does not block.spawnis not called on any refusal.backend_override(including""for Kiro) on a dedicated process. The shared runtime is never used, and sharing is ruled out by a backend.""is an override, not unset. No override changes nothing. An override that stopped being selectable degrades to Kiro.allocation_identitycarries the backend, including""for Kiro, and omits it for a session that never named one. Registration stamps it.cli.jsonfor the Kiro family, the live config option for an adapter harness. A backend that takes no effort (opencode, goose) is reported dropped, never applied. The model is resolved in the requested backend's namespace. The endpoint hands the backend to the verdict.state.json. A run predating the field continues on the default. The spawn writes the record. A retry keeps the backend.Mutation probes: removing each of the 19 load-bearing lines fails the suite. They are the factory kwarg, the sharing guard, the queue key, continuation inheritance, the endpoint membership check, the install filter, the restart-required filter, the session stamp, the successor identity, the selection tier, the record key, the retry key, the per-task override, the verdict's backend argument, the applied note's channel choice, the config-option membership check, the no-effort drop reason, the advertised-effort guard and the namespace translation.
Ran locally:
backendkeyword.Manual verification
Run end to end on an isolated gateway built from this branch, with Kiro as the gateway default. Full output is in the PR comment below.
/api/spawn {backend: "claude", keep: true}completed on Claude. The run record saysbackend: claude,provider: claude_code, and gives the session id.spawn_continueon that run loaded the same Claude session (claude-acp ... resume=<same session id>). It answered from the first run's context: it recalled the code word it was given.backend: "codex", which is allowed by policy but not installed on that host, was refused asbackend_not_installedwith its install command.backend: "nonesuch"was refused asunknown_backend. Both listedclaude,kasandkiro, the backends installed and allowed on that host.Related Issues
Part of #13892
Checklist
Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.