Skip to content

feat(context-cap): trim only on a cold cache, add a worker cap and tool-result pointers - #29388

Merged
bolichen97 merged 1 commit into
mainfrom
fix/trim-cold-cache-only
Nov 17, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/trim-cold-cache-only

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A conductor's or worker's chat is trimmed only once its prompt cache has already expired. A warm cache is never trimmed, and a trimmed chat can still fetch any old tool result by its id.

The owner ruled on 2026-11-03 that a warm cache is never trimmed, for conductors and workers. Today the conductor cap still trims a warm chat over 400K (Rule A, CONTEXT_CAP_HIGH_TOKENS in src/kiro_crew/dashboard/chat_turn/context_cap.py). Dispatched workers have no trim at all, so a worker chat grows until KAS compacts it at 80% of its window. The trim note also tells the model that get_chat_session reads tool output back, but that tool returns only user, assistant and inject rows, so a trimmed chat has no tool path to its old tool output.

Why it matters

76% of worker turn starts already land on an expired cache (the 15-minute conductor patrol is longer than the 5-minute cache). A trim at those turn starts costs no cache. A trim on a warm cache throws away a cache the next request would have used. The wrong note sends the model to a tool that cannot answer.

Not a goal

  • Trimming inside a turn (38% of worker requests over 200K come from turns that started under it).
  • The worker seed from rfc-worker-context-cap.md section 5.3 (work brief, last report, edited-file list).
  • Building the trimmed session ahead of time, off the hot path.
  • Turning the worker cap on by default.
  • Normal chats and other crewmates.

What changed (motivation → approach → change)

Owner ruling → one cold-only check for both agents → three changes.

D1, a cold-cache gate (context_cap.py):

  • _context_cap_rule(tokens, idle_secs, line) returns "B" only when idle_secs >= CONTEXT_CAP_CACHE_SECS (300 s, the existing constant) and tokens > line. Rule A and CONTEXT_CAP_HIGH_TOKENS are gone. A warm or unknown cache never trims, at any size.
  • The clock is unchanged: _Session.last_used, the previous turn's end. That comes after the previous turn's last request started, so it never calls a warm cache cold.
  • Scope: WAKE_RESET_AGENTS (conductors) use session.context_cap with the 200K line. kirocrew-worker uses a new session.worker_context_cap with a 300K line (CONTEXT_CAP_WORKER_TOKENS). Every hold and the damping guard apply unchanged.

How each default behaves:

Setting Default Behaviour with the default
session.context_cap true (unchanged) A conductor chat over 200K is trimmed at a turn start whose previous turn ended 300 s or more ago. A warm conductor chat is never trimmed: before, it was trimmed over 400K.
session.worker_context_cap (new) false Workers are not trimmed, as today. With true: a worker chat over 300K is trimmed at a turn start whose previous turn ended 300 s or more ago, never on a warm cache.

D2, pointers:

  • The trimmed seed gets one line per stored tool result in the chat's transcript, newest last, at most 100, one line per tool_call_id (an approved call's two rows count once): tool_call_id | tool | args | output size. The header names the chat's session_key. Built by build_tool_pointers in src/kiro_crew/context.py (the chained transcript with its rotated archives, redacted like build_session_replay) and tool_pointer_text in src/kiro_crew/context_assembly/replay.py.
  • get_chat_session takes an optional tool_call_id. It returns that transcript tool row's meta.output (redacted when stored), cut to TOOL_CALL_OUTPUT_MAX_CHARS (8,000) with a marker for the rest, and redacted again. It runs the same key check, incognito refusal, workspace gate and SEL log, and reads through the derivation seam with rotated archives (derive_messages_chained_full_with_keys), so an id listed before a size rotation still resolves. It is refused together with crew.
  • Where it lives: the handler is in mcp_tools/sessions.py and the field in mcp_tools/catalog/sessions.py. validation_parts/messaging_session_schemas.py checks the id with a fixed character set, served by validation.py. session.worker_context_cap is in config/sections_session.py and config/loader_builders.py.

D3, the note: CONTEXT_CAP_TRIM_NOTE now says to re-read a file you need, and to fetch any other output with get_chat_session plus this chat's session_key and the call's tool_call_id.

Docs: configuration.md, the module spec row and config-baseline.json are updated. The RFC amendments are in their own docs PR, #29401.

Product-shape note: this changes what the conductor cap does by default (no Rule A). The decision is recorded in rfc-conductor-context-cap.md (to partial) and rfc-worker-context-cap.md (to accepted) by docs PR #29401, merged to main on 2026-11-04. This PR is rebased onto it.

Backwards compatibility

Compatible: get_chat_session without tool_call_id returns the same output (test test_a_call_without_tool_call_id_is_unchanged). The new argument is optional. The new setting defaults off. session.context_cap keeps its key and default.

Reader: src/kiro_crew/dashboard/chat_turn/context_cap.py:_context_cap_trim -- entry: chat -- Rule A's removal leaves warm conductor sessions in place; test_a_warm_conductor_over_400k_is_never_trimmed, test_a_cold_conductor_over_400k_is_trimmed
Reader: test/test_conductor_context_cap.py:_context_cap_rule -- entry: chat -- the only caller of CONTEXT_CAP_HIGH_TOKENS / Rule A besides the check; updated to test_only_a_cold_cache_over_the_line_trims

Tests

Proof: PROVEN test/test_conductor_context_cap.py::test_only_a_cold_cache_over_the_line_trims[400001-0.0-None], test/test_conductor_context_cap.py::test_only_a_cold_cache_over_the_line_trims[900000-299.9-None], test/test_conductor_context_cap.py::test_only_a_cold_cache_over_the_line_trims[900000-None-None], test/test_conductor_context_cap.py::test_only_a_cold_cache_over_the_line_trims[900000-300.0-B], test/test_conductor_context_cap.py::test_a_warm_conductor_over_400k_is_never_trimmed[412000] (head 683a144)

test/test_conductor_context_cap.py:

  • Warm above the line, no trim: test_a_warm_conductor_over_400k_is_never_trimmed[412000, 900000], test_a_worker_trims_only_on_a_cold_cache_over_300k[warm-over, just-warm].
  • Cold above the line, trim: test_a_cold_conductor_over_400k_is_trimmed, test_a_worker_trims_only_on_a_cold_cache_over_300k[cold-over].
  • Cold below the line, no trim: test_a_worker_trims_only_on_a_cold_cache_over_300k[cold-at-line, cold-under], and the rule table test_only_a_cold_cache_over_the_line_trims.
  • Switches: test_the_worker_cap_is_its_own_switch, test_the_worker_cap_is_off_by_default_and_config_json_turns_it_on.
  • Pointers in the seed: test_the_trimmed_seed_lists_each_stored_tool_result, test_the_pointer_list_keeps_the_newest_100.
  • Note: test_the_trim_note_names_the_tools_that_really_return_tool_output.
  • The existing tests now default _Sessions to a cold cache, because the session-over-400K fixtures they use no longer trim warm.
  • The worker gate cases pin the idle gap (_context_cap_idle_secs), so the 299.9 s case cannot cross 300 s on a slow runner. The clock itself is covered by test_the_clock_is_the_previous_turns_release_not_its_acquire.

test/test_search_chat_history.py:

  • Round trip: test_a_trim_pointer_round_trips_to_its_tool_output (pointer id → get_chat_session(tool_call_id) → that output, redacted).
  • Unknown id: test_an_unknown_tool_call_id_says_so.
  • Length: test_a_large_tool_output_is_cut_to_the_promised_length (a 20,004-char output comes back as 8,000 chars plus a marker).
  • Incognito: test_tool_call_id_refuses_an_incognito_session.
  • Old call unchanged: test_a_call_without_tool_call_id_is_unchanged. This control passes with and without the fix, by design.

With main's src/ and this PR's tests, 19 of the new or changed tests fail. Only the unchanged-call control passes on both sides.

Manual verification

Offline replay of the gate over real KAS transcripts on one operator's host, 2026-11-01 05:10 to 2026-11-03 23:41 UTC (2.77 days). Sizes and timestamps only, priced with the P-cross-session-prefix-cache price model (0.108 + 0.372 cr/100K per request, + 1.141 cr/100K when cold). Each chat's KAS sessions are joined into one no-trim timeline, so earlier real trims do not hide the size a chat would reach.

Chats / KAS sessions Trims Per day On a warm cache Saved vs no trim Largest context
Workers, cold-only 300K 79 / 79 17 6.1 0 251.6 cr/day of 2,414.2 431K (inside one turn)
Conductors, cold-only 200K (this PR) 15 / 32 20 7.2 0 696.3 cr/day of 1,338.2 391K
Conductors, as shipped (Rule A + B) 15 / 32 20 7.2 0 696.3 cr/day 391K
  • Conductor turn starts over 400K on a warm cache: 0. Rule A trimmed nothing that Rule B would not have, so removing it changes no credit on this data.
  • Worker turn starts over 400K on a warm cache: 0.

Related Issues

Refs #22082, #23037

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • 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

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners November 3, 2026 23:49
@iamwhatever
iamwhatever requested a review from buluoray November 3, 2026 23:49
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision b961894fbd615e94966ee62d16ad9f856da1f1da 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 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

No design concern blocks this: the cold-cache gate, the opt-in worker switch and the optional tool_call_id argument are all additive or easy to revert, and the only removed constant has no reader left.

Notes

  • Without Rule A, a conductor chat that stays warm grows until KAS compacts it at 80% of its window. That is the intended trade, but it is a default change for every conductor. A server log of how many turns land in the old 400K warm band would show whether that trade pays off.

[DESIGN-REVIEWED] b961894

Description read

[DESCRIPTION-READ] b1ef813e91564140cb9fff7eba83faca32eb3a3cd36b01aa2745ec4aaf9c865c

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of b961894fbd615e94966ee62d16ad9f856da1f1da — 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

Nothing blocks. Both product-shape items, removing Rule A and adding the worker cap (off by default), are covered by base RFCs: rfc-conductor-context-cap.md is partial and rfc-worker-context-cap.md is accepted. Each RFC's 2026-11-03 amendment names this exact shape.

