Skip to content

fix(apps): launch an app's own agent on kiro-cli from a Crew-written copy - #21867

Merged
bolichen97 merged 1 commit into
mainfrom
fix/app-agent-launch-copy-19323
Oct 21, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/app-agent-launch-copy-19323

Conversation

@bolichen97

@bolichen97 bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On the Kiro backend, a session a palette command opened for its app's own agent runs the app's registered spec, even if the checkout gains a same-named spec after the check.

kiro-cli takes the agent as a name and looks it up in the checkout first. An app's spec is registered as ~/.kiro/agents/<app>--<agent>.json but declares the bare name. The per-turn check refuses a checkout that claims that name today. But a spec written between that check and the spawn still wins, and the app-authored prompt then runs with that spec's tools and auto-approvals.

Why it matters

The palette sends an app-authored prompt, often with autoSend. If the wrong spec wins, that prompt runs with grants the app never had. The maintainer ruling on #19323 (option B) asks for the spec to be pinned on the path that picks the file. The per-turn guard stays until this is proven.

Not a goal

  • Retiring app_command_agent_refusal or the app_agent_refused row. The ruling keeps the guard until B has merged; that is a separate follow-up.
  • Worker slots, taskrunner, spec-builder, crons and the picker. They carry no app owner today.
  • KAS. Crew already reads the spec it sends there.

What changed (motivation → approach → change)

kiro-cli resolves a bare name project-first, so pinning the file needs a name only Crew writes. That is option B of the ruling.

On a Kiro turn bound to an app agent, apps/agent_launch.py reads the app's own <app>--<agent>.json by its path and checks it declares the agent. It writes a copy to ~/.kiro/agents/kirocrew-app-launch-<app tag>-<agent tag>.json with that name. The copy is the spec's native skill view, the one every Kiro launch runs: skill:// resources are dropped and the agent's skills come through skill_search. Past that only name and description change, so grants and trust are the app's own. The copy's name is wire-only, like KAS's kas_wire_agent_id: kiro-cli is asked for it on --agent and in session/set_mode, and the session's per-session control-plane elements are read from it. The session keeps the bare agent name as its identity, so governance, task profiles, audit, hooks and usage are unchanged. A live session started without the copy is retired first; after the claim, a Kiro provider that did not ask kiro-cli for exactly that copy is refused and reset.

kiro-cli takes project agents from its process folder, not the ACP session's, and runs tools, file:// resources and AGENTS.md in the session's (measured on kiro-cli 2.33.0). So kiro-cli runs the copy from an empty folder, <data home>/app-agent-launch/cwd, while the session still works in the checkout. No checkout .kiro/agents is ever read for the name, however late a writer acts, so the name needs no secret: both tags are plain hashes. On Linux the sandbox seals the folder read-only, and Crew's launcher enters it by name after its seals, then checks it is read-only and empty or stops: a process started inside it would keep the writable mount under the seal. On macOS and Windows it is as safe as ~/.kiro/agents itself. It is made before every spawn, write-fenced from the file tools, and checked empty at every spawn. kiro-cli reports a tool call's diff path against that folder, so the diff follows the spelling the tool was given, resolved in the session's folder; a call it cannot trace is left unanchored, which the edit gates refuse. Crew's own reads of the spec (control plane, ref guard) take the copy by its path, never by name. Pooled MCP stubs come from the registered spec's overlay entry <app>--<agent>. Agent-by-path in kiro-cli would retire the folder (follow-up #22783). Once the turn holds its session, the session is pinned to the app's registered file, so skill_search, dollar skills, the injected skill directory and Crew's injected agent prompt read that file by its path, and a checkout's same-named spec never sets them. The spawn holds the copy as its prepared view, a search agent exactly when the projection says so, and makes the same launch-steering decision every Kiro launch makes.

