Repository navigation
fix: 0.13 backport batch 1, part 3 of 3 (KAS and user-reported fixes) - #37389
Conversation
Audit every docs/system-specs page against the module it names and correct identifiers, paths, defaults, counts, routes and behaviour statements that no longer match the code: renamed or moved functions, retired routes and categories, wrong config defaults, and incomplete lists that claim to be complete. Co-authored-by: zejiangg <zejiangg@amazon.com> (cherry picked from commit e564a9b)
) * fix(scratch): resume a conversation into the scratch tree it had A resumed conversation (gateway restart, transient backend exit, idle reap) built a new provider that got a fresh, empty $KIROCREW_SCRATCH. The old tree then had no live owner and the hourly sweep deleted it, with the agent's staged work. Record each session's work tree per session key in an index inside the masked scratch root, and hand it back as shared_scratch on a resume. The index lives in a new agent_scratch_trees module. A failed index write, or an index that cannot be opened, keeps the in-process binding of the tree in use and lets the session start; only a disk row naming another tree for the key is dropped. Continues #15980 by Premshay. Fixes #15979. Co-authored-by: Premshay <28099628+Premshay@users.noreply.github.com> * fix(scratch): start the session when retirement cannot be persisted A resumed or reset session refused to start when abandon_tree could not confirm the index write, so one unreadable or unwritable .trees.json blocked every such session until someone repaired it. Before the index existed a resume always started, in a fresh tree. Log a warning naming the index and let the allocation continue. abandon_tree drops the key's in-memory binding first, now also when the managed root itself cannot be read, so this process never hands the tree back; after a gateway restart the key may rejoin its own earlier tree, never another key's. --------- Co-authored-by: Premshay <28099628+Premshay@users.noreply.github.com> Hand-resolved backport; original author: Ray Xu. (cherry picked from commit 684bc62)
An app's l10n block reached the dashboard only once the app was installed: _merge_manifest, which builds a store row from the app's app.json, copied displayName and description but never l10n. A reader whose language the app translated saw English on the store card and detail page until after install. Carry the block on the row as manifest.l10n, where the dashboard already reads it, parsed with the install's L10nConfig so a malformed or over-cap locale is dropped the same way. (cherry picked from commit c296cd7)
On KAS a remote MCP server whose saved OAuth sign-in stopped working left every new chat without its tools and with nothing that said why. The engine deletes saved tokens, and reports failedAuthorization, only for invalid_grant, invalid_client and unauthorized_client. Any other refusal of a refresh keeps the tokens and reports the server failed, so nothing tracked it for a sign-in and naming it in a message did nothing. A failed entry whose error says the token endpoint refused the saved sign-in is now tracked like failedAuthorization and listed as waiting for a sign-in. A 5xx, server_error or an unreachable endpoint is left alone: a sign-in reset would delete tokens that may still work. A chat also adds one notice row, once, naming the servers that wait for a sign-in and have no open sign-in card, with how to sign in. The chat page draws it with a link to the MCP Servers page. It starts no sign-in. On the MCP Servers page a server with a saved sign-in that the page cannot sign in to (added outside the page) says how to sign in, where the row used to show nothing. A server added from the page already offers Sign in again; a test pins it. Hand-resolved backport; original author: Ray Xu. (cherry picked from commit 6b75355)
#37108) A new dashboard chat on the default agent sent its agent system prompt, critical rules and tool-name rules inside its first user message. That message is unique per chat, so the engine's prompt cache never served those bytes and every new chat paid for them in full. On a KAS harness known to apply a client agent's prompt, a dashboard session of the default agent whose spec prompt is the managed stub now sends those three blocks as the agent's prompt, folded like the message and closed by a short gateway note. The engine caches its first message, which holds that prompt. The runtime records each block on session/new and session/load, and the session-start build leaves a block out only when its record equals it byte for byte. A resumed chat that started with a head and whose resumed session holds none gets the agent system prompt back in its resume message, because the engine rebuilt its first message from the stub. The session map keeps that per sid (head_sid). Another agent, a prompt a person wrote, a non-dashboard key and every other harness keep the message path. The agent prompt has one renderer, agent_spec._render_contract, which the builder calls with its per-session readings and the head calls with live ones. Decision: docs/request-for-change/rfc-kas-session-head-in-agent-prompt.md Part of #36928 (cherry picked from commit a558571)
…36347) An open "X isn't installed" tab kept saying so after the app was installed from the CLI or another tab, until a reload or a focus change. The gateway already sends the app_reload frame for every install, but only a mounted AppHost listened for it. A new useAppInstalledElsewhere hook lets the two not-installed views (AppPage after a 404, BuiltinAppRoute's released state) hear that frame for their app: it fires mc:apps-changed so the shell re-reads the installed-apps list, and AppPage also re-reads the app's record. Part of #26967 Hand-resolved backport; original author: Bolin Chen. (cherry picked from commit 9bfa880)
A sandboxed child could rename a parent of a masked crew-home leaf (apps/meetings/data, apps/aws-control, or an app's credentialMasks data dir). On Linux the mask is a mount that moves with the parent inside that spawn, but on disk the leaf then sits at a name no mask covers, so the next spawn read it there. On Seatbelt the parents of core hidden leaves were not guarded either. Every parent of every hidden spelling, core or app-declared, now joins the rename guards the read-only seals already use: pin_seal_parents binds on Linux, literal write denies on Seatbelt. A leaf the spawn lifts keeps its parents unguarded there. A retired leaf, which nothing writes any more, guards its parents only while they exist, so md-notebook's sandboxed backend can still create its own home. (cherry picked from commit f43dd14)
An app token without the user-session control grant got one body on
every route that needs it: {"error": "app cannot manage session
approvals", "code": "session_approval_not_granted"}. The grant needs
three things: permissions.sessionApproval in app.json, the owner's
consent, and the app turned on. The refusal named none of them, so a
developer could not tell an app.json change from an owner's click.
session_approval_denial_cause names which part is missing, and
app_can_manage_session_approvals grants from it, so the decision lives
in one place. The 403 keeps its code and adds cause. error says who
clears it: add "sessionApproval": true and update the app, have the
owner click "Enable and allow chat control" or "Enable", or retry. The
cause is read again after the decision, off the event loop, so the
wording never decides a refusal.
(cherry picked from commit 9c6dc11)
) With 64 MCP servers the KAS custom-agent projection still took 433 to 673 ms of a new chat's start on Linux, and 138 to 157 ms on its own. Three parts of it redo the same work every chat with the same inputs: - the resource-glob match behind the auto-approval and hook-coverage checks, about 4,100 calls, is now memoized (lru_cache of 4096 pairs on batch_guard._read_glob_matches; a string over 256 characters is matched uncached). It is a pure function of two strings; a test pins that it reads no module state. Every grant decision built on it is still made fresh. - the MCP config scopes are read once per projection in KasHarness.session_extras and handed to the worker-stub withdrawal, the agent block, the declared names and each sub-agent target, instead of two or more reads. - a shared launch snapshot that already holds exactly its bytes, as this user's owner-only regular file, is left in place instead of rewritten with fsync. Missing, different, linked or not owner-only files are written as before; Windows always writes. An agent that names several sub-agent targets also repeated, for each target, the agent-spec name scan, every skill file read and every installed app's manifest read. One session start now reads each once (build_reuse.one_build around the projection): the spec scan keyed on each file's identity, so a spec written meanwhile is read again; nothing is kept past the start. With 8 targets the targets took 9.1 s before and 0.74 s after. The projection's output is unchanged: tests project a 64-server spec and a several-target agent with and without the reuse and compare the bytes. Closes #37041 Hand-resolved backport; original author: Bolin Chen. (cherry picked from commit dd9d0e3)
#36295) * fix(setup): lift the Kiro CLI update card when KAS moves to the bundle The too-old latch followed only the configured route, so with config still naming the relay the card stayed up after KAS moved to the bundled engine on its own (no kiro-cli, or kiro-cli signed out). While the latch is set, also ask kas_route.resolve_kas_route, at most once per minute: the resolver reads kiro-cli's SEL-audited sign-in store and the gate polls every few seconds. Closes #35450 * fix(setup): resolve the KAS route through agent_sdk and list it in the facade The latch's route check imported kiro_crew.acp.kas_route from application code, which the agent-sdk boundary refuses. Ask agent_sdk.kas_bundle.kas_route instead, which now forwards the service's environ and home. Name the two new probe names in the kiro_prerequisite facade manifest, and patch the autouse route fixture through _floor_monkeypatch. --------- Co-authored-by: Jacob Largent <largjaco@dev-dsk-largjaco-kiroc-2a-dc066d04.us-west-2.amazon.com> (cherry picked from commit 011a6dd)
#36923) The credential-exfil-s3-{cp,mv,sync} rows refused ordinary downloads when a command held more than one statement (several cp lines joined by newlines, ';' or '&&') or used a variable set earlier on the line (B=b; aws s3 cp s3://$B/...). s3_direction now splits the line into top-level statements with the existing quote-aware shell_commands reader and narrows the rows only when every aws s3 transfer on it is a plain download. A plain literal assignment made once on the line is resolved. A pipe, background '&', subshell, command substitution, any here-document or redirect, compound keyword, reassignment or any upload keeps the deny. When one of these rows still refuses a line that looks like a download, deny_guidance answers with download guidance (literal paths, or aws s3api get-object) instead of the upload prose. Closes #36876 Hand-resolved backport; original author: Ray Xu. (cherry picked from commit f04ddad)
…lag (#37203) When the sandbox launcher refuses the kiro-cli acp --help probe and its trusted re-run then passes, the result carries no sandbox_failure, so the launcher's own sandbox: line was read as kiro-cli's help. That help has no --agent-engine flag, so the gateway marked KAS unservable and ran on kiro-cli. This was seen when one gateway started while another booted. A probe reading what a kiro-cli supports now treats a nonzero exit carrying any launcher exit line as unknown: the pinned acp --help and v3 start probes (logged, never cached) and the PATH-only --version probe. An exit kiro-cli made itself is still its answer. A help gap's fallback notice now names the run it was read from. (cherry picked from commit 2cbf235)
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 new chat sign-in notice and the new MCP tab line. The PR attaches no image, so the blind read was not performed. Evidence gaps
Notes
[UX-REVIEWED] 8bd104d Description read[DESCRIPTION-READ] 612c38cec73187d4dae81626cb2dd34a4d57b2f336e414b8c920ad1ee8c49e44 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Every item is a Notes
What this change shipsInventory (10 items) — 9 justifiedIntent: ship the KAS fixes and user-reported fixes that merged on main after the cut in 0.13. FIX.
[FIRST-PRINCIPLES-REVIEWED] 8bd104d Description read[DESCRIPTION-READ] 315a8b60fdb0653c0875c3960182ea7b975d792f438073a9bc501fa944d95128 That sha256 names the PR description this verdict read. 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 new chat "MCP server waits for a sign-in" notice and the McpTab "signed in, no row sign-in" line as they render on BlockersThe new UI ships with no screenshot of this revision Notes
[DESIGN-REVIEWED] 8bd104d Description read[DESCRIPTION-READ] af1874b3d9579a0c33aeb692030b53017d3692768ff8ea222d69d0f6f5856fd7 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 |
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-tier change is a rewrite of the s3 download reader in TIGHTENING: the crew keystone path fence and the sandbox rename guards -- these stop an agent from reading or rewriting the subagent scratch tree index, which would expose other trees and remap resumes. The hunks: ADJUDICATED: 25 candidates, 0 confirmed newly-refused PLATFORM COVERAGE:
UNADJUDICATED:
[SCOPE-REVIEWED] 8bd104d |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit 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 3 of 3, onto
release/0.13.0(head705bf17e7fb, after part 2 #37355 and #37357). 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 8 picks and 5 prerequisites.One commit per pick, each made with
git cherry-pick -xin main's merge order. 8 applied with no conflict; 5 carry a hand-resolved hunk, listed below.338f7254d5d2684bc6215f2d6b75355d50f4a5585710658add9d0e3c25a9011a6ddad5fef04ddad1da072cbf235c107be564a9ba4e27c296cd7df02d9bfa880fcbbdf43dd14a1fdc9c6dc115f811Each prerequisite is a fix from main with its own tests, except #37105, which changes docs only. "Needed by" names the pick whose conflict pulled it in: 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 cut the start-up work every new KAS chat repeats (#37097, #37108), say in chat when a KAS MCP server waits for a sign-in (#36135), treat a standalone kiro-cli 3.x as the chat binary (#36975), lift the Kiro CLI update card when KAS moves to the bundle (#36295), and read a sandbox launcher exit correctly (#37203). The other picks fix bugs that users reported after the cut.
Not a goal
What changed (motivation → approach → change)
Hand-resolved hunks
No code line was hand-resolved. Each hunk below takes the pick's change and leaves out what belongs to a main commit that is not on 0.13. Original authorship is named in each of these commits' messages.
website/src/i18n/pluralKeys.json: added onlypages.chatPage.mcp_sign_in_needed_more, for the same reason.website/src/pages/chat/transcriptRenderers.tsxandwebsite/src/test/chatRolesParity.contract.test.ts: added the newmcp_sign_in_neededrow and kept 0.13's "Ultra Mode" wording on the row next to it. Main renamed Ultra Mode to conductor mode in refactor: rename Ultra Mode to conductor mode #36924, a refactor not on 0.13.test/test_security_gate_liveness.py:_PACKAGE_LINE_BUDGET. Main's budget also counts 3 lines from feat: switch one steering file off for one chat where crew writes it #33966 (a feature not on 0.13), so each raise starts from 0.13's own value: 35,997 + 18 = 36,015 for fix(scratch): resume a conversation into the scratch tree it had #30062, then + 179 + 48 + 8 = 36,250 for fix(security): read aws s3 downloads across statements and assignments #36923. The budget test passes at that value.website/src/pages/AppPage.tsx: added theuseAppInstalledElsewhereimport. Main's context line importsSURFACE_FORMER_APPS, which came with feat: make the Command Bar a dashboard setting instead of a built-in app #36358 (a feature not on 0.13) and which 0.13'sAppPage.tsxdoes not use.docs/system-specs/modules/app-kit-platform.md: one row of the module table. Took the pick's new sentence and kept 0.13'sapp_disabledentry.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 on this head, on top of parts 1 and 2: one pytest process per batch of 20 files, no xdist. The run covered 1,759 test files (every test file the picks touch, plus every test file that imports a module they change): 78,222 passed, 25 failed. All 25 also fail on a clean
release/0.13.0checkout run the same way; they fail locally on a cleanmaintoo, while main's CI is green, so they come from this test machine, not from the code.Frontend on this head:
tsc -p tsconfig.app.jsonclean,scripts/check-i18n-keys.mjsOK. The 6 vitest files this part touches: 5 pass. The other one,CrewChatWindow.test.tsx("draws a code fence in a peer USER row copy-only too"), fails the same way on a cleanrelease/0.13.0.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; each frontend change is a cherry-pick of a main PR that carried its own review evidence on main.
Related Issues
Backport of the main PRs listed above. Follows #37323 and #37355.
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.