Notes

  • Item 1 — one consumer, generalized: with Rule A deleted, _context_cap_rule can only ever return "B". It has 1 production caller, at context_cap.py:163, which only checks is None and logs the label. The line=CONTEXT_CAP_IDLE_TOKENS default is used by tests only. Subtraction: return a bool, drop the rule %s label from both log lines, and drop the default on line.

What this change ships

Inventory (7 items) — 6 justified

Intent: keep a conductor's or worker's chat from being trimmed while its prompt cache is warm, and let a trimmed chat fetch its old tool output. ADDITION, with a fix to the trim note riding along.

  1. A warm conductor chat over 400K is no longer trimmed (Rule A removed, default changed) — one consumer, generalized: "B" is the only value left
  2. New session.worker_context_cap switch, off by default, trims worker chats over 300K on a cold cache — justified
  3. A trimmed session's seed lists up to 100 stored tool results by tool_call_id — justified
  4. get_chat_session takes an optional tool_call_id and returns that call's stored output, cut to 8,000 characters — justified
  5. The trim note now points to get__chat_session with tool_call_id instead of claiming it reads tool output back — justified
  6. tool_call_id together with crew is refused — justified
  7. Config help text, configuration.md, the module spec row and config-baseline.json are updated — justified

[FIRST-PRINCIPLES-REVIEWED] b961894

Description read

[DESCRIPTION-READ] 7e7dba5d178a180deb401a18ce30fb8c020c9be7ea303c11db87fb8978c20a44

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] b961894

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

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] b961894

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

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