Piece Where
Copy, name, refusals (unregistered, foreign file or link at the path, second spec with the name, a launch folder that is a link or not empty); removed with the app's agents and when an update drops one apps/agent_launch.py, apps/manager.py, apps/bridges_agents.py _deregister_agents, apps/bridges_register.py _prune_stale_app_resources
kiro-cli started in the launch folder, sealed read-only, precreated and write-fenced, entered by the launcher after its seals; paths mapped back; Crew reads the copy by path acp/launch.py process_directory, acp/runtime.py _map_launch_cwd_paths _pool_lookup, sandbox_leaves.py _CREW_READONLY_LEAVES, sandbox_precreate.py, security/paths_lists.py _WRITE_PROTECTED_HOME_PATHS, sandbox_wrap.py, sandbox_spawn.py, sandbox_argv.py, sandbox_plan.py, sandbox_launcher_program.py exec_cwd enter_exec_cwd
Copy built as the native skill view (project_agent_view, shared with the projection); the spawn holds it as its view and runs the launch-steering decision acp/skill_projection_parts/preparation.py, acp/skill_projection.py, agent_sdk/drivers/acp.py native_skill_view, apps/agent_launch.py, acp/runtime_spawn_launch.py, acp/runtime.py _adopt_skill_projection
Skill scope and injected prompt pinned to the registered file, set once the turn holds the session skill_scope_pin.py, agent_discovery_parts/skill_scope.py session_skill_globs, context.py, context_assembly/session_start.py, context_assembly/turn.py, context_assembly/turn_message.py, context_assembly/agent_spec.py
Prefix: an app agent may not use it; hidden from list_agents and is_internal_agent_spec rosters agent_spec_format.py, apps/manager.py, agent_discovery.py, agent_discovery_parts/agent_roster.py, agent_discovery_parts/spec_fields.py
Wire-only copy name on --agent, set_mode and the control-plane read; reported modes map back to the bare name acp/runtime.py, acp/runtime_spawn_launch.py, acp/runtime_session_setup.py (stubs by the bare name), acp/runtime_session_create.py, acp/runtime_session_load.py, acp/runtime_session_setup.py, acp/session_handle_model_selection.py, acp/session_handle_class.py, acp/session_handle_dispatch.py
Allocation carries app_launch_agent, never from the warm pool (bypass_app_launch); only the Kiro runtime gets it; a reset or compaction restart is asked for the same copy session_allocation_parts/get_or_create.py, session_parts/policy.py, providers/acp.py, providers/acp_runtime_start.py, dashboard/chat_runner.py, session_lifecycle_parts/parked_queue.py allocation_identity
The turn publishes the copy and runs as it dashboard/chat_turn/turn_admission.py _check_owner, dashboard/chat_turn/app_agent_binding.py, dashboard/chat_turn/turn_locals.py

Docs updated in docs/system-specs/modules/app-kit-platform.md, command-bar.md, metrics.md and learn-cron-dashboard.md.

Backwards compatibility

Breaking: an app agent named with the kirocrew-app-launch-* prefix is refused. Writer sweep on origin/main @ 0e6b1f0: git grep kirocrew-app-launch and git grep app-agent-launch find no writer or reader; the prefix and the launch folder are new.

An app agent's own MCP servers that kiro-cli starts now begin in the empty launch folder, not the checkout; one that relies on a relative path or its starting folder no longer finds the checkout there. Tools, hooks, file:// resources and AGENTS.md still run in the checkout.

Removes nothing: the copies are new files; every agent listed today is still listed, and slot, saved chat and app_agent_owner keep the bare name.

Tests

  • test/test_app_agent_launch_copy.py: the copy is the registered spec under the reserved name; no rewrite when unchanged, refresh when changed; refusals for unregistered, wrong name, foreign file, link, and squatting spec; a checkout spec of the copy's name, by stem or by declared name, refuses neither the spawn nor the turn; rosters hide copies; deregister removes only that app's copies; a manifest update removes only the dropped agent's copy; two homes name the same agent the same way.
  • Identity: test_a_launch_copy_runtime_keeps_the_agent_name_governance_binds shows a task profile bound to the bare name still resolves for a launch-copy runtime, kiro-cli gets the copy's name and reported modes map back; test_the_session_control_plane_is_read_from_the_spec_kiro_cli_runs shows the control-plane elements come from the copy, not the bare view; the copy name passes is_registered_agent_name; only a Kiro provider hands it on.
  • Turn tests in the same file. test_a_project_spec_written_between_check_and_spawn_is_not_the_one_launched writes the same-named project spec after the check passes, then asserts the session keeps the bare name, kiro-cli is asked for the copy, and the copy holds the app's prompt and grants. Also: KAS keeps the bare name, an unwritable copy refuses before any session, a claimed Kiro session started as the bare name is refused and reset, an unbound Kiro turn is unchanged.
  • test/test_app_command_agent_guard.py: the Kiro cases now select Kiro, register the spec, and their provider reports the copy. The test for each working path (Kiro, KAS, refusals, fork, create) still passes.
  • test/test_agent_spec_hardened_reads.py: the three new hardened reads are labelled.
  • Launch folder, in TestTheLaunchDirectory: created empty and owner-only; a spec placed in it, or a link at its name, refuses the turn; it is read-only (not hidden), precreated, nofollow and write-fenced; the Linux plan seals it read-only in every mode and the Seatbelt profile denies writes but not reads.
  • Paths, in TestReportedPathsPointAtTheSession: a diff or locations path under the launch folder names the checkout; other paths and text are left; AcpRuntime._map_launch_cwd_paths maps by the frame's session. Process, in TestTheProcessStartsInTheLaunchDirectory: behind Crew's Linux launcher the process is created in its workspace and the plan carries exec_cwd; without it the process is created in the folder; the launcher enters only a read-only, empty folder and stops otherwise. In TestCrewJudgesTheCopyItWrote: the copy is read by path and must carry the owner marker; stubs come from <app>--<agent>; the ref snapshot is never read by name; the control plane refuses without the copy. Reverting the mapping, the launcher entry, its seal check, the control-plane read or the stub name each makes a test fail.
  • Skill view, in the same file: test_the_copy_is_a_skill_view_with_no_skill_resources (no skill://, kirocrew-core and skill_search present, prompt and grants kept); test_a_spec_that_forbids_skill_search_refuses_the_turn; test_skill_search_scopes_by_the_apps_registered_file runs a palette turn while the checkout gains a same-named spec with its own skill mapping, and both the skill_search/dollar scope and the injected directory take the app's mapping, while an unpinned session still resolves project-first; test_a_turn_that_is_not_the_launch_copy_unpins_its_session; test_a_turn_refused_before_the_claim_keeps_the_running_turns_pin; test_the_injected_agent_prompt_is_read_from_the_pinned_file; test_the_copy_is_a_search_agent_exactly_when_its_view_is; test_a_newer_projection_keeps_the_copy_the_spawn_held; TestTheCopyRunsTheLaunchSteeringDecision drives a real spawn as the copy and shows the inherit decision run on the copy's view in both directions. Disabling the pin or the adoption makes 3 of these fail. test/test_agent_spec_hardened_reads.py labels the two new spec reads.
  • Windows: test/windows-expected-failures.txt lists TestTheCopyRunsTheLaunchSteeringDecision as a strict xfail. It drives a real spawn through the shared test_acp_spawn_offload harness, which simulates only asyncio's subprocess, and Windows spawns through the cleanup-owned child (Windows original child pin/identity unavailable). The decision it pins is platform-independent and runs on Linux and macOS.
  • Budgets and pins: test/test_sandbox_protected_name_holds.py counts the new root-level directory (three entries per tier), test/test_security_gate_liveness.py the four fence lines, and test/test_sandbox_refactor_generated_programs.py the new launcher plan key.
  • Red on origin/main: with only the new module added, 9 of the 19 new tests fail; the window test fails with the session allocated as the bare kirocrew.
  • Determinism: test/test_app_agent_launch_copy.py 5 times in a row (51 passed each), and in reversed order with -n0 (51 passed).

Manual verification

A real kiro-cli 2.32.0 ACP session, started as kiro-cli acp --agent <copy name>. The copy was built by publish_app_agent_launch from a probe app spec. It sat in a throwaway checkout's .kiro/agents, beside a same-named bare deploy.json with a different prompt. It was not placed in the real ~/.kiro/agents; kiro-cli resolves both scopes by the same name lookup.

Check Result
session/new current mode the copy's name; the copy is in availableModes; set_mode to it ok
Turn 1, "code word?" PINEAPPLE (the app's prompt; the bare spec says ORANGE)
Turn 2, same session, read note.txt with fs_read (in the copy's allowedTools) MANGO, no permission request
Turn 3, same session, fs_write (not allowed) one permission request, Creating out.txt

Process folder vs session folder, kiro-cli 2.33.0, process started in an empty folder, session/new naming a fake checkout: only the process folder's .kiro/agents was listed; pwd printed the checkout; a relative read got the checkout's file; a relative write landed in the checkout; the write's diff preview named the process folder; relative file:// steering and AGENTS.md came from the checkout.

Not run: a palette command through a full gateway; the unit turn tests cover that path against the session port.

Related Issues

Part of #19323

Pattern harvest

Rule candidate: when a host resolves a name project-first, start it where no project spec can sit rather than racing a scan against its read.
Pattern: a check-then-use scan of a writable directory guarding a lookup in that same directory.

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

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners October 18, 2026 10:55
@bolichen97
bolichen97 requested a review from buluoray October 18, 2026 10:55
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision dbe32558b9ee4dac1adb4b609cc78e63bbc21d75 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

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

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of dbe32558b9ee4dac1adb4b609cc78e63bbc21d75 — 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 fix pins the spec where kiro-cli resolves the name, which is the mechanism #19323 option B asks for. The one open premise is a kiro-cli behaviour the author measured on a single version, so it is a note, not a block.

Notes

  • Item 3 — inherited: app-agent spawns now depend on three kiro-cli behaviours, each "measured on kiro-cli 2.33.0" only: agents are looked up from the process folder, tools run in the session folder, and diff paths are reported against the process folder. If any of these differs on another supported kiro-cli version, tools run in the empty read-only folder or edits are left unanchored and refused. The windows-expected-failures entry also skips the spawn test on Windows. Subtraction: none smaller. The premise has to hold until agent-by-path (kiro-cli: load an agent spec by file path, not cwd lookup #22783) lets the launch folder be deleted.

What this change ships

Inventory (8 items) — 7 justified

Intent: a palette-opened app agent on Kiro runs the app's own registered spec, never a same-named checkout spec written after the check. This is a FIX.

  1. Kiro is asked for a Crew-written copy named kirocrew-app-launch-*, not the bare agent name — justified
  2. The session keeps the bare name for governance, audit and usage — justified
  3. kiro-cli starts in an empty launch folder; the Linux sandbox seals it read-only — inherited (premise measured on one kiro-cli version)
  4. App MCP servers that kiro-cli starts now begin in the launch folder, not the checkout — justified
  5. An app agent may not use the kirocrew-app-launch- prefix — justified
  6. Launch copies are hidden from agent rosters and removed when the app is deregistered or drops the agent — justified
  7. Skill scope and the injected prompt read the registered file by its path — justified
  8. Tool diff paths are mapped back to the checkout, and a path that cannot be traced is refused — justified

[FIRST-PRINCIPLES-REVIEWED] dbe3255

Description read

[DESCRIPTION-READ] cc2e34e31f7982e58069f1e834b6ba9dc237e624a07688a670c27c4b161418df

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 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: it implements the maintainer's option-B ruling on #19323, the breaks are listed and accepted, and the new launch folder fails closed on Linux.

Notes

  • enter_exec_cwd exits the launcher fatally unless the launch folder is read-only and empty. Every Kiro turn bound to an app agent on sandboxed Linux therefore depends on app-agent-launch being sealed in every sandbox mode, and on kiro-cli not needing to write to its own working folder. The only evidence for the second is the description's "measured on kiro-cli 2.33.0". Add a version-bump check, or point to the test that pins it.
  • The description is cut off before its Tests section, so the manual-verification claim for the Linux launcher path was not checked.
  • The copy is a second spec, written to ~/.kiro/agents on every spawn. The agent-by-path follow-up (kiro-cli: load an agent spec by file path, not cwd lookup #22783) should retire both the copy and the folder, not only the folder.

[DESIGN-REVIEWED] dbe3255

Description read

[DESCRIPTION-READ] bf52455d8557b27bdb7f975dca724866cbc2d15f0711fd32f3e74dd400df4acc

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 added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 18, 2026
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of dbe32558b9ee4dac1adb4b609cc78e63bbc21d75 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] dbe3255

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

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] dbe3255

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

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

@bolichen97
bolichen97 enabled auto-merge (squash) October 18, 2026 11:05
@bolichen97
bolichen97 force-pushed the fix/app-agent-launch-copy-19323 branch from 5c98b03 to d853674 Compare October 18, 2026 11:46
@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=09411512b629
    [operator: bolichen97]

outcome: fixed
Fixed in d853674: a real kiro-cli 2.32.0 ACP session started as --agent <copy name> opened in the copy's mode, answered with the app's prompt over a same-named bare checkout spec, reused the session on turn 2 with fs_read unprompted, and asked on an ungranted fs_write; the table is under Manual verification in the description.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=e3118fa6c2f0
    [operator: bolichen97]

outcome: fixed
Fixed in d853674: a real kiro-cli 2.32.0 ACP session started as --agent <copy name> opened in the copy's mode, answered with the app's prompt over a same-named bare checkout spec, reused the session on turn 2 with fs_read unprompted, and asked on an ungranted fs_write; the table is under Manual verification in the description.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=8dce68163285
    [operator: bolichen97]

outcome: fixed
Fixed in d853674: a real kiro-cli 2.32.0 ACP session started as --agent <copy name> opened in the copy's mode, answered with the app's prompt over a same-named bare checkout spec, reused the session on turn 2 with fs_read unprompted, and asked on an ungranted fs_write; the table is under Manual verification in the description.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=ec158e0f20f0
    [operator: bolichen97]

outcome: fixed
Fixed in d853674: a real kiro-cli 2.32.0 ACP session started as --agent <copy name> opened in the copy's mode, answered with the app's prompt over a same-named bare checkout spec, reused the session on turn 2 with fs_read unprompted, and asked on an ungranted fs_write; the table is under Manual verification in the description.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=23971630f50e
    [operator: bolichen97]

outcome: rebutted
Accepted in the description: the copy gets no skill view, so an app agent on Kiro loads its skill:// resources natively; stated under What changed and Not a goal.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=e89b43d9c9a3
    [operator: bolichen97]

outcome: rebutted
Accepted in the description: the copy gets no skill view; stated under What changed and Not a goal, which is the clearing condition this item names.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=48acfb0bfadd
    [operator: bolichen97]

outcome: fixed
Fixed in d853674: the tag is now an HMAC of <app>/<agent> under an owner-only per-home secret (apps/agent_launch.py _host_key), so the name is not derivable from public names; the remaining scan-to-read window is named in the description.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=6a1cbc01255b
    [operator: bolichen97]

outcome: fixed
Fixed in d853674: the tag includes a value only this home knows (the launch key), and the description names the window that remains.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=b3e54efb15b7
    [operator: bolichen97]

outcome: fixed
Fixed in d853674: PublishedLaunch, its digest and _digest are deleted; publish_app_agent_launch returns the name.

@bolichen97

bolichen97 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=db37e66c9e96
    [operator: bolichen97]

outcome: fixed
Partly fixed in d853674: the launch name is now keyed by an owner-only per-home secret, so a checkout can no longer be prepared to claim it from public names. The residual (a same-UID writer that lists ~/.kiro/agents and writes the checkout between the spawn scan and kiro-cli's read) is the window every reserved name already has, and on main the bare name is open to it; this disposition does not claim it closed, and no override is posted.

@bolichen97
bolichen97 force-pushed the fix/app-agent-launch-copy-19323 branch from d853674 to 0f1b404 Compare October 18, 2026 12:14
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 18, 2026
@bolichen97
bolichen97 force-pushed the fix/app-agent-launch-copy-19323 branch from 0f1b404 to 80ab4b0 Compare October 18, 2026 13:36
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 18, 2026
@bolichen97

bolichen97 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/dashboard/chat_runner.py and nearby files since this head went green (6fd7c1f -> bdb1c87); CI re-running. The PR's own changes are identical to 6d85e69.

@chenmingwei23 the Sensitive Change Review needs a sign-off from a maintainer who is not bolichen97, on this head. Fill the template below and paste it into an "Approve" review on 7761091:

## Sensitive change review
- Head commit: 77610910eb59268734e4de5296e45bfd51951062
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

[operator: bolichen97]

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=ec93e016a08b
    [operator: bolichen97]

outcome: maintainer ruling 2026-10-19: keep the keyed copy name and hide the key from the sandbox
The key lives in the masked, precreated, file-tool-fenced <data home>/app-agent-launch/ directory (test_a_sandboxed_process_cannot_read_the_key); the keyed name and the reserved-prefix checks stay as ruled. This head is a mechanical rebase; the files this item names are unchanged from the head the ruling covered.
Dropping the key is the open maintainer question already recorded on span 5b71979d2664; not changed here.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=8f911873cb67
    [operator: bolichen97]

outcome: maintainer ruling 2026-10-19: keep the keyed copy name and hide the key from the sandbox
The key lives in the masked, precreated, file-tool-fenced <data home>/app-agent-launch/ directory (test_a_sandboxed_process_cannot_read_the_key); the keyed name and the reserved-prefix checks stay as ruled. This head is a mechanical rebase; the files this item names are unchanged from the head the ruling covered.
Dropping the key is the open maintainer question already recorded on span 5b71979d2664; not changed here.

@bolichen97

bolichen97 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=8b864b5b6fef
    [operator: bolichen97]

outcome: needs-a-decision
Question for the maintainer: when may app_command_agent_refusal be retired? Both checks are the 2026-10-19 ruling as shipped: app_command_agent_refusal refuses an app agent the gateway cannot launch from a copy, and reserved_agent_name_refusal refuses a checkout that claims the copy's name. Removing the first is a product call on the ruling, so it is not done here and no issue is filed for it.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main 4bafd4e2 to clear a merge conflict in src/kiro_crew/context_assembly/session_start.py: main moved the _skills_injection_plan call to the section top, so this PR's session_key=session_key argument now sits on that call. No other change; the PR's own changes match 7761091.

@chenmingwei23 the Sensitive Change Review needs a sign-off from a maintainer who is not bolichen97, on this head. Fill the template below and paste it into an "Approve" review on c362632:

## Sensitive change review
- Head commit: c36263254be34bddda86b884eda3b2fa9d644172
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

[operator: bolichen97]

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=de50bf6386ab
    [operator: bolichen97]

outcome: needs-a-decision
Security-class, not overridden. This is the scan-to-read window apps/agent_launch.py documents: a writer that lists ~/.kiro/agents and writes .kiro/agents/<launch-name>.json into the checkout after the spawn scan wins, because kiro-cli resolves --agent project-first.
This head is a mechanical rebase; runtime_spawn_launch.py and agent_launch.py are unchanged from the earlier heads. Closing the window needs a launch-name lookup kiro-cli cannot take from the checkout, which is a design change beyond the 2026-10-19 ruling.
Question for the maintainer: ship with the documented window, or redesign the lookup first?

@bolichen97

Copy link
Copy Markdown
Contributor Author

Redesign per the maintainer ruling on GPT's launch-name finding: kiro-cli now runs the app's launch copy from an empty Crew-owned folder, so no checkout .kiro/agents is read for the name. The per-home key is gone. Follow-up for agent-by-path in kiro-cli: #22783

Sensitive files on this head: sandbox_leaves.py (app-agent-launch moves from hidden to read-only), sandbox_precreate.py (precreated read-only, nofollow), security/paths_lists.py (write-fenced instead of secret), sandbox_plan.py / sandbox_argv.py / sandbox_wrap.py / sandbox_spawn.py (new plan field exec_cwd) and sandbox_launcher_program.py (enter_exec_cwd: after the seals, enter the folder by name, stop unless it is read-only and empty).

@chenmingwei23 the Sensitive Change Review needs a sign-off from a maintainer who is not bolichen97, on this head. Fill the template below and paste it into an "Approve" review on fce1a9c:

## Sensitive change review
- Head commit: fce1a9cac27ca0dbf5dc4f2952ce380614b82826
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

[operator: bolichen97]

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=de50bf6386ab
    [operator: bolichen97]

outcome: fixed in fce1a9c (maintainer ruling: redesign, option A)
kiro-cli takes project agents from its process folder, not the ACP session's (measured, kiro-cli 2.33.0). A launch copy's kiro-cli now starts in <data home>/app-agent-launch/cwd while the session cwd stays the checkout, so a checkout .kiro/agents/<launch-name>.json is never read, however late it is written.
On Linux the folder is sealed read-only and Crew's launcher enters it by name after its seals and stops unless it is read-only and empty (enter_exec_cwd); Crew's own spec reads take the copy by its path (read_launch_copy). Interim until kiro-cli agent-by-path: #22783.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=2ff5284f0397
    [operator: bolichen97]

outcome: fixed in fce1a9c
Pooled stubs for a launch copy are looked up under the registered spec's overlay name <app>--<agent> (recorded at publish, AcpRuntime._pool_lookup), at user level; an unpublished copy gets no stubs rather than a bare-name match. Pinned by test_pooled_stubs_come_from_the_registered_file.

@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97]

outcome: fixed in fce1a9c -- one answer for every "drop the HMAC key?" item (Design and First Principles, spans 4bc6a22a35fc, af255b0b10d0, 83241edc457e, 5ae410156bf2, e4d577533be1, 3a1ede8a797a, 41bc174ec258, 5b71979d2664)
The maintainer chose to close the window instead of guarding the name: kiro-cli no longer reads any checkout spec for the launch name (it starts in an empty sealed folder), so the key no longer protects anything and is removed with its hidden leaf, precreate entry, secret fence and key tests. The name is a plain hash.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=5b71979d2664
    [operator: bolichen97]

outcome: fixed in fce1a9c
The keyed HMAC name and its hidden leaf, precreate entry and file-tool secret fence are removed. The launch window is closed at its root instead: kiro-cli for a launch copy starts in an empty, sealed folder, so no checkout spec is read for the name.

@bolichen97

Copy link
Copy Markdown
Contributor Author

New head for two review fixes (no sensitive-file change since fce1a9c). Redesign per the maintainer ruling on GPT's launch-name finding: kiro-cli now runs the app's launch copy from an empty Crew-owned folder, so no checkout .kiro/agents is read for the name. The per-home key is gone. Follow-up for agent-by-path in kiro-cli: #22783

Sensitive files on this head: sandbox_leaves.py (app-agent-launch moves from hidden to read-only), sandbox_precreate.py (precreated read-only, nofollow), security/paths_lists.py (write-fenced instead of secret), sandbox_plan.py / sandbox_argv.py / sandbox_wrap.py / sandbox_spawn.py (new plan field exec_cwd) and sandbox_launcher_program.py (enter_exec_cwd: after the seals, enter the folder by name, stop unless it is read-only and empty).

@chenmingwei23 the Sensitive Change Review needs a sign-off from a maintainer who is not bolichen97, on this head. Fill the template below and paste it into an "Approve" review on 3a346fb:

## Sensitive change review
- Head commit: 3a346fbc5968a56bbeb9d7c0cf6cb1c389604441
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

[operator: bolichen97]

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=de50bf6386ab
    [operator: bolichen97]

outcome: fixed in 3a346fb
A launch copy's skill-search verdict now comes from apps.agent_launch.is_search_launch_copy whether or not a projection runs, so _unpooled_control_planes refuses a search copy whose mount has no kirocrew-core element even with the projection disabled or at its ceiling. Pinned by test_a_search_copy_without_its_core_element_refuses_without_a_projection.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=251dfe59cd30
    [operator: bolichen97]

outcome: fixed in 3a346fb
The launch folder's two spellings are resolved once at spawn, off the loop (launch_cwd_roots via asyncio.to_thread), and kept as AcpRuntime._launch_cwd_roots; the per-frame map_process_cwd_paths does string work only. Pinned by test_the_per_frame_mapping_touches_no_filesystem.

@bolichen97

Copy link
Copy Markdown
Contributor Author

New head: the tool-call path mapping now follows the spelling the tool was given and refuses what it cannot trace; the checkout reservation of the launch prefix is removed; rebased onto main, whose split of acp/runtime.py moved this PR's runtime changes into runtime_class.py, runtime_wire.py, runtime_reader_loop.py, runtime_mode_activation.py and runtime_session_registry.py unchanged. Sensitive files are as on 3a346fb.

Sensitive files on this head: sandbox_leaves.py (app-agent-launch moves from hidden to read-only), sandbox_precreate.py (precreated read-only, nofollow), security/paths_lists.py (write-fenced instead of secret), sandbox_plan.py / sandbox_argv.py / sandbox_wrap.py / sandbox_spawn.py (new plan field exec_cwd) and sandbox_launcher_program.py (enter_exec_cwd: after the seals, enter the folder by name, stop unless it is read-only and empty).

@chenmingwei23 the Sensitive Change Review needs a sign-off from a maintainer who is not bolichen97, on this head. Fill the template below and paste it into an "Approve" review on 3d52349:

## Sensitive change review
- Head commit: 3d52349e7d5ba5fbb9b8a1e0c0b21b11bc0b892f
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

[operator: bolichen97]

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=251dfe59cd30
    [operator: bolichen97]

outcome: fixed in 3d52349
kiro-cli reports a diff path normalised against its process folder, so map_process_cwd_paths now takes the spelling the tool was given (locations, $VAR and ~ expanded, relative joined to the session cwd) for the diff. Several spellings, several diff blocks, or no spelling outside the launch folder leave the diff relative, which the edit gates treat as unanchored and refuse.
Pinned by test_a_parent_relative_write_is_judged_at_the_file_it_writes, test_a_launch_root_reentry_is_judged_where_it_lands, test_without_locations_a_climb_out_is_left_unanchored, test_several_diff_blocks_are_all_left_unanchored.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=f1ad846eaf8a
    [operator: bolichen97]

outcome: fixed in 3d52349 (subtracted as asked)
The checkout reservation of kirocrew-app-launch-* is removed from acp/managed_agent_shadow._is_reserved, agent_sdk.reserved_agent_name_refusal is deleted, and _check_owner no longer re-checks the copy's name per turn. The roster hiding and the app-name refusal stay. Pinned by test_a_checkout_spec_of_a_launch_name_does_not_refuse_the_kiro_spawn and test_a_checkout_spec_of_a_launch_name_does_not_refuse_the_turn.

@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97]

outcome: answered
The breaking reader stays as listed: an app agent's own MCP servers that kiro-cli starts begin in the empty launch folder (measured on kiro-cli 2.33.0; hooks, tools, file:// resources and AGENTS.md still run in the checkout). Agent-by-path in kiro-cli (#22783) removes the folder and this cost.

@bolichen97

Copy link
Copy Markdown
Contributor Author

New head for one review fix (a metadata lock the event loop can take without waiting on file I/O) and two test skips; rebased onto main. No sensitive-file change since 3d52349.

Sensitive files on this head: sandbox_leaves.py (app-agent-launch moves from hidden to read-only), sandbox_precreate.py (precreated read-only, nofollow), security/paths_lists.py (write-fenced instead of secret), sandbox_plan.py / sandbox_argv.py / sandbox_wrap.py / sandbox_spawn.py (new plan field exec_cwd) and sandbox_launcher_program.py (enter_exec_cwd: after the seals, enter the folder by name, stop unless it is read-only and empty).

@chenmingwei23 the Sensitive Change Review needs a sign-off from a maintainer who is not bolichen97, on this head. Fill the template below and paste it into an "Approve" review on dbe3255:

## Sensitive change review
- Head commit: dbe32558b9ee4dac1adb4b609cc78e63bbc21d75
- What rule changed:
- Before -> after (what was allowed/blocked, now):
- Worst case if wrong (breaks commands / leaks secret / locks user out):
- Evidence checked (which sandbox result proves it):
- No regression:
  - Tools still work (which tools/commands were run, result):
  - Backward compatible (old config / old data / old callers still work, how checked):
  - Existing tests (which suites passed on this head):
- How to undo:

[operator: bolichen97]

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • span=38922d380552
    [operator: bolichen97]

outcome: fixed in dbe3255
_SEARCH_COPIES and _LAUNCH_SOURCES are now guarded by their own _LAUNCH_META_LOCK, never held across file I/O; publish_app_agent_launch updates them under it after its file work. is_search_launch_copy and launch_source_stem take only that lock, so the event loop never waits on a publication. Pinned by test_the_event_loop_lookups_never_wait_on_a_publication.

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.

4 participants