Repository navigation
fix: 0.13 backport batch 1, part 2 of 3 (KAS and user-reported fixes) - #37355
Conversation
* test(apps): red tests for overwriting a marketplace record update_app from a local folder, and register_external_app over the same name, rewrite a market:<ref>@<n> record's source and sourceCommit, dropping the app's listing provenance and its trust coordinate. Ticket: CREW-27311 * fix(apps): refuse a folder update over a marketplace app update_app and register_external_app now refuse a record whose source is market: with app_update_market_source before anything is replaced, so the installed tree, the market: source and the zip sha256 stay as they were. A marketplace update path (resolve, verify, re-confirm) comes later. Ticket: CREW-27311 (cherry picked from commit d9a5c59)
#36541) On KAS, a spec whose shell allowedCommands sit under denyByDefault beside a deniedCommands list asked before every matched command, where kiro-cli runs it unasked (#30017). Three readers kept the grant at the prompt: - the deny lift read denyByDefault as a restriction on a matched command; it now asks kas_agents._allowed_commands_withheld, the reader the plain allowedCommands answer uses, so denyByDefault only refuses an unmatched command; - parse_deny refused any entry holding "|"; it now refuses only alternation, so a literal "|" in a class or escaped is checked; - the Rust-syntax reader refused the control escapes \n \t \r \f \v \a; it now reads them as Rust does. Every refusal row still runs first. (cherry picked from commit 9a5c716)
) An adopted former built-in registers its seam providers from on_startup under the builtin's id, replacing the providers the wheel copy's seams.py registered. Those providers import the copy's own modules at call time, so after a disable, update or uninstall unloads them every call raises ModuleNotFoundError: the consent cards fall back to the default chain, the project pill reports an expired SSO sign-in as unavailable, and the MicroVM staging and crew digest fail, until the gateway restarts. The built-in answered whether or not it was enabled. unload_app_modules now calls seams.release_app, which restores the provider the builtin's seams module registered during the one-time load. Part of #26967 (cherry picked from commit fe1abf3)
…6952) When the pinned Claude model is restricted, session/new answers with a substitution advisory and no session. Crew adopts the substitute and retries, but the re-seeded settings.local.json writes `model` only on a warm advertised-model cache. That cache fills only after a session/new succeeds, so an install restricted from its first session retried with the user's own settings still naming the restricted model, and every session failed. The retry now records the model it adopted, and the payload writes that model even on a cold cache. The first attempt and every other cold-cache seed are unchanged. Closes #36938 (cherry picked from commit 2f4e88a)
A chat starts a new backend session on every reconnect, reload and gateway restart, and _prepare_spec_hooks added its spec notices again on each one: keys nothing carries, confirm: true hooks, too-long hook commands, withheld project spec hooks, and the notices for hooks, steering or toolsSettings nothing runs. Nothing about the spec had changed, so the same rows piled up in the chat. The chat now keeps a short list of marks, one per notice it showed, keyed on the notice text and, for a folder-bound notice, its folder. A notice shows again only when its mark is new. The list holds the newest 32 and is saved on the chat's metadata line, so a restart keeps it. No new setting. Closes #36824 (cherry picked from commit c0a9585)
On a chat that runs on KAS and follows the global auto-compact setting, the context popover read "Following global (70%)" and showed 70% as the threshold. KAS leaves compaction to its own summarization at the global threshold (#33224), so that line told the user something that does not happen. In that case the threshold now reads "Set by KAS" and the existing note that KAS compacts on its own, and that a threshold set here compacts sooner, takes the place of the "Following global" line. A KAS chat with its own or its agent's threshold, and every other backend, look as before. Closes #36995 (cherry picked from commit 114fa6c)
POST /api/app-store/refresh and POST /api/apps/registries/refresh were the only registry writes that skipped the owner check, so a non-owner dashboard subject could bust the registry caches and make the gateway re-fetch every configured registry. Both now refuse a non-owner with the same owner_only 403 as the install, update and registry-config routes. An app token keeps the store refresh, since it reaches it only through an explicit permissions.api grant. (cherry picked from commit c4eb21d)
On KAS an agent that does not opt in to mcp.json loads only the servers it declares: Kiro Crew names every mcp.json server and tells KAS to leave the undeclared ones out. Kiro Crew's global path is ~/.kiro/settings/mcp.json and does not follow KIRO_HOME, while KAS reads its global file under KIRO_HOME. With KIRO_HOME set to another folder, as in every Dev Fleet pod, the servers of that file were never named, so a folder agent got them. The settings stamp now also names the servers of $KIRO_HOME/settings/mcp.json when that is another file. It is read only to add exclusions and to carry disabledTools. A file that cannot be read adds one notice line and the session still starts. With KIRO_HOME unset nothing changes. Closes #36144 (cherry picked from commit 19f781c)
#36922) With sharing off no stub runs, so the MCP page's footprint had no stub to price "with sharing" by and left that figure out. The gateway now reads one: once per gateway run it starts a single idle stub through the sandbox, with the same --read-limit the rewriter gives real stubs, has it register on a private unix socket, round-trips one initialize, reads the stub's PSS, stops it and keeps the reading. The socket sits in a fresh 0700 directory under the gateway's own runtime dir, is made 0600, is unix only, and is removed with its directory on every way out, a timeout included. The probe serves no backend, so no server starts. A probe that cannot run or read is no reading, kept as such, and the page shows the "now" figure alone. The reading prices a freshly attached idle stub, a floor: stubs that have run for hours grow past it. A test pins the probe within 15% of a stub attached to a real gatewayd on the same interpreter. Part of #36884 (cherry picked from commit b8d6f33)
) Under `sudo kirocrew service install`, sudo replaces PATH with its secure_path, so the unit's PATH named no nvm dir and fell back to /usr/bin/node. MCP servers that need a newer Node then failed to start after a reinstall, and the unit also carried root's own PATH entries although it runs as SUDO_USER. service_path() now drops entries under root's home when the unit runs as another account, and when the installer's PATH has no nvm dir it reads the SUDO_USER account's nvm install from that account's home: ~/.nvm, then ~/.config/nvm, the version alias/default names, else the newest installed. Only files are read; nothing in that home runs. Closes #36908 (cherry picked from commit 036bc92)
…RD (#36957) On an install that hard-links package files, the agent-spec reader refuses every file with more than one link, so owning_app_for_agent and the command-agent containment check read nothing for any built-in app: its agents counted as custom agents and lost their app's name. The agent-spec reader now takes an opt-in admission callback, the same contract the skill reader already uses for built-in SKILL.md files. The two built-in app lookups pass it only for a shipped built-in's package root, and it admits a hard-linked .json file only when the installed distribution's RECORD lists that path under kiro_crew/apps/builtins/ and the bytes read match its sha256 digest. Every other hard-linked spec stays refused. Closes #36939 (cherry picked from commit c28afea)
#13040) * fix(electron): gate app-menu IPC per-action for remote gateway senders The Electron app-menu IPC channel (`app-menu:items` / `app-menu:execute`) was gated per-channel via `assertLocalDashboard`, letting through anything a local dashboard could issue. A remote gateway page loaded in a connection window shares the same preload, so it could invoke privileged menu roles (paste reads the OS clipboard, quit terminates the app, close/minimize/zoom mutate OS window state, togglefullscreen covers the desktop) plus custom-click items (DevTools opens on the local dashboard, Settings/About windows). Classify menu items into four sets — LOCAL_ONLY_ROLES, LOCAL_ONLY_MENU_IDS, LOCAL_ONLY_ITEM_IDS, REMOTE_SAFE_ITEM_IDS — and enforce them at `executeMenuItem` when the sender is not local. Thread `senderIsLocal` down from the IPC boundary through `menuItems` and `executeMenu` so `app-menu:items` also advertises LOCAL_ONLY rows as `enabled: false` for a remote sender — a rendered row must not silently no-op on click. Resolve the verdict once per WebContents via a WeakMap cache invalidated on `did-navigate` to keep the per-click cost sub-ms. Add a template-walk drift pin that walks `buildMenuTemplate` output for both isMac branches, filters by `WINDOWS_TITLEBAR_MENU_IDS` reachability, and asserts every reachable leaf is classified in exactly one set. This catches an unclassified item added to `app-menu.js` that a set-membership pin alone would miss. Windows-only enforcement is deliberate: the `app-menu:*` IPC is the only renderer-invocable menu path (Linux/macOS use the native OS menu with no renderer API, and custom click handlers resolve to `focusedDashboardWebContents()` which finds the dashboard view, not remote content). The classification sets are the global policy; the enforcement point is single because the attack surface is single. A gated row carries no per-row decoration and the payload carries no accelerator-registration field. Greying states the row is inert from this window, and the footer adds the one thing greying cannot say: the shortcuts still shown do fire, because Electron's native accelerator dispatch and Chromium's own clipboard handling both bypass this IPC. That sentence is kept true by subtraction rather than annotation. `serializeMenuItems` blanks the caption of a gated row whose chord cannot reach its command, which is File > Settings… alone — `registerAccelerator: false` displays Alt+, without binding it, and the in-page handler that does route it only receives the keystroke while the dashboard page holds focus. So the wire carries an existing field with a narrower value rather than a new flag no consumer reads. One renderer test pins the absence of any per-row marker, one wire test pins the suppression, and one pins the absence of the field. Paint the menu without waiting on the port probe. A lapsed positive verdict paints `app-menu:items` at once and re-probes in the background; `app-menu:execute` still refuses unless a fresh probe proves a local owner, so the click stays the real gate. A probe that cannot name the primary-port holder (unknown, or none while our gateway restarts) keeps the rows painted enabled for a restart-sized grace instead of greying the local window's own menu, but never authorizes an action. Past the grace the rows grey with the footer. A proven foreign holder revokes the positive, and a first call still fails closed. `classifyPortOwner` gains `unidentified` for a holder that demonstrably exists but whose command line could not be read. `unknown` means the probe never ran, so nothing is known to hold the port and the adopt path may fail open; here a holder exists and only its identity is missing, so the adopt path refuses it exactly as it refuses `foreign`, while the app-menu gate reads it as inconclusive rather than as a proven foreign holder. That is what stops a transient probe failure from revoking the local user's own menu rows. Off macOS the Window menu's Zoom is a custom click calling `applyWindowControl(win, "maximize-toggle")` rather than Electron's macOS-only `zoom` role, so it carries no role for `LOCAL_ONLY_ROLES` to catch and would have inherited remote-safe on execute. It is fenced by id as `window-zoom`, and the template-walk pin is what found it. Co-authored-by: Bolin Chen <bolichen@amazon.com> Co-authored-by: Joe Guo <12429733+iamwhatever@users.noreply.github.com> * fix(electron): keep a hostile menu id inside the rejection-log budget A page could pass an app-menu id whose own toString throws. Building the focus-moved refusal line called it, so the throw skipped the per-sender budget and every queued invoke wrote its own dispatch-failed line. Render renderer-supplied ids by type instead of coercing them, and send the dispatch-error line through the same budget. * fix(electron): refuse a menu dispatch when focus moved inside the window The focus-moved check compared windows, so a modal opened inside the same window moved the focused WebContents unnoticed and a Reload then hit the modal. Compare the focused WebContents too. The refusal notice covers the whole shell, so its ask-the-agent hand-off could unmount a page holding unsaved drafts. Turn it off, as errors-use-error-notice requires. --------- Co-authored-by: Bolin Chen <bolichen@amazon.com> Co-authored-by: Joe Guo <12429733+iamwhatever@users.noreply.github.com> (cherry picked from commit 3dcc030)
…36610) An app's l10n block was read only under the reader's exact locale and its base language, with a case-sensitive key match. The manifest accepts "zh-cn" and regional tags like "pt-BR", but the dashboard's reader locale is "zh-CN" or "pt", so those translations installed cleanly and were never shown. Match keys without case, an exact key winning over a case variant, and when there is no exact or base-language entry, use a regional entry for the same language before falling back to English. A regional entry that can switch the script (a Chinese region, a script subtag) is never borrowed. The manifest reference and the app-kit spec describe the new order. Fixes #36609 (cherry picked from commit 1752cb6)
kiro-cli's v3 engine takes plain redirects off a command before it matches allowedCommands, so "make build > build.log 2>&1" runs without a prompt under the entry "make build". Kiro Crew refused every command holding < or >, so on KAS such a build always asked. The gate now takes the same redirects off first (split_redirects) and matches what is left. Before it grants, each file a redirect opens must pass Crew's own floors: a write target is not sensitive or write-protected, a < source is not sensitive. A relative target with no session directory, or inside a chain, keeps the prompt. $() and backticks still ask, and so does a redirect before the program. Closes #36798 (cherry picked from commit 9f1ff8e)
Kiro Crew's own requests to the sign-in service ignored HTTPS_PROXY, HTTP_PROXY and NO_PROXY, so on a proxy-only network a renewal failed and the chat said 'Not signed in to Kiro'. Every sign-in and refresh request now passes resolve_proxy(url), with trust_env still off (no netrc), and the temporary renewal session is bounded to 30 s. An engine line that names the proxy, its tunnel or CONNECT and carries a refusal is now a connection error with a proxy message, not a sign-in failure. A bare 403 keeps its signed-out verdict. Closes #36954 (cherry picked from commit c8f45fb)
…#37052) The managed update lane reads the gateway's armed record every 30s (GATEWAY_ARM_POLL_MS), and createGatewayArm's request() ran the full credential chain on every call. Each run is a fresh mint: a local-secret link token, or `ssh <host> kirocrew token` for a remote crew. Every mint takes one of the gateway's 50 link-nonce slots and does a link-to-session exchange, so the poll alone produced about 120 mints an hour. In 0.12.2 this poll had no own-gateway guard, which is what drove one ssh mint every 30s from a Mac app tunnelled to a dev desktop. Main now skips the poll for a gateway the app does not own (#35775), but a local gateway still minted on every poll. request() now keeps the credential it resolved and reuses it until the gateway answers 401/403, then re-resolves once and retries; a second refusal is returned as is, so it cannot loop. An empty answer is not cached, and a borrowed cookie that cannot be turned into a header drops the cache. Crew-companion, mochi and the app-window host already reuse their credential this way. (cherry picked from commit 9449ada)
…ard (#37062) The desktop app fetches a remote crew's dashboard token with a plain `ssh -n -o BatchMode=yes -o ConnectTimeout=N <host> kirocrew token`. That ssh reads the user's ssh_config, so a `LocalForward 5476 ...` set for the dev desktop's host is applied to it too. When nothing else holds the port, the token ssh binds it, the dashboard's sockets start riding it, and ssh keeps running after `kirocrew token` exits because it waits for those forwarded connections to close. The execFile timeout (20s by default) then kills it: the token it printed is thrown away and every connection on the port drops. The next fetch binds the port again. A field log shows this exactly: every 30s a fetch starts, the port answers while that ssh lives, and it stops answering the moment the ssh is killed 20.009s later. Pass `-o ClearAllForwardings=yes`, which tells ssh to ignore the forwards in its config files, in both one-shot builders: the desktop token fetch (website/electron/remote-token.js) and the gateway's token_mint._build_ssh_argv, which the remote token mint, restart_remote and the diagnostics probes share. None of them wants a forward. The supervised tunnel (`ssh -N -L`) is unchanged: ClearAllForwardings would also clear its own -L. The instances spec now says why the one-shots pin it. (cherry picked from commit 2e6bffd)
At every gateway start the core reconciled app crons by creating any manifest job missing from the store, and nothing recorded that a person had deleted one. A deleted job of an enabled app therefore came back on the next start and ran again. A person's delete of a manifest-stamped app job now records the job's name under member-records/app-crons-deleted/<app>.json, and the start-time registration skips a recorded name that is absent from the store. Disabling the app or finishing an uninstall clears the record, so the next enable brings the jobs back. Removals the app itself requests, one-shot self-removals and whole-app removals are not recorded. Closes #36974 (cherry picked from commit 874b8e7)
A custom agent (an agent file Kiro Crew did not write) gets Kiro Crew's kirocrew-core and kirocrew-cron servers at spawn. It grants no tool_search loader, so the KAS handshake listed every one of their 90 tools on toolSearch.neverDefer and each request carried them in full. On a host that reads the settings channel (KAS), the handshake now leaves the servers Crew itself added (crew_added_servers: the managed entry, byte for byte) behind KAS's loader, as on the default agent. Their whole-server grant and their share of "*" are not expanded; a tool of theirs the author names one by one stays direct, and so does mcp_server_wait (CUSTOM_AGENT_JOB_TOOLS). Every other tool the spec grants is unchanged, and other backends send exactly what they did. Specs and docs: providers.md, agent-host-contract.md, mcp.md (the job-tool table) and agent-spec-fields.md. Part of #37080 (cherry picked from commit 8892812)
Sensitive Change ReviewSensitive files changed:
How to clear this check:
Only the author's comment counts this way. A reviewer can instead |
UX Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)UX-level review of UX-Verdict: PASS cannot evaluate: missing screenshots of the Windows titlebar menu's new refused and greyed states and the changed auto-compact readout. The PR has no images, so the blind read was not performed. Evidence gaps
Notes
[UX-REVIEWED] 30ccc01 Description read[DESCRIPTION-READ] 6f517b81b02ab30911614a6f9124fb05828a9b7272d9a3581332282fec241b5d That sha256 names everything this verdict read: the PR description, plus the 3 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 |
Design Review (Opus 5.5) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)Design-level review of Design-Verdict: PASS cannot evaluate: missing screenshot of the Windows title-bar menu's new refusal notice and gated-row footer. #13040 adds both. By the description's own account it never had a Design or UX run, and this PR attaches no rendered evidence. BlockersThe Windows title-bar menu gains UI that has never been rendered for review Notes
[DESIGN-REVIEWED] 30ccc01 Description read[DESCRIPTION-READ] 424ef63cc1ed3c65501b65d3eee1f04b1823992ed733d54ad38df19dcd5ee129 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Every item is a fix that was already reviewed and merged on main. The one reversed pin (#36541's denyByDefault tests) is declared in the description and backed by a test reproducing the reported spec. What this change shipsInventory (10 items) — 10 justifiedIntent: ship the KAS fixes and the user-reported fixes merged on main since the cut in 0.13. This is a FIX (backport).
[FIRST-PRINCIPLES-REVIEWED] 30ccc01 Description read[DESCRIPTION-READ] 40eaf7a3e99842354f489bdbdfdf36532aa7edcf1960d53442a0ff75b88a9a46 That sha256 names the PR description this verdict read. Recompute it with |
Security Scope Review -- ✅ PASSWhich legitimate operations does Verdict basis: adjudicated, zero confirmed regressions. Security scope review -- adjudicated candidates
No candidate flipped from allowed to refused. Scope-Verdict: PASS Reason: The only shell-side tightening is a new redirect floor on the TIGHTENING: ADJUDICATED: 16 candidates, 0 confirmed newly-refused (no verdicts were handed to this review; none is claimed) PLATFORM COVERAGE: I wrote posix, windows and any rows. The diff assumes things about paths in two places: UNADJUDICATED:
[SCOPE-REVIEWED] 30ccc01 |
GPT 6.1 Review — ✅ no blocking findings (all downgraded on adjudication)GPT 6.1 flagged blocking issues on This comment is updated in place on each push. Review detailsBLOCKING -- src/kiro_crew/cron_service/service/job_removal.py:125 -- Concurrent app registration can resurrect a deleted cron Adjudication (Opus 5.5) — is blocking on each finding proportionate?LOW: the deleted cron comes back only if a dashboard DELETE and an app update overlap within a few thread hops. Removal is persisted at False positive or not applicable? A repository writer can comment: |
Problem / Motivation
Goal: Bring the KAS fixes and the user-reported fixes that merged on main after the 0.13 cut to
release/0.13.0, so 0.13 ships them.Backport batch 1, part 2 of 3, onto
release/0.13.0(head1fe3510b2fa2, after part 1 #37323). Batch 1 carries the 38 main fixes that fix KAS or that users reported, plus 23 prerequisites, in main's merge order. It lands in three PRs because its whole diff is over the 1 MB the AI review lanes accept. This part has 16 picks and 4 prerequisites.One commit per pick, each made with
git cherry-pick -xin main's merge order. All 20 applied with no conflict; nothing was hand-resolved.9a5c716a1cd92f4e88a3bccdc0a9585cb5ed114fa6cdc84819f781c8c3dfb8d6f3320945036bc927cd26c28afeacebac3dcc03032ec89f1ff8e17a05c8f45fb8709c9449adaf23cf2e6bffdfc231874b8e79cbc18892812dcba9b2520fa573d6d9a5c59def0efe1abf3b33e0c4eb21d647ac1752cb6d4871Each prerequisite is a fix from main with its own tests, and none changes behaviour beyond what its own PR describes. "Needed by" names the pick whose conflict pulled it in, which lands in part 3: without the prerequisite, that pick conflicts on code it added.
Why it matters
0.12.2 was the last 0.12 release, so 0.13 is the next release users get. The KAS picks in this part fix shell grants (#36541, #36813), KAS sign-in through a proxy (#36978), the mcp.json servers under KIRO_HOME (#36145), the compact threshold KAS claimed (#36996), MCP sign-in notices (#36993), tool loading on a custom agent (#37093), and repeated spec notices (#36955). The other picks fix bugs that users reported after the cut, including the per-action IPC gate for remote gateway senders (#13040).
Not a goal
What changed (motivation → approach → change)
Cherry-picks only. No hunk was hand-resolved.
Backwards compatibility
Compatible. Each pick behaves as it does on main, where it was reviewed. Nothing is removed: no key, path or record.
Tests
Test changes come from the picks.
Release PRs get no backend test lanes in CI, so the backend tests ran locally: one pytest process per batch of 20 files, no xdist.
release/0.13.0checkout. They also fail locally on a cleanmain, while the PR that the 0.13 cut was taken from (feat: let an administrator allow or refuse each decision model #36271) passed every Backend Tests shard in CI, so they come from this test machine, not from the code.Frontend:
tsc -p tsconfig.app.jsonis clean on this head. The 3 vitest files this part touches pass.flake8 and black on every Python file in batch 1: clean.
Manual verification
N/A. Unit coverage above; the same changes are on main.
Screenshots / video
Why no screenshot: this part adds no UI of its own. Its frontend changes are cherry-picks: #36610 and #36996 passed Design and UX review on main; #13040's main PR has no Design or UX run; its frontend part is the Windows title-bar menu and its strings, behind the new per-action IPC gate.
Related Issues
Backport of the main PRs listed above. Follows #37323.
Sibling sweep
Siblings: none -- the backport touches the same sites the picked PRs changed on main
Pattern harvest
Not generalizable: backport of already-reviewed fixes
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...). A backport batch keeps one commit per pick.Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license.