@iamwhatever
iamwhatever force-pushed the fix/trim-cold-cache-only branch from 93f1f72 to 2f36a0d Compare November 4, 2026 00:15
@iamwhatever
iamwhatever force-pushed the fix/trim-cold-cache-only branch from 2f36a0d to 8b0e214 Compare November 4, 2026 00:22
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 4, 2026
chenmingwei23 pushed a commit that referenced this pull request Nov 4, 2026
…11-03) (#29401)

Records the owner's 2026-11-03 ruling in both context-cap RFCs: a warm prompt
cache is never trimmed, conductors included. The conductor cap loses Rule A
(over 400K whatever the cache); Rule B (over 200K once the previous turn ended
300 s or more ago) is its only trim. The worker cap is accepted as amended:
cold-only over 300K, its own switch session.worker_context_cap default off,
and the conductor's seed with a tool-result pointer list.

Both RFCs record the new risk (a warm chat can grow past 400K until its cache
expires or KAS compacts at 80%) and the offline replay of 2026-11-01 to
2026-11-03. The conductor RFC moves to partial (phase 1 is on main), the
worker RFC to accepted. The implementation is #29388.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
buluoray added a commit that referenced this pull request Nov 4, 2026
…flict) (#29627)

* fix(desktop): open editor links from framed panes after a confirm (#28465)

Co-authored-by: ejhong <ejhong@amazon.com>

* fix(governance): judge cron turns by their session and fail closed on unattended turns (#27745)

A cron turn now hands the PreToolUse gate its own session key, so a
governance profile bound to that session's surface governs it the way it
governs a chat turn.

When the governance tier's own evaluation raises, a turn nobody is
watching (cron, heartbeat, a monitor wake) now refuses the call instead
of allowing it. An attended turn keeps "no governance opinion", so a
transient fault never refuses an ordinary user action. Both paths log
the error.

Co-authored-by: w <w@k.local>

* fix(deploy): show the newest profile check, lock Verify while it runs (#28845)

* fix(imessage): keep inline code and URLs verbatim when flattening (#28829)

* feat: starred mates show in the left dock, drag to reorder (#28812)

A starred mate is now a row in a Mates group in the left dock, under the
Main rows. The star is the only switch, so there is no second pin to keep
in step with it. Rows use the rail's own NavItem with the face in the
same 16px icon box as every other dock icon.

The dock shows the first 3 starred mates and an "N more" row that opens
the roster, because the dock's top block does not scroll. Dragging a row
reorders the group; the order is a new crew-record field, star_order,
written through PUT /api/agents/{name} next to starred, so it follows
the person to every device. Unstarring clears it, so a re-star lands at
the bottom. A failed write refetches the roster and shows a notice.

The group sits outside the rail's fixed blocks and shares the leftover
room with the app list: on a short window the apps shrink first, down
to one row, then the group, down to one row, so neither the installed
apps nor the footer leave the rail. The phone rail beside the chat and
Mates drawers shows the same mates as tiles after the app tiles.

While a docked mate's chat is open, its dock row is the lit one rather
than the Mates page row.

Closes #28789

Co-authored-by: CrysisDeu <crysisdeu@users.noreply.github.com>

* feat(artifacts): open an image artifact in the zoomable image viewer (#28786)

* fix(code-review-sage): pass counts into the catalog on glued count labels (#28700)

* fix(apps): refuse manifest shell strings on native Windows instead of misreading the spawn failure (#28619)

detectInstalled and openCommand run through /bin/sh -c, which native Windows
does not have. The registry probe and the install precheck swallowed the
FileNotFoundError as "not installed", and the open route answered "running
remotely" before it reached the spawn. Each site now checks the platform
first: the probe and precheck start no process and log the reason, and the
open route answers 409 app_open_unsupported_platform.

Fixes #27780
Fixes #27798

Co-authored-by: Zezhen Xu <zezhexu@amazon.com>

* docs(rfc): record the first-Mate welcome and the goal-saved Heartbeat offer (#28604)

Adds two decision entries for Zezhen's owner decision on #25476, amends
rfc-crewmate-guides-and-mate.md and rfc-crewmate-heartbeat.md to match,
and turns the prompt-wording pins in the two #25476 tests into structural
checks against crewmate_prompts.json.

Fixes #25528

Co-authored-by: Zezhen Xu <zezhexu@amazon.com>

* fix(i18n): pass counts into the catalog on chat count labels (#28590)

The comment-thread tally, the file-chip "Show N more" row, the queued
count, the pending-approvals header and the subagent overflow row
printed a number in front of a separately translated fragment. No
catalog could place the number or pick a plural form. Each label is
one key with a count, with plural forms per locale, and the fragment
keys it replaces are dropped from every catalog.

* ci: skip history blobs in main-ratchet-audit's checkout (#28459)

Co-authored-by: sim <a@b.c>

* fix(sidebar): explain what a sleeping session is on its expander (#26803)

The "Show N sleeping sessions" row only carried a native title ("Not used in over 7d"), which shows after a delay, never on keyboard focus, and did not say what sleeping means. The row now opens an instant tooltip below it, also wired as its accessible description, saying the sessions are not closed and keep their history, were folded away only because they went unused past the threshold, and which menu row behind the filter button changes or turns this off. What is hidden, and when, is unchanged.

* fix(i18n): translate the approval card sentence and code block names (#28833)

The approval card appended a hard-coded English " wants to run" after the
command, and the code block named its region "<lang> code" (or "code")
and labelled an untyped block "code" in English, in every language.

The approval sentence is one catalog phrase with the bold command as a
<title/> component, so word order follows the language and the command
stays verbatim. The code block label and region name are catalog keys
with a {{lang}} placeholder. All twelve shipped catalogs carry them.

* fix(i18n): give four count labels their singular forms (#28801)

* docs(contributing): group tool-made changes into one pull request per directory (#28582)

* docs(contributing): group tool-made changes into one pull request per directory

* docs(contributing): keep a rename that must land atomically in one pull request

A rename that crosses directories cannot be split by directory without breaking callers, so drop it from the group-per-directory examples and say it stays in one PR.

---------

Co-authored-by: sim <a@b.c>

* fix(acp): attach no image from a path written as literal text (#25534)

build_prompt_blocks scanned the raw message, so a readable image path
inside inline code, a fenced block, a 4-space-indented line or escaped
\![x](...) markup was rewritten to [image: <name>] and attached.
strip_image_refs masked only fenced and inline code, so the two sides
disagreed on indented and escaped paths.

mask_literal_spans in image_refs masks all four shapes (indented and
escaped by the same predicate iter_local_refs uses), and both the
builder and the history scrubber now scan _PATH_RE over that view. A
fence that never closes is not masked on either side, so a dangling
opener cannot swallow a channel's appended attachment lines.

The builder masks each user segment of the prompt on its own
(kiro_crew.prompt_segments, as build_message marks it), so injected
text that ends inside an open fence (a cancelled turn's partial
answer, a Slack thread root) cannot pair with the user's next fence
line and hide the image between them. Injected segments are sent as
written, as before; a plain string is one user segment, judged whole.

Fixes #11713

Co-authored-by: Zezhen Xu <zezhexu@amazon.com>

* feat(dashboard): move MCP Management to Customize → Connections (#24933)

MCP Management (stub MCP servers, share their backends, Sharing assessment)
was one of the Settings → Developer internals pages, among logs, telemetry
and storage, away from the MCP servers it governs. The share-refused notice on
the MCP Servers list sent people to that separate page to approve a launch.

Render McpManagement as a section below the servers list in Customize →
Connections → MCP Servers (/capabilities?tab=mcp&view=mcp-servers); the
component is reparented, not rewritten. Drop the mcp-pool page from Settings
→ Developer and redirect both old links, /settings/developer/mcp-pool and
/developer?tab=mcp-pool, to the new section so bookmarks, docs and tips keep
working. While the servers list holds unapplied edits, MCP Management's
"Ask the agent" hand-offs are withheld so they cannot navigate away and drop
them. Point MCP_MANAGEMENT_PATH, the doctor message, the curated tip, docs, the
feature map and the GUI feature catalog at the new location, remove the
now-unused tab label from every locale, and add tests for the redirects, the
placement and the repeat-link scroll.

Closes #24920

* fix(chat): route every queue drain through one derived queue-held gate (#22224)

A queue held for one reason was drained anyway by a path never taught to consult the hold, burning the queued prompts into the failure they were held back from.

* ci: blobless full-history checkout and 20-minute budget for the stable gate and internal content scan (#29301)

Two jobs need every commit (the stable gate resolves the release tag and
reads CHANGELOG at it; the internal content scan diffs base..head), but
on the runner fleet a full fetch-depth: 0 clone takes 8.6-10+ minutes
and their 10-minute job timeouts cancel them inside the checkout step.

Add filter: blob:none to both checkouts (all commits and tags arrive,
the working tree is still populated, older blobs are fetched only on
demand) and raise both timeout-minutes to 20 as headroom. Neither job
pairs a full clone with a tight budget any more, so both leave the
bounded-checkout ratchet's allowlist; new tests pin the filter and the
budget.

* fix(memory): write no history line when the consolidation entry is empty (#29271)

The history consolidation prompt always asked for a 2-5 sentence paragraph,
so cron, subagent and automation-only sessions produced a dated
"No substantive conversation occurred" entry every night. The prompt now lets
the model answer an empty string when a span holds no decision, outcome or
fact, and says a scheduled run that did real work still gets an entry. The V1
writer appends only a non-blank string entry, as the member store's
apply_consolidation already did. The marker still advances.

Closes #20448

* docs(rfc): let the warm welcome link the pull requests it checked live (#29286)

Refs #29285

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* fix(update): install the release's pinned KAS engine on every update (#26386)

Every update path installed only the new Python code. A release that
moves KAS_PIN_VERSION then starts with no engine under the pinned name,
so on the bundle route every KAS spawn is refused, and doctor says
"nothing installed" while the old engine sits on disk.

Add platform/release_apply.apply_release(), the one function every
update path goes through (CLI git and managed venv, dashboard git and
wheel, auto-update git and wheel). It installs the new code, then runs
the NEW release's `kirocrew kas install --if-in-use` on the new
interpreter, and switches over only when both succeeded: the wheel
engine runs the step before promote, the git callers restart only on
success. The new flag installs when agent.kas_bundle is on (a
failure fails the update), and refreshes an engine already on disk
when the route is off (a failure prints the retry and the update still
switches), so a host that cannot fetch the engine keeps updating. Older engine versions stay on disk
for rollback.

Doctor now names the installed and the needed version when the pinned
one is missing, and the hint lines sending the operator to run
`kirocrew kas install` after an update are gone.

Co-authored-by: CrysisDeu <crysisdeu@users.noreply.github.com>

* docs(rfc): the follow-up card's Start sends its prompt (#26380)

* fix(security): accept Salesforce client ids at operator-listed OAuth endpoints (#29262)

A Salesforce MCP sign-in URL is refused even after its My Domain
endpoint is added to oauth_endpoints.json. At an approved endpoint the
gate skips the bare-secret scan for client_id only when it is exactly
43 base64url characters, and a Connected App consumer key is about 85
characters, so most real keys are read as a secret.

At an endpoint listed in oauth_endpoints.json, and only there,
client_id is now also accepted without the bare-secret scan when it has
the Salesforce consumer-key shape: 3MVG9 followed by 70 to 100 of
[A-Za-z0-9._]. The operator chose that endpoint, so the gate trusts it
for this one shape. At builtin and MCP-discovered endpoints client_id
keeps the full scan, as on main, and every other parameter at every
endpoint is unchanged.

Closes #28554

Co-authored-by: Matt Briones <mdbrio@amazon.com>

* fix(mcp): keep the control plane unmarked when no admin registry can apply (#29017)

Co-authored-by: w <w@k.local>

* feat(acp): report kiro-cli's own model fallback (#29310)

* feat(acp): report kiro-cli's own model fallback

kiro-cli can move a turn onto another model inside one session/prompt,
under both engines (KAS and V2). Crew ignored the notice, so the
transcript named the model that refused, a pinned session drifted back
onto it, and a V2 turn the engine had recovered was relabelled a refusal
by Crew's own metadata fold.

Decode both wire shapes into one notice (acp/engine_fallback.py), keep
the session's model in step with the move, and end each turn with one
line in kiro-cli's wording on the dashboard, cron, heartbeat and
sub-agent results. A V2 refusal hop drops the refusal it moved off, so
every consumer reads a true terminal. Surfaces that show the model (the
sub-agent chip, channel /model pickers) follow the engine, and the model
chips now cut long ids from the left as intended.

Co-authored-by: cathzhao <265661517+cathzhao-test@users.noreply.github.com>

* fix(acp): stamp an engine promotion as a runtime model write

A promotion raised the slot's pick generation without marking it as the
runtime's own write, so an Issue Radar crew read it as a person's pick
and held its triage/work model switch. Stamp _model_runtime_pick_gen the
way config_watch does for its runtime clear.

Also let the business-counters source pin match the annotate call now
that it passes stop_reason over several lines.

---------

Co-authored-by: cathzhao <265661517+cathzhao-test@users.noreply.github.com>

* fix(mcp-gateway): route crewmate files through the broker overlay pass (#28798)

A crewmate's worker on KAS got no tools from a gateway-routed stdio server
that needs env credentials: the overlay pass read ~/.kiro/agents only, so the
worker had no stub and KAS declared the server itself without its env.

The same pass now also rewrites each crewmate file in ~/.kiro/mates/agents into
<overlay>/mates/<id>.json under the stub identity crewmate:<id>, with the same
reader, launch approvals, sidecar ledger, fingerprint, cache and prune. A linked
mates/ folder is refused, and a failed overlay write removes its sidecars. On
KAS only, a worker session finds its stubs by its own execution record, in one
lookup whose entry names KAS also subtracts. An app callback from a crewmate
stub is governed under the kirocrew-mate-worker profile and its own identity,
and runs only when both permit. Unverifiable listings, records, files,
collisions or overlays yield no stub.

Fixes #26261

Co-authored-by: Zezhen Xu <zezhexu@amazon.com>

* test(pi): bump the lane's pi to 1.4.0 and re-capture its corpus (#25718)

pi 1.4.0 is the latest @earendil-works/pi-coding-agent release; the Real
Adapter Contract lane pinned 1.3.0. pi-acp stays at 0.0.34, its latest.

- Pin @earendil-works/pi-coding-agent 1.4.0 in test/real_adapters
  (lockfile regenerated with npm install --package-lock-only).
- The lane's pi tests pass on 1.4.0 unchanged; only the G3 pin gate reds,
  on all ten pi live fixtures. Re-capture all ten on pi-acp 0.0.34 over
  pi 1.4.0 with the same drivers and reductions as the 1.3.0 corpus.
  The steering and saved-spec drivers were not kept from the last round,
  so they were rebuilt from their fixtures' notes; each reproduces the
  old frame sequence and facts (steer consumed and answered; saved spec
  confirmed, an edited one refused with capability_runtime_unverified, an
  unreferenced pooled stub not handed to pi). Snapshots regenerated.
- test_pi_saved_spec reads the header version from the lane pin instead
  of a literal, so the next bump does not edit it.
- Comments and READMEs that cite these captures now name pi 1.4.0, and
  the compaction numbers quote the new capture (13484 -> ... -> 49649,
  then 13597).

Checked before raising the pin: pi's engines.node (>=22.19.0), its
thinking levels (off..max), its built-in tool set and the agent loop's
steering/finishTurn path are the same in 1.3.0 and 1.4.0. Crew's gate
hooks every tool_call, so 1.4.0's change to which extension tools are
active on resume does not open a path around it.

Part of #22063

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* feat(crew): a crewmate's chat shows its sessions' approvals and questions, and badges its roster row (#29276)

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* feat(dashboard): add a link row for the pull requests the warm welcome checked live (#29295)

Refs #29285

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* fix(kas): say when a spec hook command is too long to run (#28923)

Co-authored-by: zejiangg <zejiangg@amazon.com>

* fix(agents): read linked global member templates (#28702)

* fix(agents): read linked global member templates

Read linked global templates by declared name for member context,
execution prompts, session MCP servers, and side-turn read-only specs.
Fence targets outside the agents directory against managed state, including
resolved and opened paths. Preserve regular-template precedence and reject
divergent linked declarations.

* fix(agents): screen Windows link targets and keep linked read-only bases

Before resolving an agent spec, _read_agent_spec now runs the hooks
Windows link screen, so a link whose target names an untrusted UNC share
is refused and audited without the SMB probe. The read-only spec reaper
counts a base that only a linked entry declares, matching what
publication reads, so it no longer deletes a live derived spec. The
session MCP fallback imports member context inside the function.

Continues #14851.

Co-authored-by: Fabio Fernandes <7543296+fabiohof@users.noreply.github.com>

---------

Co-authored-by: Fabio Fernandes <fabiohof@amazon.com>
Co-authored-by: Fabio Fernandes <7543296+fabiohof@users.noreply.github.com>

* test(acp): put the not-found spawn's workspace beside the data home (#29248)

* fix(notifications): unack a cron note by the entry its ack added (#29173)

* fix: route three docstring-only chokepoint bypasses through their helpers (#28529)

Three sites did the job of a shared helper without it, against the rule the
helper's own docstring states:

- auto_research subquestion_queue.save_queue staged through a fixed
  `subquestion_queue.json.tmp` and renamed it; it now goes through
  `atomic_write` (unique temp name, Windows rename retry). Bytes on disk
  are unchanged.
- `kirocrew knowledge stats` padded its SOURCE column with len()/ljust, so a
  CJK source name pushed the count columns right; it now pads by
  `messaging.tables.display_width`, and the column is never narrower than
  its header.
- GET /api/knowledge/export built `attachment; filename=<ns>.knowledge`
  by hand, which sends a non-ASCII namespace as raw bytes; it now uses
  `session_export.content_disposition` (RFC 5987 filename*=UTF-8'').

test/test_docstring_chokepoint_sites.py pins those three sites plus the
three grapheme-safe cut sites to their helpers, each with a spy on the
module's own binding and, where the helper changes an observable result,
a behavioural assertion that fails on the hand-rolled form.

Part of #10614

* fix(knowledge): decode a UTF-16 BOM .kiroignore and warn on NUL text (#28644)

Windows PowerShell 5.1 Out-File and > write UTF-16 with a BOM; decoded as
UTF-8 every rule was NUL-interleaved and matched nothing, so the scan
ingested everything the file excluded. Sniff the UTF-16 LE/BE BOM, and log
one WARNING when decoded text contains NUL (BOM-less UTF-16).

Closes #27843

* feat(cli): add kirocrew app update (#29309)

`kirocrew app update <name>` sends the same request as the Update button on an
app's page (POST /api/apps/<name>/update) through the running gateway's
owner-only socket. With no gateway answering it refuses and changes nothing:
an update stops the app's backend, swaps its tree and re-registers its crons
with the running scheduler, which a separate process cannot do.

Split out of #25512 so the CLI verb can land ahead of the automatic-update
loop.

* ci: blobless full-history checkout for the security scope lanes (#29347)

The Security Scope Review jobs and the fork content scan check out with
fetch-depth: 0, and on the runner fleet that clone alone now outlasts
their 15- and 30-minute budgets: on 2026-11-03 the candidates job and
the publish job were cancelled inside actions/checkout after 30 and 15
minutes.

Apply the pattern from #29301 to every full-history checkout in
security-scope-review.yml, fork-security-scope-review.yml and
fork-internal-content-scan.yml: add filter: blob:none (all commits
and trees arrive, the checked-out tree is complete, older blobs are
fetched on demand) and raise the 15-minute job budgets to 20. The
bounded-checkout test now pins the filter and the budget on each job.

* fix(dashboard): fade the bottom of the MCP and Skill browser lists when more rows sit below (#29357)

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>

* refactor(members): move the Schedules exit-guard state into its owner hook (#29274)

* fix(mcp): ask for a one-line reply before ending a monitor or spawn turn (#29270)

monitor_start, monitor_watch, spawn_run and spawn_continue told the model to
end the turn at once. A turn that stops right after a tool with no text breaks
the turn-end contract (docs/decisions/2026-10-03-every-agent-turn-ends-with-
text-or-nothing-to-do.md), so the empty-response recovery injected a synthetic
continue turn after a successful arm or spawn.

Each ack, the applied monitor outcome and the monitor_start description now
tell the model to reply with one line saying what it started, then end the
turn. The recovery ladder is unchanged.

Closes #9324

* fix(apps): read the official catalog caches through read_bytes_with_retry (#28641)

On Windows a cache read that overlaps the store's own atomic_write replace
raised PermissionError, which _read_cache and cached_entries folded into
'no cache'. Read the four cache sites through read_bytes_with_retry, the
helper the other apps/ JSON readers already use.

Closes #27831

* fix(mcp): leave env-blocked servers out of the share confirm while sharing is off (#29278)

* fix(overview): fade the bottom of the Prompts, Steering and Skills list panes (#29358)

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>

* refactor(acp): unchain the session-token ternary in kas_agents (#29259)

hoist_servers_for_session stamped the session token onto hoisted
servers through a list comprehension whose result was a chained
ternary. It is now an if/elif loop in the same order: a managed
server goes through _tokened_managed_element, otherwise an app
server goes through tokened_app_element, and every other element is
kept as projected. The same helpers get the same arguments, and the
list is still freshly built in the same order.

The comment above it said only managed entries get the token; app
entries do too, so it now names both.

* fix(subagent): a finished answer a reap got to first still reaches the parent (#28670)

When a reap begins before a run's answer finishes, the reap owns the
ending and the report. The completion then said only the stop's error
(a deadline reap) or labelled the whole answer a partial (a user stop),
so the parent never received a result the run had finished. The
completion now carries the answer, named as finished, while keeping the
stop's outcome and error.

* fix(dashboard): show command completion as unavailable on Windows (#28981)

On a Windows gateway both completion tiers answer an empty list: the
PATH filter refuses every directory and the path tier has no shell
cwd. That reply is the same one the off setting gets, so the Command
completion switch looked on while no popup ever appeared.

Settings > Display > Terminal now reads the gateway platform with
useGatewayPlatform(). On Windows the switch renders off and disabled,
with a line saying completion is not available there and that the
shell's own Tab completion still works. The stored value, the
completion route's reply and every non-Windows gateway are unchanged;
a non-owner, who sees the platform as unknown, keeps the plain switch.

The new string is in every shipped catalog, in each locale's informal
register.

Fixes #27881

Co-authored-by: Matt Briones <mdbrio@amazon.com>

* test(hook): give weak tests real outcome checks (#26614)

Co-authored-by: zejiangg <zejiangg@amazon.com>

* feat(security): let a person override a command deny rule for one call or the session (#27574)

Co-authored-by: w <w@k.local>

* feat: show the feature tip as a one-line pill that opens into a card (#29324)

The tip above the composer filled the strip with accent purple, sat
three dismiss controls side by side and spread its body across the full
composer width, so it read as busy and pulled focus from the composer.

It now starts as a neutral-glass pill (lightbulb, title, chevron,
close). Opening it shows a small card: an accent tile, the title, the
body capped at a readable width, then the action button, Learn more and
Turn off tips under the text, with collapse and close at the top right.
The settings gear is dropped; Turn off tips is the same opt-out and the
toggle stays in Settings > Chat > Discovery.

Refs #29323

Co-authored-by: CrysisDeu <crysisdeu@users.noreply.github.com>

* feat: draw the left nav rail icons at 20px (#29338)

Rail icons were 16px and read small, most of all on the collapsed rail
where the icon is all a row shows. Every rail icon now draws at 20px.

Row height stays 36px expanded and 32px collapsed: the collapsed row's
vertical padding drops from 8px to 6px. The row's left inset is fixed so
the icon does not move while the rail expands or collapses; it drops
from 12px to 10px so the icon centre stays 29px into the 58px rail and
the collapsed icon remains centred.

Refs #29336

Co-authored-by: CrysisDeu <crysisdeu@users.noreply.github.com>

* fix(crew): leave out an absolute glob's link that leaves home (#29319)

A crewmate whose agent template declares an absolute file:// glob under
a folder that is a link to another volume (a cloud desktop layout)
fails every turn with "Essential source <home>/<folder>: linked document or
directory", because the declared-glob walk refuses any link it meets
whose target is outside the admitted root. kiro-cli follows the link
and loads the same files natively.

For an absolute declaration, the walk now leaves such a link out,
unread and not descended into, and the snapshot names it in one core
essential-context#outside-skipped:<template> note. The KAS document
reader skips it the same way. Nothing outside the root is opened or
listed. A target that is managed memory or member state still refuses,
and so do a link the path screen refuses, a link that stays inside the
root, any link a relative declaration meets, and the launch-record
size check.

* fix(mcp): apply the 30s initialize cold-start floor on every platform (#29391)

Right after a gateway daemon restart or upgrade, every session
re-requests its backends at once, and several cold-start together on a
host busy with the restart. A handshake that normally takes about 3s
then takes 13-15s, overruns the 10s POSIX deadline, and the backend is
reaped while it is about to answer, so every turn fails with "KAS
managed MCP initialization failed ... initialize did not complete
within 10s".

The 30s floor added for Windows cold starts now applies on all
platforms. A configured mcp_gateway.initialize_timeout_secs above the
floor still wins. The spawn gate's initialize watcher and slow-init
fraction already read the backend's effective deadline, so they move
with it.

Fixes #26379

* fix(acp): keep an agent-started turn's frames through a request wait (#29269)

* fix(acp): keep an agent-started turn's frames through a request wait

On a claude client with an agent-started turn handed off but not yet
read, a request wait, wait_for_compaction or
_drain_post_compaction_metadata that ran in that window filed the
turn's start session/update in _mcp_notifications, so
stream_unsolicited() read the turn without its first chunk.

The stdout claim the claude adapter binds now keeps those frames for
the turn: while a hand-off is pending, the claimed reader holds every
frame of a kind that starts a turn, requests from the agent included,
and puts them back at the front of _buffer in arrival order when it
returns. Requests share the list because a request wait puts back the
requests it defers on its own, which would reorder them against the
held chunks. Other frames keep that reader's handling. A frame that
would not fit in _buffer beside the held ones is not held, and a kill
or reset drops the hold.

Nothing registers on_agent_turn yet, so users see no change, and a
Kiro client never binds the claim, so its read path is unchanged.

Fixes #22262

* fix(acp): hold an agent-started turn's closing usage_update with its frames

---------

Co-authored-by: wenlin <34065934+rinbn@users.noreply.github.com>

* feat: add the live browser harness to chat (#26950)

Drive the agent's browser through Browser Harness and a CDP relay in
the gateway, and show the page live in the transcript. The person can
take over at any time, and quick asks plus a sign-in sheet let the
gateway type a secret into the page without the agent seeing it;
nothing typed is saved.

Fields inside iframes bind to quick asks, phones can type and
swipe-scroll during a takeover, decision-model help goes through one
provider registry, and the playwright-cli stack is retired.

* fix(pptx-maker): keep the old engine when a Windows finalize rollback cannot move the new tree (#28737)

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>

* fix(pipeline-conductor): print banned n/a when fleet_probe has no /proc to scan (#28642)

Closes #27785

* fix(config): read config.local.json in three raw config readers (#29196)

config.local.json is an overlay whose keys win over config.json, and
the loader and Settings report the merged value. Three readers parse
config.json themselves and ignored the overlay: the knowledge LLM pool
(agent and knowledge), the dashboard terminal settings, and the Slack
voice fallback used when no loaded config is passed. A setting placed
only in the overlay was shown but not used.

Add read_merged_config_files, which merges the whole documents in
order as the loader does before any section is read, and use it in all
three; each caller passes its own path helpers so their test seams
still reach the read.

* test(dashboard): golden for a replayed chat turn and slot-list pass-work budgets (#29304)

* fix(memory): refuse memory forget on native Windows up front (#28966)

* fix(memory): refuse memory forget on native Windows up front

On a Python with no socket.AF_UNIX (native Windows), `kirocrew memory
forget` showed the key's value and asked for confirmation, then failed
with "the gateway's dashboard socket is not reachable from here", which
reads as a transient fault. The verb's transport needs the dashboard's
Unix socket, so it can never work there.

The owner-terminal check, which runs before any store opens, now refuses
first when socket.AF_UNIX is missing (the same condition the transport
fails on), naming native Windows and the dashboard Memory page. The
forget help and its --help description name the limit. POSIX behaviour,
including the stopped-gateway refusal, is unchanged.

Fixes #27903

* test(memory): give Windows runners AF_UNIX in forget verb tests

The forget verb now refuses first when socket.AF_UNIX is missing, so on
native Windows runners every test that drives the verb past that check
hit the platform refusal instead. A unix_socket_platform fixture adds
socket.AF_UNIX for the owner-terminal and refused-before-open tests; the
gateway call is faked or refused in each, so no socket is opened. The
native-Windows test still removes it again.

Part of #27903

---------

Co-authored-by: Matt Briones <mdbrio@amazon.com>

* feat(linux): add AppImage desktop integration (#9931)

Install the bundled freedesktop launcher and hicolor icons when a Linux AppImage starts, and repair only files whose private manifest provenance still matches.

Run synchronous reconciliation in a worker thread so packaged-Python metadata checks never block Electron main. Give AppImage launchers desktop IDs distinct from deb and rpm, and scope spaced display names plus the seven-size nightly icon tree to AppImage packaging so package-installed behavior stays unchanged.

Keep the hash, hard-link, POSIX metadata, xattr, ACL, durability, and concurrent-writer protections. Cover worker failure containment, main-thread responsiveness, package target naming, ownership, and recovery behavior.

Fixes #9930

Co-authored-by: Josh Kiepert <jkiepert@amazon.com>

* fix(desktop): do not respawn into a port netstat lists no owner for while a bind is refused (#29050)

On Windows, wedge recovery and Force-stop & Retry no longer read an empty
netstat answer as "the port is free". They check it with a real loopback
bind first. A refused bind is retried every second for up to the Windows
gateway start budget (WINDOWS_LOCAL_GATEWAY_WAIT_MS, 120 s) while the
loading screen shows, because a gateway that served connections leaves its
port refusing binds for a while after it exits. Recovery respawns as soon
as the bind succeeds; only a port still refused at the end gets the
existing restart-required dialog. A port netstat lists an owner for is
handled as before.

Closes #28268

* fix(dashboard-verify): autouse fixture in shared conftest drains verify slot (#29244)

When asyncio.wait_for times out on asyncio.to_thread(verify_package_page),
the OS thread keeps running and removes the browser profile in _drive's
finally block before _SLOT.release(). The test session's
KIROCREW_TMP_RESIDUE_STRICT check fires at session teardown and can see
the profile dir if the thread has not yet reached its finally.

Fix: add one autouse sync fixture _drain_dashboard_verify_slot in
test/conftest.py. After yield, the fixture checks sys.modules for
kiro_crew.dashboard_verify (free when never imported), and if _SLOT is
locked waits with wait_until() until it unlocks. This covers every test
in the repo that exercises the save/snapshot/verify paths, including
test_dashboard_save_tool*.py, test_dashboard_snapshot.py,
test_dashboard_verify.py, test_agent_panel_routes_dashboard.py,
test_agent_panel_routes_page.py, test_dashboard_preview_keep.py,
test_dashboard_gallery_approvals.py, test_session_dashboard.py and
test_change_cards_settings.py. The ~34k tests that never import
dashboard_verify pay no cost.

No production code change.

Co-authored-by: CrysisDeu <crysisdeu@users.noreply.github.com>

* fix(onboarding): import each Hermes profile's cron jobs in that profile's timezone (#29409)

The Hermes adapter read every profile's config.yaml but used the first
timezone it found for all cron jobs. A profile's job with no zone of its
own then ran on the root profile's clock, or borrowed a sibling profile's
zone instead of being reported as needing one.

Each Hermes profile is its own home with its own config. The scan now
keeps each profile's parsed config beside it and fills a job's missing
timezone only from its own profile's config.

Closes #29408

* fix(mcp-gateway): withhold a crewmate stub once its entry is registry (#29419)

The crewmate overlay is the last pass's. When a crewmate's server is
retyped `type: registry` after that pass, a KAS worker that starts
before the next pass still got the old local stub: worker_overlay_spec
and withdrawn_worker_stubs checked only for a dropped or muted entry.
The KAS custom-agent projection already withholds a registry-marked
entry, so the session-level injection launched a local backend the
projection refused.

Both checks now also read mcp_entry_is_registry_governed on the
governed merged entry, so such a stub is neither injected nor kept.

* docs: add a user-visible behavior bucket to the host contract (#29280)

Add bucket 10 to agent-host-contract.md: one row per behavior a person
sees in Crew, a column per harness (ok / gap / n/a / unknown) and the
test that pins each row. Seeded from the fixes first made on KAS, so
each harness can be compared against the others without reading the
plumbing.

Part of #29275.

* fix(instances): name the unreachable pane port when a remote crew pane times out (#29349)

Co-authored-by: w <w@k.local>

* fix(prepare-pr): let pre_push_gate.py run git status on Windows (#29421)

os.devnull is the nul device on Windows, and git refuses a device as
core.excludesFile, so every git status exited 128 before any gate ran.
Override with the empty value instead: git skips an excludes path it
cannot open on every OS, and -c still beats a hostile excludes file.

Fixes #29344

Co-authored-by: Zezhen Xu <zezhexu@amazon.com>

* fix(web): give the workflow library load failure a retry and a hand-off (#29164)

A failed workflow-definitions list read rendered a bare text-danger
paragraph: no role=alert (assistive tech never announced it), no retry,
and no agent hand-off. Render it through ErrorNotice (role=alert + the
hand-off, safe because the list read holds no draft) with a Retry button
that refetches the query. Adds the workflowLibrary.retry string and its
pseudolocale entry.

The retry test asserts the list re-renders after a successful refetch by
the list ROW (a button), not a bare text match: once a definition loads
the detail pane auto-selects it and renders its name again in a heading,
so a plain findByText would match two nodes.

Before/after screenshots committed under temp-screenshots/29162/.

* test(linux): skip lease-held publish checks where the kernel refuses write leases (#29444)

* test(linux): skip lease-held publish checks where a hard-linked inode cannot be leased

Two real-filesystem tests for the AppImage desktop integration have
failed on the CodeBuild Linux runner on every main run since the
integration landed. Both stop at the first assertion that needs a
published update, with the module result
{"skipped":true,"reason":"launcher customized"}.

Diagnostic runs on that runner showed no fingerprint mismatch: the
manifest's recorded hash, dev, ino, mode, uid, gid, mtime and xattr
digest all matched the live launcher. The packaged helper returned
"busy" from publish, because F_SETLEASE F_WRLCK on the launcher inode
failed with EAGAIN. A scan of /proc/*/fd found no process holding the
inode, and the lease was still refused after 0.5 s and 2.5 s, on both
the public name and its anchor hard link. A freshly written file with
one name was granted the lease. The runner has kernel
4.14.355-287.756.amzn2 with an overlayfs root. The module treats a
refused lease as "keep the old file", so the update is preserved and
reported as customized, as designed.

The shared probe now repeats the module's own sequence on a scratch
file: Node writes and closes it, hard-links it to a second name, and a
separate interpreter reopens each name O_RDWR and asks for the lease.
When the host refuses it, the publish part of each test is skipped
with the errno in the reason; the ENOTSUP fingerprint assertions
before it still run. Where the lease is granted, both tests run
unchanged. Replacing the helper's lease call with a refusal turns both
tests red on such a host. The two publish assertions now print the
integration result, so a failure names the reason it got.

Fixes #29439

* test(linux): assert the busy deferral where the host refuses write leases

The previous commit skipped the publish half of two real-filesystem
tests on hosts that refuse F_SETLEASE F_WRLCK on a hard-linked inode,
such as the CodeBuild Linux runner. A skip leaves those hosts checking
nothing, so the tests now assert the module's fail-safe there instead.

On a lease-refusing host each managed update must report the launcher
as preserved ("launcher customized" with the "changed during
reconciliation; preserving it" note), every lease-held publish run must
answer "busy", the launcher and its anchor hard link must keep the same
bytes, inode, link count, mode and mtime, and no displaced name may
appear beside them. The ENOTSUP test still runs its fingerprint
assertions first. The open-descriptor test keeps its descriptor-held
deferral check on every host, then checks two more launches with the
descriptor closed and confirms no recovery record is ever written.
Where the lease is granted, both tests run their full publish,
recovery and cleanup assertions as before.

Verified locally by simulating the runner: the probe reports a refusal
and the packaged helper refuses any lease on an inode with more than one
link. All 91 linux-desktop-integration tests pass that way and on the
unmodified host. Making the module overwrite the launcher, or replace
its inode with identical bytes, after a busy publish (only once no
descriptor holds it) turns both tests red at the snapshot comparison.

Refs #29439

* fix(workflows): count only calls that did not fail as preserved results (#25972)

When a workflow run fails or is cancelled, its completion message and
workflow_status say how many agent results were preserved. RunHandle.snapshot
counted every entry in agent_results, but a failed call also keeps an entry
there (None, kept for the resume cache) beside its reason in agent_errors. A run
whose 3 calls all failed was reported as "3 agent result(s) ... preserved" right
above "3 agent call(s) failed", and all 3 "results" were null. The preserved
count and partial_results now cover only the calls with no recorded failure.
The stored agent_results, which reruns replay, and a finished run's per-call
record are unchanged.

Closes #25969

* docs(decisions): record that kas sign-ins stay stored when off (#28914)

A new decision entry supersedes the 2026-11-02 KAS sign-in entry,
which is immutable. Turning agent.kas_persist_mcp_sign_in off stops
KAS from using the stored grants but does not erase them, because
silently wiping logins would confuse users; erasing stays a manual
step. The entry also corrects where a stored false comes from: the
Settings page and kirocrew config set write only the key being set,
and only kirocrew config edit on a home with no config.json writes
every default.

* test(agent): give weak runtime and session tests real outcome checks (#29263)

ACP, session, KAS, subagent, stop, spec, cloud and AI spine tests that
only called a mock now read a real result: a stored audit row, a
session handle field, a conversation log, a lease or record on disk,
or a return value. Each counted fix fails against a bug planted in
src/. No source code changes.

Refs #25195

Co-authored-by: zejiangg <zejiangg@amazon.com>

* test(cron): give weak cron, dashboard and memory tests real outcome checks (#29438)

Cron, dashboard, chat, history, lesson, knowledge, review, memory and
notification tests that only called a mock now read a real result: a
stored job or store row, a file the code wrote, a real lock, a real
chat slot, or a return value. Each counted fix fails against a bug
planted in src/. No source code changes.

Refs #25195

Co-authored-by: zejiangg <zejiangg@amazon.com>

* feat(remote-dispatch): retire a binding whose crew stays down, fence it, redispatch elsewhere (wave 8a) (#26956)

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* docs(dashboard): shorten long comments and docstrings (#29022)

Co-authored-by: zejiangg <zejiangg@amazon.com>

* feat(dashboard): fade the Agent Templates list bottom while rows sit below (#29405)

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>

* docs(rfc): context caps trim only on a cold cache (owner ruling 2026-11-03) (#29401)

Records the owner's 2026-11-03 ruling in both context-cap RFCs: a warm prompt
cache is never trimmed, conductors included. The conductor cap loses Rule A
(over 400K whatever the cache); Rule B (over 200K once the previous turn ended
300 s or more ago) is its only trim. The worker cap is accepted as amended:
cold-only over 300K, its own switch session.worker_context_cap default off,
and the conductor's seed with a tool-result pointer list.

Both RFCs record the new risk (a warm chat can grow past 400K until its cache
expires or KAS compacts at 80%) and the offline replay of 2026-11-01 to
2026-11-03. The conductor RFC moves to partial (phase 1 is on main), the
worker RFC to accepted. The implementation is #29388.

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* docs(harness): name pi 1.4.0 in the specs and set-model in the steering fixture row (#29399)

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>

* perf(models): check kiro sign-in only right before the list-models spawn (#29389)

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* perf(artifacts): cache only changed paths for the session-docs scan (#29382)

The session-docs list walks every session through read_file_change_messages.
Its cache kept each file change whole (before/after bodies) and held 256
sessions, so on a larger store the walk evicted every entry before reuse and
each call re-read every session file.

Keep only the string path of each change and size the cache by
_METADATA_CACHE_MAX so it covers the store. Output is unchanged.

Closes #29379

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* fix(acp): defer Crew tools under kiro-cli 3.x's single-binary install (#29375)

From 3.0.0 kiro-cli ships no launcher: the POSIX install is one kiro-cli,
the chat binary itself, with no kiro-cli-chat beside it. The deferral gate
read that shape as the old launcher that execs a PATH kiro-cli-chat, so
every Crew MCP server stayed resident on every request.

A sibling-less kiro-cli now defers when the pinned binary itself reports
3.0.0 or later. A 2.x or unknown version keeps the servers resident as
before.

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* fix(hooks): admit Unicode letters and digits in Windows hook paths (#29374)

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>

* fix(cron): refuse a command cron on Windows when it is created (#29366)

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>

* feat(dashboard): draw the warm welcome's link row as the chat's PR pills (#29364)

Refs #29285

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* perf(crew-board): redact each distinct string once per board reply (#29333)

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* fix(crew): say why a quiet task waits instead of a bare "stalled" (#29292)

The Ultra Mode Board and the goal-board page called every quiet open task
"stalled". Now each row says why: Stuck (red) only when nothing is left
to move it (its chat closed, or no main chat reads its reports); Quiet
(amber) when the ledger's stale flag holds on an open chat, so nothing is
scheduled to wake it but it can be resumed; Waiting names the PR it
reported, else its own words, else "Paused, no reason given". A blocked
report on goal-board reads "is blocked", so "stuck" means one thing.
All locales updated.

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* feat(enterprise): KAS is the default agent harness and the agent_backend floor (#29284)

* feat(enterprise): KAS is the default agent harness and the agent_backend floor

RFC rfc-crew-enterprise-edition.md D6. In an enterprise build:

- the agent_backend floor is KAS (governance_floor_backend), so no policy
  removes it; the oss floor stays the Kiro CLI harness;
- the built-in baseline allows only kas, so the Kiro CLI harness needs a
  remote rule;
- the gateway refuses to start when KAS is the harness and is proven unable
  to start on either route (enterprise_boot.require_kas_harness), naming the
  fix, instead of falling back to the Kiro CLI harness.

Closes #28616

* docs(harness-parity): allow refusing a KAS session KAS cannot start (D6)

In an enterprise build the gateway refuses a session whose resolved
backend is KAS when its boot proved KAS cannot start on the route it
would take (kiro-cli unable to run KAS, or no runnable engine bundle),
wherever that backend came from: agent.acp_backend,
agent.member_acp_backend, a crewmate pin or a spawn_run(backend=)
override. Record it in the harness-parity H1/H3 rule and the H1/H3 spec
rows. Anything that refuses or alters a session whose resolved backend
is Kiro CLI is still flagged.

Update governance.md from the pending note to the shipped behaviour.

Part of #28616

---------

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* feat(crew): keep the crewmate conductor in step with the root conductor (#27976)

The crewmate's conductor copied the root conductor's patrol paragraph
into crewmate_prompts.json, so a later change to the root charter would
reach Crew Mode chats and silently skip every crewmate.

The rules both conductors need (dispatch steps 1, 3 and 4, bind before
seed, the work-ledger patrol, the interval band and renewal, acceptance,
act-by-status with the verdict, claimed PRs, close, and reading the
goal-conductor skill first) are now written once, in spec_prompts.py
_LEDGER_CONDUCTOR_RULES. _CONDUCTOR_SYSTEM_PROMPT is assembled from
_CONDUCTOR_PROMPT_SECTIONS, byte-identical to before, and
conductor.patrol names each rule as a placeholder that
member.ledger_rules_block fills.

test_mate_conductor_parity.py fails when a root charter section is
neither a shared rule nor allowlisted with a reason, when a crewmate
piece copies root charter text, when the effective root conductor has
a server, tool, grant or mapped skill the effective crewmate conductor
lacks and the allowlist does not name, or when an allowlist entry is
stale. Effective means the installed spec put through the per-session
projection (kas_agents.to_client_custom_agent), which adds a crewmate
thread's session-level dashboard and panel servers and their grants.
crew-mode.md states the rule.

Also carries the two fixes this branch needs because it stacks the
ledger mount on the ledger prompt: three mate conductor tests that
assumed no mount, and the re-pinned mate conductor spec digests.

Part of #27930

Co-authored-by: cixuuz <26782336+cixuuz@users.noreply.github.com>

* fix(issue-radar): keep a crew's failure stand-down from being revived (#21919)

* fix(issue-radar): keep a crew's failure stand-down from being revived

An Issue Radar crew's autonudge loop stands down after five cycles in a
row that fail (a spent usage limit, a backend error after retries) or
never get a session. The crew watchdog then switched it back on during
its next pass: update(active=True) is a revival, which zeroes the
failure streak, so the loop failed five more turns, stood down again,
and was revived again for as long as the gateway ran.

The watchdog now leaves a stood-down loop alone. It pauses the crew
with a reason the crew page shows, which also revokes its unattended
grant through the existing re-read, and removes the spent loop so that
Resume relaunches the crew with a fresh streak. Any other inactive loop
is still switched back on.

Ported onto the crew_runtime split (#21107): the change now lives in
crew_runtime_supervision.py, and the crew_runtime facade's manifest
names the new owner symbols and the two reason constants it serves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit a74cb9bd2198ce938693b79d31f0000eec5e7166)

* test(issue-radar): drive the stand-down tick through the timer seam

The stood-down-loop tests patched asyncio.sleep to run the stand-down
tick at once, a stdlib clock patch the flake ratchet rules out. They now
re-arm the loop's own timer at delay 0 and await it, the seam the
autonudge suite uses.

Their teardown also left work that writes under the temporary store
running when the directory was removed, which Windows refused with
WinError 32. Teardown now awaits the detached persists, stops the
service, and awaits the cancelled timers and reconciler first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 00af3c81c3d6a668389c93b73a4b2a3cba5fc284)

---------

Co-authored-by: Leon <leon.lai.yc@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcp): never run the registry reachability whoami on an event loop thread (#29431)

On a thread running an event loop, registry_governance_known_unreachable
now answers from the cached verdict for the current sign-in fingerprint,
or doubt (keep the registry marker), and warms the cache on a daemon
thread. It never runs kiro-cli whoami there and never waits for the
probe's lock. Off the loop the probe is unchanged.

Fixes #29321

Co-authored-by: Zezhen Xu <zezhexu@amazon.com>

* docs(rfc): record Phase 0 verdicts for session-keyed scratch (#29422)

* fix(docker): move kiro-cli into /usr/local/bin when the installer picks ~/.local/bin (#29341)

* ci: stop the GPT lane's blocked-push count at the threshold it needs (#29305)

The push-budget step in codex-review.yml ran _review_pushes.py to completion
on every GPT 6.1 Review run. That reads the PR timeline and then the check
runs of every head the PR has ever had, so a long-lived PR paid dozens of
REST calls per review from the repository's shared GITHUB_TOKEN quota (61
for one PR with 36 blocked pushes). The section only needs to know whether
the count reached PUSH_BUDGET_MIN.

_review_pushes.py's entry point now reads REVIEW_PUSHES_STOP_AT and passes
it as stop_at, which blocked_push_count already supported, and the lane sets
it to PUSH_BUDGET_MIN. The prompt says "at least N". An environment variable
rather than a flag, because the lane stages the script from the PR's base:
an older base ignores the variable and counts in full. pr_findings.py
--rounds and sweep_check.py are unchanged and still count in full.

Part of #28761

Co-authored-by: sim <a@b.c>

* fix(dashboard): keep the Services search and staged MCP changes across a trip to a chat (#29273)

* fix(dashboard): keep the Services search and staged MCP changes across a trip to a chat

Opening a chat unmounts Customize, so the Services search text and the MCP
Servers changes staged for Apply were dropped on the way back. Both now live
in sessionStorage for the browser tab.

Closes #25962

* fix(dashboard): clear only the submitted MCP draft on Apply and drop no-op staged entries

An Apply that finished after Customize unmounted left the applied changes in
sessionStorage, so they came back as staged. Apply now empties the stored copy
when it still holds the draft it submitted, so a change staged on a later
visit survives; Discard always empties it. Staged entries the saved config
already matches, or whose server is gone, are dropped once the list loads.
The hook moves to website/src/hooks.

* fix(scratch): fall back when the scratch root override cannot be stat'ed (#28636)

* fix(dashboard): retire an orphan unread watermark once the gateway confirms it (#28709)

* fix(dashboard): an idle read retires an orphan shared unread watermark

A shared unread watermark newer than every saved row can never be
covered by any read. Builds before #15014 minted such watermarks: they
named a turn's `done` row that a gateway restart then dropped, and the
`mc-unread-shared` record they wrote outlives the upgrade. Every local
read kept the record (markSlotRead ignored the surviving watermark),
every relayed read re-lit the badge (remoteSlotRead adopts the
survivor), and every reload restored it (restoreUnreadBadges), so the
dot came back forever.

When a slot is idle (`running: false`) its last_ts is the newest row
that exists, so a read that cannot cover the persisted watermark proves
the watermark names a row the gateway no longer serves: retire the
shared record entry, and the badge dies with the row it references. A
running (or unknown) slot keeps the survivor: the lag-window protection
is untouched, because mid-turn a last_ts legitimately trails rows the
window has not been pushed yet.

Fixes #19688

* fix(dashboard): confirm an orphan unread watermark with the gateway before retiring it

The first commit retired an uncovered shared watermark when this window's
own slot row looked idle and live. A window can look live and still lag a
sibling that just watermarked a real reply, so it could delete that
sibling's badge.

Now a read that leaves an uncovered watermark asks the gateway for a fresh
slot list, issued after the watermark is read. A real reply is a saved row
the gateway already holds, so its last_ts covers the watermark and the
record stays. Only a watermark newer than every saved row of an idle
session is removed, and only if the record still holds that same value.
The slotsLive flag is no longer needed and is gone.

Co-authored-by: akushonkamen <akushonkamen@163.com>

---------

Co-authored-by: akushonkamen <akushonkamen@163.com>

* docs: document Windows proxy workaround for missing Claude models (#24473)

Added troubleshooting steps for missing Claude models on Windows when using a proxy, including environment variable configuration and a workaround.

* fix(i18n): route usage, size and turn-cost labels through shared formatters (#28778)

Several dashboard labels built numbers by hand: token counts as an
English K/M ladder, the API time as "125.0s", the Overview Today line
glued from fragments ("1 sessions"), file sizes as 1024-based "KB", and
the chat turn-stats line with an English "credits" word and a hand-built
"$" cost. They read wrong in English and cannot be translated.

Each label goes through the shared helpers instead: fmtCompact for
token counts, fmtElapsed for the API time, fmtBytes for sizes, and
formatCost for dollar costs. The Today line is one catalog phrase with
plural count keys, and the turn credits word is a catalog key, in all
twelve shipped languages.

* feat(dashboard): draw Explore as one panel with a header that owns its close (#28527)

* fix(notes): guard note saves with a content hash as well as mtime (#22790)

* fix(notes): guard note saves with a content hash as well as mtime

The Notes save guard compared only modification times, so an external
write that kept the mtime (os.utime, rsync -t, coarse-timestamp
filesystems, two writes in one millisecond) passed the check and was
silently overwritten by a stale buffer.

GET /api/note now returns contentHash, the SHA-256 of the exact bytes
the returned content came from, and PUT /api/note accepts it back as
baseHash. When sent, the hash alone decides freshness, everywhere the
mtime check ran, including before each contended-rename retry. Saves
without baseHash keep the mtime-only behaviour; tokenless saves sample
a hash too. Successful saves and 409 conflicts return contentHash, and
the editor stores and sends it, including from the conflict banner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(notes): report a note deleted mid hash check as the deleted conflict

When a baseHash save's check saw the note on its stat but the note was
deleted before the read, the save answered 404 no_such_note instead of
the 409 ESTALE with mtime -1 that a deletion gets everywhere else. The
editor recovered on the next save, but showed a generic error first.

A read that finds nothing now re-checks whether the note exists and
reports the deletion as the usual conflict. A hash mismatch also hands
the bytes it compared to the 409 instead of reading the note again.

The server facade's forwarded-names manifest now lists the new
server_paths helpers, and the test patches read_note_snapshot through
the facade, as the facade mirror guards require.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* fix(apps): read rc and v-prefixed versions when checking for updates (#29062)

_version_newer kept its own split("-") parser, so an insider build
(0.4.0rc3, PEP 440 with no separator) or a v-prefixed version failed
to parse and was never "older": the update badge and notice never
showed for them. It compares through apps.version.parse_version, the
parser check_min_version already uses, and still treats a string that
is not a whole version (1.0.0 <b>, latest) as never newer.

* fix(whatsapp): count a mention or quote on a media caption as addressed (#28872)

In a group in mention mode, _is_addressed read contextInfo only from
extendedTextMessage, so an @-mention of the agent or a quote-reply to
its message typed as the caption of a photo, video or file read as not
addressed and the agent stayed silent. It now reads the contextInfo of
the image, video and document submessages too, checking each, since a
protobuf returns an empty default for an absent submessage.

* fix(i18n): keep the provider, author and actor names inside their sentence (#29187)

* fix(i18n): pass counts into the catalog on glued count labels (#28284)

PR check group headings, the skipped-check tail, the knowledge graph
and picker totals, the JSON and JSONL preview counts and row cap, the
resolved-comments toggle and the logs match count glued a number in
front of a translated fragment, or used English outright. No catalog
could place the number or pick a plural form. Each label is one key
with a count, with plural forms per locale, and the fragment keys it
replaces are dropped from every catalog.

* fix(context): headless task, planner and workflow turns are non-interactive and window-sized (#25084)

* feat(remote-dispatch): Feature Previews switch for work_ledger.remote_dispatch; hide work-item routes while off (#27564)

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* docs(slack): shorten long comments and docstrings (#29489)

Co-authored-by: zejiangg <zejiangg@amazon.com>

* fix(crew): start a Mate whose absolute resource resolves outside home (#28675)

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* fix(apps): show a built-in app skipped at boot as unavailable (#25565)

When boot skips a built-in app whose files cannot be read, record the
skip on the application. GET /api/apps and GET /api/apps/{name} stamp
unavailable with the redacted reason on that built-in record, and the
Library tile and the detail page show it as unavailable instead of as a
working app.

Fixes #25322

Co-authored-by: Zezhen Xu <zezhexu@amazon.com>

* fix(crew): goal-board shows a task stuck when its main chat closed (#29339) (#29484)

The Crew panel calls an open task "Stuck · the main chat closed" when its
conductor's chat is gone (the ledger is orphaned). The goal-board page
showed the same task as quiet or waiting, because `with_worker_facts`
stamped only `worker` and `stale`.

`page_safe_for` now takes the slot the page's folds are read from, and
`with_worker_facts` stamps `orphaned` with `work_ledger.is_orphaned` over
whether that slot is still open, the Crew panel's own read. The template's
`view()` makes an orphaned open report (progress / blocked / question)
stuck after needs-you and working, as the Crew panel does, and its pill
reuses the panel's wording. Without a slot nothing is stamped, so the
page keeps its old rule.

Fixes #29339

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* docs(goal-conductor): how remote dispatch works under work_ledger.remote_dispatch (wave 9) (#29479)

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* docs(goal-conductor): ask when 'discuss' is ambiguous; wrap up a debate when only small fixes remain (#29475)

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>

* docs(rfc): a crewmate's harness follows Settings -> Agent Harness when unset (#29442)

Co-authored-by: Joe Guo <zejiangg@amazon.com>

* fix(kas): let an agent whose allowedTools names the shell run past denyByDefault (#29440)

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>

* fix(security): retry a denylist read that meets a concurrent replace (#28017)

On Windows a read of denied_commands.json during _write_denied_state's
replace fails with a sharing violation, and the tolerant reader folded
it into {}. The user-rule toggle and delete pre-checks then answered
404 unknown user rule for a rule that exists. Both denylist readers now
read through read_bytes_with_retry.

Fixes #27875

Co-authored-by: Zezhen Xu <zezhexu@amazon.com>

* fix(decisions): bound Plumb and Laya CPU use like the Strands launcher (#24679)

* fix(decisions): bound Plumb and Laya CPU use like the Strands launcher

The Plumb-4B and Laya launchers let torch use every core and queued every
decision behind the one in progress, so a burst of decisions kept the
machine at full load computing answers whose callers had already given up.

Both launchers now cap torch at half the CPUs the process may use (at
most 16, one inter-op thread), set before torch loads, and admit one
decision at a time: a decision that cannot start within 1 s is answered
503, which the gate already treats as a provider error and falls back
from. Other routes (health, attestation) are not gated. This matches the
Strands Decider launcher's bounds from #17618.

Fixes #24577

* test(decisions): drive the Plumb late-body test by a stepped clock

The test moved past the body deadline with fixed sleeps, so its result
depended on when the server thread started reading. It now advances the
handler's clock past the deadline once the handler has set it, then sends
the last byte.

---------

Co-authored-by: Matt Briones <mdbrio@amazon.com>

* fix(secrets): refuse authorize on Windows so no unusable grant is signed (#27994)

* fix(secrets): refuse authorize on Windows so no unusable grant is signed

On native Windows `kirocrew secrets authorize NAME URL` signed a custom-secret
policy and the Settings Secrets panel advertised that command, but
`call_api_with_secret` refuses every me…
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 5, 2026
@iamwhatever
iamwhatever force-pushed the fix/trim-cold-cache-only branch from 8b0e214 to 6259820 Compare November 5, 2026 17:28
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Dispositions for the review findings on 8b0e214, carried to head 6259820 (rebased on main after #29401 merged).

GPT 6.1 F2 (upheld): the 299.9 s case races the clock. Fixed. test_a_worker_trims_only_on_a_cold_cache_over_300k now pins _context_cap_idle_secs to the case value, so a slow runner cannot push 299.9 s past 300 s. The real clock read stays covered by test_the_clock_is_the_previous_turns_release_not_its_acquire, which drives SessionManager.release.

GPT 6.1 F1 (downgraded): lookups skip size-rotation archives. Not changed. The pointer list and the lookup read the same live chain (build_tool_pointers in src/kiro_crew/context.py and _get_tool_call_output in src/kiro_crew/mcp_tools/sessions.py both call the chained read), so every id the seed hands out names a row the lookup can find. A miss needs the transcript to pass the 10 MiB rotation budget between the trim and the lookup; the reply is then an honest "No tool call with that tool_call_id", and the model can re-run the read. Reading archives too would add a new privacy-guarded full-chain read for a rare case.

Design note 1: watch compactions once Rule A is gone. Agreed, and recorded as a risk in rfc-conductor-context-cap.md (#29401). In the 2026-11-01..03 replay no conductor turn started over 400K on a warm cache; the largest conductor context under the cold-only rule was 391K.

Design note 2: the note names a list that a failed pointer read leaves out. Accepted as is. The read fails only if the transcript read raises, which the seed already logs; the model then gets "No tool call" for any guess and falls back to re-reading, as the note also says. Not worth another CI round on its own.

No override is requested.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 5, 2026
@iamwhatever
iamwhatever force-pushed the fix/trim-cold-cache-only branch from 6259820 to 2a528a2 Compare November 5, 2026 17:47
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 5, 2026
@iamwhatever
iamwhatever force-pushed the fix/trim-cold-cache-only branch from 2a528a2 to 683a144 Compare November 5, 2026 18:03
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Opus 5.5 blocking finding on 2a528a2 (sessions.py:695, tool output returned at full length): fixed in 683a144.

_get_tool_call_output now cuts the reply to TOOL_CALL_OUTPUT_MAX_CHARS (8,000, one constant also used in the schema text) and appends …[N more chars not shown] before redaction. Test: test_a_large_tool_output_is_cut_to_the_promised_length stores a 20,004-char output and asserts 8,000 chars plus the marker come back, and the tail does not.

Context: on this host the ACP layer already cuts stored outputs at 8,000 (181,590 transcript tool rows checked, max 8,000), but storage itself allows _MAX_TOOL_FIELD = 1_000_000, so the cut belongs in the read.

@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Nov 5, 2026
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 17, 2026
@iamwhatever

iamwhatever commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: no

  • span=e1d8aa3dccb4 Tool-result lookup excludes retained rotation archives

fixed in afd4de7: _get_tool_call_output reads derive_messages_chained_full_with_keys (same lock, chain check and incognito refusal, plus each key's rotated archive); output cap and redaction unchanged.
Same class, second site: build_tool_pointers reads read_messages_chained_full, so the list and the lookup see the same rows.
Test: test_a_rotated_tool_result_is_still_listed_and_fetched (red on the parent, green on the fix).

@iamwhatever

iamwhatever commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: no

  • span=5334aced0dd7 approved tool calls show up twice in the trimmed seed's tool-result list

fixed in afd4de7: tool_pointer_text keeps one line per tool_call_id (the newest row) before the 100-row cap and the dropped count.
Test: test_an_approved_call_is_listed_once (101 ids with two rows each list ids 1-100 and say 1 older; red on the parent, green on the fix).

@iamwhatever
iamwhatever force-pushed the fix/trim-cold-cache-only branch from c69facd to afd4de7 Compare November 17, 2026 08:44
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Note on the two dispositions above (spans e1d8aa3dccb4 and 5334aced0dd7): the fixes were rebased onto main 5c747a0 before the push, so the pushed head that carries them is afd4de7, not fe98b33d3b72.

…ol-result pointers

A warm prompt cache is never trimmed, for conductors and workers. The
conductor cap loses Rule A (over 400K whatever the cache); Rule B (over 200K
once the previous turn ended 300 s or more ago) is its only trim. A
dispatched worker (kirocrew-worker) gets the same cold-only check over 300K
behind a new session.worker_context_cap setting, default off.

A trimmed session's seed now lists each stored tool result as one line
(tool_call_id | tool | args | size), and get_chat_session takes an optional
tool_call_id that returns that one call's stored output. The trim note no
longer says get_chat_session reads tool output back without it; it says to
re-read files and fetch other output by tool_call_id.

The decision is recorded in rfc-conductor-context-cap.md and
rfc-worker-context-cap.md by #29401.
@iamwhatever
iamwhatever force-pushed the fix/trim-cold-cache-only branch from afd4de7 to b961894 Compare November 17, 2026 09:20
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Backend Tests (3.12, 3) on afd4de7 was ours: test_transcript_derivation_seam.py flagged a plain read_messages_chained_full in context.py. Fixed in b961894: build_tool_pointers now reads through the guarded derive_messages_chained_full_with_keys (rotated archives included), and a private or busy transcript lists no pointers. New test: test_a_private_transcript_lists_no_pointers.

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

Copy link
Copy Markdown
Contributor Author

@bolichen97 Review-ready at b961894 (one commit on main 5c747a0). All 98 checks are green and readiness is passed. GPT, Opus, Design and First Principles have no blocking findings on this head.

Since your review: the tool_call_id regex is now a fixed-character-set custom_validator. Two new reviewer findings are fixed: the lookup and the pointer list read rotated archives, and an approved call is listed once. The pointer list reads through the guarded derivation seam, so a private transcript lists none. Each fix has a test. Could you re-review? Your CHANGES_REQUESTED is the last thing open.

@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

A maintainer review earlier on this PR signed off the design, so the PR now waits for a maintainer approval. The one requested change is fixed on this head. The tool_call_id regex is gone, and _validate_get_chat_session now checks each character against a fixed frozenset. The reviewer who asked for that change has not re-reviewed yet.

The review found no blocking issues on b961894. What it checked:

  • Rule A is gone, and no code still references CONTEXT_CAP_HIGH_TOKENS. The cap picks its switch by positive agent identity. Conductors use context_cap at 200K. kirocrew-worker uses worker_context_cap at 300K, which is off by default. Every other agent is out of scope.
  • The pointer list and the tool_call_id fetch read the same guarded derivation seam, rotated archives included. So every listed id can be fetched, and a transcript made private is refused. Pointer text is capped and redacted. Fetched output is cut to 8,000 chars and redacted again.
  • The tool_call_id branch runs only after the existing key, incognito and workspace gates.
  • The new tests pass at this head, and the behaviour tests fail against main's code. So the tests pin the change.

Done well: the body backs the default change with an offline replay over real transcripts. The Reader lines also name the exact tests that pin the Rule A removal.

Optional:

  • mcp_tools/sessions.py:447: tool_call_id returns stored tool output from any session in the caller's workspace, and from any session at all with all_workspaces. It does not stop at the trimmed chat's own session. If the goal only needs a chat to read its own results, refuse the call unless the key matches the caller's session key. If cross-session reads are intended, please say so in the body, because this changes what an existing read tool returns.
  • No test covers the workspace gate or the crew refusal on the tool_call_id path. Removing either one keeps the suite green. Two tests would pin them: one with a tool row in another workspace's session, and one calling with both crew and tool_call_id. Also, the crew refusal at line 393 returns without writing a SEL audit row.
  • Two docs go stale when this merges. docs/system-specs/modules/history.md still says get_chat_session reads one full transcript. The status line in docs/request-for-change/rfc-conductor-context-cap.md says main keeps Rule A.

@kyleseaman
kyleseaman enabled auto-merge (squash) November 17, 2026 14: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: passed Eligible automated validation passed for the current revision readiness: checking Automated validation is still running labels Nov 17, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving b961894.

The one change I requested at 683a1447dd is done. src/kiro_crew/validation_parts/messaging_session_schemas.py:363 no longer carries a pattern=re.compile(...) for tool_call_id. The field keeps only max_len, and _validate_get_chat_session (:348-:353) checks each character against the fixed _TOOL_CALL_ID_CHARS frozenset at :345. An empty id is refused too. The regexes left in that file were all there before this PR, and the diff adds no other new regex.

What else changed since 683a1447dd, per git range-diff, and why it looks right:

  • src/kiro_crew/context.py:1314 and src/kiro_crew/mcp_tools/sessions.py:529 now read through derive_messages_chained_full_with_keys. The pointer list and the tool_call_id fetch therefore read the same guarded rows, rotated archives included. Every listed id can be fetched, and a transcript that is private or busy lists nothing and is refused. test_a_rotated_tool_result_is_still_listed_and_fetched and test_a_private_transcript_lists_no_pointers pin both.
  • src/kiro_crew/context_assembly/replay.py:528-:541 keys pointer rows by tool_call_id, so an approved call's two rows are listed once, at the newer position. test_an_approved_call_is_listed_once covers it.
  • The tool_call_id branch at mcp_tools/sessions.py:447 still runs after the key, incognito and workspace gates, and :393 refuses it with crew.

Ran test/test_conductor_context_cap.py, test/test_search_chat_history.py and test/test_validation_parts_facade.py on this head: 134 passed. All CI checks on this head are green.

Non-blocking: as the Captain notes, tool_call_id can read a stored tool output from any session the caller can already open with get_chat_session, not only its own trimmed chat. That matches what the message read already allows. A line in the description saying cross-session reads are intended would settle it.

AI-assisted, sent by Bolin Review bot

@bolichen97
bolichen97 merged commit a832580 into main Nov 17, 2026
100 of 101 checks passed
@bolichen97
bolichen97 deleted the fix/trim-cold-cache-only branch November 17, 2026 18:09
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants