Skip to content

merge: sync the fork with 259 upstream commits (2026-09-13) - #11

Merged
Premshay merged 270 commits into
mainfrom
integration/fork-main-origin-main-20260913
Sep 13, 2026
Merged

Premshay merged 270 commits into
mainfrom
integration/fork-main-origin-main-20260913

Conversation

@Premshay

Copy link
Copy Markdown
Owner

Syncs fork/main with upstream kirodotdev/KiroCrew main through b4ed39b.

Based on the deployed commit b4c62de, so it also carries the five settingSources / session-MCP gating commits already running live (fork/main was 5 behind the deployment).

What it brings

Fork work carried into upstream's new shapes

  • A Claude harness for AcpRuntime (acp/harness/claude.py), without which the fork's direct-runtime bindings (Sage, background) are refused by harness_for().
  • Hands-free dictation moved into upstream's Composer / useComposerVoice.
  • settingSources, session MCP gating and replayed-message fixes kept in AcpClient.

Follow-ups on the branch

Taken from upstream

Testing

Targeted suites for the merged areas (~12.3k Python tests, ~2k frontend tests, tsc -b) compared against both parents: no failures beyond those already failing on the fork base (127 Python / 39 frontend, which upstream passes — pre-existing fork test debt). Not deployed.

🤖 Generated with Claude Code

bolichen97 and others added 30 commits September 10, 2026 15:57
…otdev#9800)

A lone-surrogate identity.signature in a user-owned home file raised
UnicodeEncodeError out of _policy_signature_state -- a ValueError, not a
composition error -- so it escaped the loader and the host degraded to
ungoverned. The tier ladder verifies the home file beneath the central document
on every load, so one byte in that file removed the fleet ceiling. Encode with
surrogatepass; the verdict is an ordinary UNVERIFIED.

An unreadable home file beneath a present central document is now skipped with
one warning per process instead of raising: the authority governs unchanged (the
fail-closed direction), whereas the raise refused boot and rejected every
refresh -- an availability lever for whoever owns ~/.kiro/crew. With no
authority the file is the only ceiling and its error stays fatal.

Guide names the subordinate values that are kept only when the authority left
them empty (updates.source, channels.posture -- the latter tracked in kirodotdev#9798).
Stale pre-ladder precedence text in comments and docs reworded.

Co-authored-by: zejiangg <zejiangg@amazon.com>
…d slows patrol (kirodotdev#9943)

A draft pull request holds its checks incomplete on a repository that gates
readiness on draft state, so a pr_checks acceptance stays pending for as long as
the draft lasts. Both conductor skills now say the condition names a non-draft
PR and what the seed must carry.

A human_approval item is answered by a person reading an ask_question card, and
every patrol turn taken while that card is outstanding can push it out of view.
Patrol now slows to a 1800s interval until the answer arrives, and a report that
the card vanished is a re-issue rather than an answer. Known limits names the
displacement.

The ledger skill also names the accept_batch fields a conductor reads -
acceptance_concrete and the per-entry status - while keeping the filter-to-done
rule, which the server still does not do.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
Co-authored-by: Joe Guo <zejiangg@amazon.com>
…dotdev#9519)

* feat(sidebar): retire Crew Mode entry, route it to Crew Members

The create menu's "New Crew Mode chat" entry no longer creates a
`mode: 'crew'` session. It is now "Crew Members" — always rendered,
no experimental badge — and a door rather than a create action:
with PREVIEW_CREW on it opens /members; with it off it deep-links to
Settings > Developer > Feature Previews with the crew card ringed
(settingsPath + SETTINGS_CREW_MEMBERS_PREVIEW_ID), no toast.

The Feature Previews card now describes only the Crew Members page
(label "Crew Members", registry id developer.crew-members with the
old id mapped in LEGACY_ID_EXACT); its "See what it looks like"
dialog drops the create-menu GIF, since the menu entry is no longer
what the flag reveals. capture-feature-previews.mjs loses the GIF
step and two retired evidence scripts go with the badge/gate they
captured.

i18n: keys added in en.manual.json + 12 locales, dead keys removed
from all catalogs, en-XA regenerated.

Refs kirodotdev#9512

* refactor(chat): remove the Crew Mode runtime (kirodotdev#9533)

Crew Mode (`mode: "crew"` — one session fanning topics out to
sub-sessions through a durable queue and a decision agent) retired in
favour of the Crew Members page. PR kirodotdev#9519 replaced its ingress; this
removes what it ran on.

Backend: `crew_chat.py` (CrewStore + CrewOrchestrator) and its four
test modules are deleted; `state.crew`, the gateway's `_init_crew` and
subagent-completion hand-off, the api_chat crew dispatch branch, the
crew-capable-name gates on create/switch/auto-create, the history-delete
store purge, the session-control `crew_mode_target` refusal and the
`crew` containment-snapshot field all go with it. `"crew"` is dropped
from `_CREATABLE_MODES`, `_VALID_MODES` and the fork override allowlist.

Existing sessions: `chat_persistence._restored_mode` maps a persisted
`mode: "crew"` to plain chat on both restore paths. Transcripts are
untouched, nothing is migrated or deleted; the on-disk crew store is
left in place unread. `TurnBlock.isCrewReply` stays as read-only compat
so old forwarded answers still render outside the collapse pane.

Frontend: sidebar `Crew` badge, `isChatPageSurface('crew')`, the
`capture-crew-mode.mjs` evidence script, and the badge's three i18n keys
(all 13 catalogs + en-XA). Docs: crew-mode.md becomes the Crews spec
with a "Retired: Crew Mode" record; the orchestrator-chat-sessions RFC
is marked superseded; autopilot / session-control / instances / skill
docs stop naming the mode.

Left as-is on purpose: `autonudge_authz` still lists `"crew"` beside
`"member"` — unreachable now, and a security boundary is not the place
for a drive-by edit.

Refs kirodotdev#9512
…-and-divider style (kirodotdev#9933)

The Agent Template pane was the only crew-editor pane wrapped in its own bordered panel, with a dashed-underline selector and its own label and hint sizes. Align it to the shared pane vocabulary (option D of the design review): selector row stays a sticky header with one divider under it, standard bordered dropdown trigger, house field labels (11px / tracking-wider) and hints (11.5px / muted). Behavior is unchanged.
…hed (kirodotdev#9871)

Switching `agent.acp_backend` in Developer > Agent Backend left every model
picker showing the PREVIOUS backend's list until the gateway was restarted.
The server side never needed the restart: `GET /api/models` re-reads the
config on every call. Only the frontend cache did, because the
`['available-models']` query is refetched in exactly one other place -- a
spawned session (`useWebSocket`'s `activity_event` with `spawned: true`) --
and the app's global `staleTime: Infinity` plus the self-heal poll stopping
after one live success mean nothing else ever re-asks. A restart is just
the next session spawn, which is why it looked required.

Two changes:

- `AgentBackendTab`: on a SUCCESSFUL save, `resetQueries(['available-models'])`
  so every picker drops the old rows at once and refetches for the new
  backend. Reset rather than invalidate: invalidate keeps the old backend's
  rows on screen until the refetch lands, and a cold `--list-models` spawn
  can take the gateway's full 10s; a pick in that window writes an id the
  new backend rejects. A rejected PATCH leaves the list alone: the backend
  did not change, and `/api/models` spawns `kiro chat --list-models`, so
  refetching would run a subprocess for nothing.

- `acp.ts`: export `clearCachedModels()` and call it before the reset.
  The last-good localStorage list (`kc.acp.models.v1`) is keyed by nothing
  but time, so after a switch it still holds the old backend's ids. If the
  new backend's first `/api/models` fails, the degraded path would serve
  those ids. Dropping the cache makes the degraded answer auto-only, which
  every backend accepts, until the first live success rewrites it.

Tests: the reset + cache drop on success (old rows gone before any refetch),
no-op on a rejected save, and `clearCachedModels` making a failing fetch
degrade to auto-only instead of the stale list.

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>
…kirodotdev#9999)

A steer submitted while a chat chunk was still in useWebSocket's
per-animation-frame buffer found no streaming row in Redux, so
finalize-on-steer froze nothing: the pre-steer text later flushed below
the steer card and post-steer chunks appended to the same streaming row,
merging the two segments. Drain the buffer synchronously before every
steer insertion: the steer_push handler (observing tab) and the
optimistic dispatches in ChatPage and ChatPane (initiating tab), via a
module seam the hook registers its flush on.

Fixes kirodotdev#9977
…ev#9958)

react-markdown's defaultUrlTransform rewrites a destination outside its
scheme allowlist (or an empty one) to href="". The ChatPanel a override
forwarded it unconditionally, so the DOM got <a href="">: it painted as a
live link but did nothing on click, and Copy Link Address yielded the
current page URL. The override now branches on the href and renders a
plain span for a refused destination, matching md-notebook's Preview.
…s origin (kirodotdev#9686)

Two installs pointed at one AWS account share one drive by design -- discovery is
by tag -- but the archive keys carried no install identity, so an operator picked
an archive by timestamp and could replace this machine's memory with the other
machine's. Both installs also evaluated the nightly schedule from their own local
state and each concluded the nightly was theirs.

Archives are now keyed snapshots/<install>/... and sessions/<install>/... under a
random per-install id held in the app's own backup.json (minted locally, never
beacon.install_id(), which is the telemetry identity and only exists under
telemetry consent). The nested segment lets one delimited listing return every
install writing here as a folder and every pre-namespace archive as a file.

Each install publishes a human-readable label beside its own archives so a
co-tenant renders as a name rather than 32 hex characters. That label is
display-only: it is sanitised and length-bounded as foreign-authored text,
rendered in quotation marks so the self-asserted part looks self-asserted, and
read by nothing that decides. restore_download refuses an archive owned by
another install unless the request carries foreign_ok, keyed on the id in the
object key alone.

The nightly warns and proceeds rather than claiming ownership of the schedule:
with the keys namespaced there is nothing left to collide, and a single-owner
schedule would leave one machine silently un-backed-up.

Closes kirodotdev#9554
…v#9975)

AcpClient._turn_done is an asyncio.Event, which starts UNSET. has_active_turn()
reads `not _turn_done.is_set() and _is_process_alive()`, and is the 409
turn_in_flight gate on set-model / set-agent. A client whose process is alive
but that has never been prompted (eager spawn on a fresh chat) therefore
reported "A turn is running" and the user could not switch model until a real
turn's finally set the flag. No timeout ever cleared it.

Idle == done: set the Event at construction. Every prompt entry clear()s it
before sending, so a real turn still reads active.

_reset_state() no longer rebuilds the Event. The prompt entries clear() it
BEFORE ensure_ready(), and ensure_ready() reaches _reset_state() on the
dead-process respawn branch; rebuilding the Event there (set or unset) would
misreport the whole respawned turn -- set would let the shutdown drain kill the
replacement process mid-turn. The Event's state is the truth about the turn,
not the process, so it is kept as-is across a reset.

Only the Claude Code backend hits this path (one AcpClient per session);
kiro-cli/KAS run on AcpRuntime + AcpSessionHandle, whose _turn_done was
already set at construction.

Co-authored-by: zejiangg <zejiangg@amazon.com>
…re-pr pick the picture's form (kirodotdev#10002)

answer_only now classes a picture as payload, so the one-sentence bound no longer
reads as a ban on drawing. It ranks the form by what the surface renders, keyed on
the Inline Widgets section that _resolve_prompt_placeholders already withholds
off-dashboard, so a Slack-only session degrades to a mermaid fence or a table.

prepare-pr's Draw-it section keeps the hard constraints that make every PR body read
the same way (Before/After, the fixed four-colour palette, one picture, a caption,
placement, the render check) and drops the diagram-type whitelist and the pointer
into explain-for. Any Mermaid form GitHub renders is allowed, and a delta that is a
matrix of cases and verdicts is drawn as a markdown table.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
…ence (kirodotdev#9990)

The Available Skills index renders each skill as one line cut at 300
chars, and trigger matching is off by default, so a description whose
'use when / load this' sentence sits past the cut ships a routing rule no
agent reads. prepare-pr, babysit, goal-ledger-conductor, llm-council,
pipeline-conductor and security-conductor all had that shape; reorder
the sentence to the front and pin it with a guard test.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
An inbound WeCom media URL was vetted with `link_unfurl.vet_unfurl_url`,
which resolves the host and checks every answer, but the vet returned
only the normalized URL string. The fetch then went out on a shared
`aiohttp.ClientSession`, so aiohttp resolved the hostname AGAIN at
connect time -- a DNS-rebinding window in which an attacker-controlled
name server answers the vet with a public address and the connect with
`169.254.169.254`, and the response flows on into the attachment
pipeline.

`_vet_media_url` now returns the whole `VettedUrl`, and with no operator
`proxy` `download_media` opens its own one-request session on a pinned
connector, so the socket goes to an address that was checked. The
hostname still drives SNI and `Host`, so certificate validation is
unaffected. The status rules and the capped read moved into one inner
helper shared by both transports; the public signature is unchanged, so
`attachments.py` still supplies the session the proxied path uses.

The pin serves EVERY address the vet approved, not just the first.
`VettedUrl` gains `addresses`, the deduplicated set the vet resolved and
checked. A client dials a resolver's answers in turn, so a pin that
answers with one address turns a dead CDN node -- or an AAAA record on a
host with no working IPv6 route -- into a failed download that succeeded
before the pin existed. Every entry passed the same
internal-address check, so serving the whole set costs the vet nothing,
and `ip` stays the first address for callers that dial one.

The pin lives in `link_unfurl`, beside the vet whose result it serves,
because every caller of that vet needs it -- and `wecom` must not import
from `dashboard.handlers`, where the resolver used to be a private class.
`PinnedResolver` is the resolver; `pinned_connector(vetted)` is the one
place that spells out the connector it goes on. `limit=1` and
`family=AF_UNSPEC` are what make the pin hold, so a caller that copied
the resolver and dropped the family would re-open the window -- one
factory means no caller can. The link-preview handler takes its
connector from there too; behaviour is unchanged.

One residual remains, and by construction: under a configured proxy
aiohttp hands the proxy the hostname and performs no local lookup, so
there is no resolution for a pin to answer, and split-horizon DNS means
ours may not even match the proxy's. That path keeps the caller's
session and the rebinding window, documented at the vet and in the
messaging spec.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
…kirodotdev#9863)

`run_script_sandboxed` picked `"strict" if stdin_payload is not None else
"standard"`, so an ungranted script cron ran the WIDE profile while
`run_command_sandboxed` has always run `cc`. That inverted the two cron
spawn paths: a script body is agent-written and a command body is a fixed
string the vet already narrowed, so the higher-capability surface had the
looser sandbox. Under `standard` the child could read
`~/.aws/credentials`, the SSO cache, `~/.kube`, `~/.netrc`,
`~/.git-credentials`, `~/.npmrc` and `~/.pypirc`.

Align the two paths on `cc`. The shared `cc` profile is not touched: it is
the Claude Code provider's tier, and on macOS it deliberately leaves
`~/.aws` readable for that provider's Bedrock `credential_process` auth.
A cron borrowing the tier inherits that residual, which is the exposure
the command path has always had there; on Linux `cc` bind-mounts `.aws`
away for both paths.

A script that needs a host credential takes the route an operator already
approves per job: a vault `secret_env` grant, which runs `strict` and
injects the one approved secret instead of exposing a store.

`_vet_script_contents`'s docstring and the security spec described the old
tier; both now state what the code does.

Tests pin the ALIGNMENT rather than the literal tier, so a later change
that moves one path re-fails instead of silently reopening the gap.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
The poll tick decided inside its setState updater which pick was
abandoned and read that decision on the next line. React runs an updater
lazily whenever the hook already has an update queued, so that read saw
nothing and the overlay never received its `remove`: the page kept a
highlight for a pick the panel had already dropped, and the
WebPreviewPanel test for the abandoned pick fails on main.

The decision now lands in a ref the updater fills, and an effect sends
the `remove` after the commit that took the pick out of the list, so the
list, the count and the page highlight agree.
Give each Crew Member one owned private memory store. Follow that member
through private chat, Crew Mode delegation, Agent schedules and resumed
sessions. Refuse unavailable or mismatched private memory with a visible
reason. Keep Global V1 retrieval and automatic consolidation policies.

Refresh essential identity, Soul and applicable project guidance each turn.
Recall bounded facts and experiences using semantic and keyword evidence,
compatible embedding spaces and diversity selection. Keep V2 content without
age decay or automatic capacity eviction. Require owner review or verified
correction evidence for conflicting inferred updates.

Connect member avatars to private stores in the dashboard. Support explicit
inheritance with provenance, searchable records, previewed corrections and
forgetting, revision history, backups and restoration on restart. Preserve
V1 data and isolate member execution from other stores.

Run private MCP tools inside the member sandbox. Withhold shared broker
endpoints, refuse unsafe socket placement and unsupported private runtimes,
and preserve Global V1 broker routing.

Include regression coverage, real embedding evaluation, visual documentation,
screenshots and a synthetic-data walkthrough of the memory workflow.

Slim the delivery without changing Memory V2 behavior: drop superseded
CI evidence and unembedded captures, the committed Qwen bench snapshot,
the bench-only measurement CLIs, the compact-revisions CLI, never-shipped
schema-compat code, black-baseline reformat churn, unrelated locale copy
edits and the MarkdownRenderer rewrite. Fold 42 hand-written
owner-surface refusal blocks into one table-driven fail-closed guard,
resolve member scope once per request, and share test scaffolding through
one helper module. Re-measure the eager catalog chunk ceiling instead of
compacting unrelated app descriptions to fit under it.
…irodotdev#10063)

fork.spec.ts was the only Playwright spec that opened /chat with
waitUntil 'networkidle'. /chat holds a live connection to the gateway,
so the 500 ms of silence networkidle waits for is never guaranteed to
arrive inside page.goto's 10 s budget, and the spec failed on all three
attempts on main, on the weekly prune PR and on an unrelated PR with
"page.goto: Timeout 10000ms exceeded". Every sibling spec, including
chat.spec.ts on the same page, navigates on 'domcontentloaded' and waits
for the composer to appear; fork.spec.ts now does the same, and its
existing composer assertion carries the readiness wait.
kirodotdev#10049)

_cache_probe() now keeps tools, tool_annotations, capabilities,
protocol_version, and server_info from the prior successful probe
when a new probe fails (status in error/needs_auth), while still
overwriting status/error fresh. Previously a transient probe
failure discarded the last-known-good shape entirely, with no
fingerprint to tell a real change from a flake.

Fixes kirodotdev#10013

Co-authored-by: Ryan VanDyke <ryanvan@amazon.com>
…ev#10000)

* feat(acp): detect agent-spec @server refs that name nothing

The same defect has shipped three times, on three harnesses, and each
time it was diagnosed from scratch: a session comes up holding
tools: ["@kirocrew-core", ...] while nothing in its effective mcpServers
defines kirocrew-core, so every Crew tool is absent while the harness
works and nothing anywhere is red. A mirror fixes one backend; nothing
detected the class. codex is in that state on a plain build today.

acp/mcp_ref_guard.py compares the spec's @server refs against the FINAL
session/new / session/load mcpServers array -- spec projection plus the
gateway's broker stubs -- at the one point both are known, and logs one
structured line naming the backend, agent, unresolved refs and whether
the shared gateway is on. It also records them on the session's MCP
report, beside the buckets saying what a configured server reported: a
server nothing configured has no row there to be missing from, which is
why the defect was invisible. kirocrew doctor evaluates the same
function per selectable backend before a session exists.

It never changes the array and never fails the session. Two rules keep
it from crying wolf: kiro-cli reads the spec itself via --agent, so its
refs resolve against the spec's own mcpServers rather than the
deliberately empty wire array, and @Builtin plus bare tool names are not
server refs. The call site stays synchronous and in-memory over a
snapshot the spawn path warms, so kiro-cli's construction path gains no
scheduling point and no failure mode (H13).

session_mcp._tools_grant now mounts through the guard's parser, so the
mounting decision and the detector cannot disagree about what an entry
names -- disagreement in either direction is the same defect.

* refactor(acp): move the mcp-ref resolver behind the agent-sdk boundary

Every red said the same thing from a different angle: the detector was in
the wrong layer and claimed more than it did.

`check_agent_sdk_boundary` refused cli_doctor.py three new ACP /
providers edges, and correctly -- which file a harness reads its servers
from is exactly the knowledge a consumer must not hold. And the question
the detector asks is not an ACP question: spec in, wire array in, backend
id in, refs out. So the resolver moves to agent_sdk/mcp_refs.py, which
imports no ACP module at all; acp/mcp_ref_guard.py keeps only the log
line at the session call sites, and doctor asks one boundary-clean
delegation (agent_sdk.drivers.acp.agent_spec_mcp_refs) instead of
assembling the answer from the spec, the backend registry and the mirror
seam. cli_doctor.py stays off the boundary baseline.

The SDK resolver carries its own wire-array reader rather than importing
mcp_session_report.roster_names, so the two must agree by test instead of
by construction -- a detector that warned a server was missing while the
panel listed it two rows down would be worse than none.

Both readers dedupe through a SET while an ordered list carries the
output. Order is contractual (a stable warning across two sessions on one
spec) but testing membership against the growing list would be a linear
scan per entry, so N distinct refs would cost O(N**2) on the
session-establishment path -- and the spec is only size-capped (50 MB),
never entry-capped, so N is operator-controlled and large enough for a
watchdog to kill the gateway mid-session.

The snapshot read takes no `await` of its own. It rides inside the mkdir
hop _spawn already had (_prepare_spawn_workspace), so the count of
suspension points on kiro-cli's construction path is unchanged
(harness-parity H13). mkdir still runs first and still raises; the
snapshot half runs second and swallows everything, so a diagnostic can
never cost a session.

A ref is untrusted text -- the substring of a `tools` entry after `@`,
authored by whoever wrote the spec -- and the warning fires in NORMAL
operation, so every sink needs it sanitized. mcp_session_report._clean
becomes the public sanitize_sink_text and the guard redacts every ref and
the agent name through it before any sink, including in its return value.
Two sanitizers with the same job are two that can drift, which is this
change's own subject in miniature.

That is not enough for the log line on its own: CodeQL's
clear-text-logging query follows the spec-derived dataflow into the sink
and does not model that helper as a barrier, and code scanning does not
honour a per-line lgtm suppression. So the log line spells its two values
through _log_safe, a rebuild from this module's own alphabet -- the answer
this repository already uses for the same problem (keeper._locus,
_metric_slug, name_grant's constant tables). It runs AFTER the redactors,
never instead: a credential-shaped name is pure alphanumerics, so the
alphabet alone would pass one through. It also leaves out `:` and `/`, so
a ref cannot spell an endpoint into the record at all.

The reach is stated exactly rather than tidily. KAS composes its array on
AcpRuntime and never reaches this call site, so the runtime half covers
kiro-cli, claude and codex, and a KAS session's refs are checked by
`kirocrew doctor` alone. Named in the module docstring and both docs, and
pinned -- including a test that fails if someone wires the runtime without
correcting the claim.

Eight tests were reproducing wiring instead of asserting it, so those gaps
are pinned too: the spawn hop warms the snapshot (and is not split apart),
the doctor probe passes permission_surface_owned=True -- without which it
would report every ref unresolved on the one backend whose projection
works -- the sanitizer is shared rather than re-implemented, the rebuild
runs after the redactors and applies to the agent name as well, the
rebuild returns the alphabet's own characters (a property no output
assertion can reach, so it is pinned on the source the analyser reads),
and both readers stay linear on a 60k-ref spec. 32/32 mutations caught.

---------

Co-authored-by: Joe Guo <zejiangg@amazon.com>
…he batch (kirodotdev#9998)

Five rulings from PR kirodotdev#9943 and kirodotdev#9998 review, applied to both conductor skills.

ask_question ends the turn, so a procedure that says "ask, then
monitor_update" never reaches the interval change - patrol keeps running
fast while the card is outstanding. The interval now moves first and is
restored on the cycle that reads the answer.

The known-limits bullet stated the mechanism and then restated the patrol
rule from three sections earlier; it now names the displacement only.

The ledger skill drops the two accept_batch field names - per-entry status
and acceptance_concrete. Neither is emitted (accept_batch composes
{id, accept}), so the text pointed a conductor at fields it cannot find.

It also corrects what the batch actually holds. Every non-terminal item
with a non-empty acceptance enters it, placeholder values included, so a
pr of TBD reaches the evaluator and comes back error. Two sentences said
the server omits such an item. It does not: the omission is the
conductors own, next to the filter-to-done rule it already performs.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
… Settings (kirodotdev#9995)

A feature clip can now live on a CDN instead of only in the release folder on
disk, and the frontend has to be told which one it is looking at. The backend
reports that in `source`, and this branch acts on it.

A REMOTE clip is checked with the server before the dialog opens:
`GET /api/feature-videos/probe`. A local one is not, and that asymmetry is the
point. `offerable()` only offers a clip whose files `_asset_exists` found on
disk, in the same request that hands the clip over, so a probe for a local clip
re-runs a check the offer already passed. A clip on a CDN is the case the offer
CANNOT check and the page cannot check either: a cross-origin HEAD is refused
for want of CORS headers, so a healthy clip reads as missing. Only the server
can answer, and only for the remote half.

The semantics around it are unchanged. A remote dialog opens on `ok` only. A
failure records no verdict, so the clip is offered again next launch, and it is
journaled with `probe_not_ok` when the server looked and found nothing or
`probe_failed` when the question could not be asked at all. The launch is spent
either way.

Nothing preloads, for either source. `preload="none"` plus a poster is the cost
argument for showing a clip at startup: a launch nobody plays costs one small
JSON response and the still. A streamed clip is held to the same rule and says
"Plays online" beside the title instead -- a disclosure about a cost the user has
NOT paid yet. Reading its header first to populate a seek bar would spend CDN
bytes and make that disclosure false. The cost is a streamed clip showing no
duration until it plays.

A remote clip is not opened at all when the install may not pull bytes
(`download_enabled`), tested `=== true` so an absent answer reads as no. A clip
already on disk is unaffected -- it needs no network, so the policy has nothing
to say about it.

Settings > Chat gains a readout beside Feature Tips: how much of the current
release is saved on this device, which clip is being fetched, or that downloads
are turned off, plus one "Download all now" control. The control is absent
rather than greyed when policy forbids downloads, and unavailable while a fetch
is already running so the same pass cannot be queued twice. It polls only while
the panel is mounted. `GET /api/feature-videos/status` already exists and answers
with an engagement-history payload carrying none of the cache fields, so an absent
`download_enabled` is the feature detect and the row renders nothing rather than
asserting a download policy the install does not have.

Copy went through a new-user read: "cached", "policy" and "Streaming" all read
as jargon or as a fault, so the line now says where the clips are and what still
works.

Three fields carry no reader and are not declared: `min_version` and `release`
on the clip -- the panel takes the release from the status payload -- and `state`
on the status payload, where `downloading` already carries the live signal.

Frontend only. No Python, and no URL is ever composed by the client -- `video.src`
is played exactly as the backend authored it.

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>
…cles (kirodotdev#9950)

A stateless ask_question card was retired by every `nudge` frame, on both the
client reducer (QUESTION_RETIRING_ROLES) and the server record
(_QUESTION_RETIRING_ROLES). A monitored session that asked a question and then
ran ten nudge cycles lost the card, and lost the /api/ask-question/pending
record a reload rehydrates from, while the question was still unanswered.

A nudge does not consume the card's answer channel: it wakes the same agent in
the same conversation, so a message the user sends later still reaches the agent
that asked. Only a `user` row is the next message the card was waiting for. The
"stale card lingers" case the nudge retirement covered is now owned by the
card's own Dismiss control, which retires the server record too.

Because Dismiss becomes the only exit for a question nobody will answer, it also
says what it does: the bare label reads as "hide this for now", so the row now
carries "Dismissing the question stops the agent waiting for an answer." and the
control repeats it as its title. A visible line rather than a tooltip alone,
because a tooltip does not exist for touch or for a keyboard user reading the
row. One key across all 13 catalogs.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
…atus, stop flagging done items stale (kirodotdev#9947)

Three read-path defects observed in a live conductor run, all of them the read
telling the conductor something untrue.

accept_batch carried every open item with a non-empty acceptance, including one
whose bar was still `{"kind": "pr_checks", "pr": "TBD"}`. accept_eval.py can only
answer `error` to that spec, and a conductor reading a column of verdicts takes an
error for a failure of the work. The goal-ledger-conductor skill has promised the
opposite all along -- "accept_batch will leave that item OUT of the batch until the
stored acceptance is concrete" -- so this makes the promise true rather than adding
a new rule.

`is_acceptance_concrete` is the test, and it judges a bar FIELD BY FIELD over the
fields that script actually reads for the bar's kind: a placeholder string (`TBD` in
any case, blank) in one of those, a `kind` it does not dispatch on at all, or one of
those fields mistyped -- a `pr_checks` `pr` that is not a positive int, a `file`
`path` that is not a string, a `file` `exists` that is not a bool. Those are exactly
that script's error-only guards, and a test pins the two against each other by
running the copy goal-ledger-conductor itself ships, with the kind vocabulary derived
from its own dispatch chain so a kind added there fails a test here instead of
silently dropping every item using it.

Scoping to read fields is deliberate, not incidental. An acceptance is stored
verbatim and may carry metadata the evaluator never looks at -- a branch name, a
note, a `cmd` argv that mentions the word TBD -- and a value that cannot reach a
verdict must not cost an item its place in the batch. It also keeps the read path
free of recursion over caller-supplied nesting, which a deep stored record could
otherwise exhaust, failing every later batch read of that slot rather than just its
own item. An explicit `null` is absence rather than a placeholder, because that is
what the evaluator makes of it (`repo: null` simply omits `--repo`); where a field is
genuinely required, the per-kind type rule refuses `None`, which is the honest place
for that judgement. `cmd` is in the vocabulary and reads nothing, so such a bar stays
in the batch: that script always answers `refused`, and `refused` is a message the
conductor must receive -- re-express the condition -- not an item that disappears.

The derived `acceptance_concrete` flag on the item row tells a conductor WHY an item
is missing from the batch, so the omission is visible instead of mysterious, and an
`accept` promotion puts the item back.

Each batch entry now carries its item's `status`. The batch is still NOT filtered by
it -- that judgement is the conductor's and the seam is load-bearing -- but applying
the filter no longer needs a second lookup.

`stale` flagged an item whose worker had reported `done` and was waiting on the
conductor, for eighty minutes. `stale` means the WORKER went quiet; after `done` the
next move is the conductor's or a human's, so the flag was pointed at the reader. It
now follows who owns the next move: `progress`, `blocked`, `question` and no report
yet all count, and so does a `done` item the conductor already ruled `verdict: fail`
on and left open, because that ruling hands the retry back to the worker.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
…tent byte-exact (kirodotdev#8991)

* fix(members): scrub member payloads span-locally, keep legitimate content byte-exact

_scrub_member_payload detected forged member-authority markers on a
normalized view (NFKC + Cf drop + Pd fold) but then injected the
normalized copy of the WHOLE payload, so legitimate content was
rewritten: a permanent rule protecting a fullwidth path reached the
member naming its ASCII fold instead, and emoji ZWJ sequences and
prose dashes in briefings were destroyed.

Detection still runs on the normalized view, now built per character
with an origin map back to original offsets (the same mechanism
_structural_marker_spans already uses, generalized to NFKC), and only
the matched spans are rewritten in the ORIGINAL text via the existing
_apply_marker_spans. A span touching any part of a multi-char
compatibility fold maps to the whole original character, so spans only
over-cover (deny direction).

Fail-closed floor: the span-scrubbed result is re-checked against the
historical whole-string normalized view; any residual match degrades
the scrub to exactly the old behavior (normalize whole payload,
substitute every match), so a mapping defect can cost fidelity but
never admit a forgery.

The overlapping-span merge tail is extracted to
_merge_overlapping_spans, shared with _structural_marker_spans
unchanged. Owning doc paragraph synced.

Part of kirodotdev#8524

* fix(members): normalize combining sequences whole so span detection matches the fail-closed floor

A combining mark inside a marker word (I + U+0307) composes under the
whole-string NFKC floor to a char whose case fold is ASCII, but the
per-character span view could not compose it: the span pass went blind,
the floor fired, and the whole payload was folded - corrupting the
legitimate fullwidth content the span-local rewrite exists to protect.

Group each base char with its trailing combining marks, normalize the
sequence as one unit, and map every emitted view char to the sequence's
full original span. Residual starter-composition divergences (Hangul
jamo) cannot reach the ASCII marker alphabet and still land on the
unchanged fail-closed floor.

Rebased onto main by Kiro Crew: main's marker machinery gained
default-ignorable ranges and _MULTIBYTE_TABLE punctuation folding while this
PR was open, so the member floor view inherited them via the shared helpers;
the combining-sequence detection view is harmonized to mirror that same
normalization, keeping detection and floor aligned as this commit intends.
Original work by javenciu.

Co-authored-by: Kiro Crew <noreply@kirodotdev.github.io>

---------

Co-authored-by: Kiro Crew <noreply@kirodotdev.github.io>
leonlaiyc and others added 24 commits September 13, 2026 02:29
… guard (kirodotdev#8869)

followup_dir() refuses a linked ancestor before it resolves anything, and its
docstring says why the order matters: resolving first makes containment
attacker-relative, because a link planted at the runs root is followed by
resolve(), the anchor moves into the attacker's directory, and every child
underneath then compares as legitimately inside it.

That pre-resolve check asked Path.is_symlink(), which is False for a Windows
directory junction. A junction needs no privilege to create, and resolve()
follows it exactly like a symlink -- so on Windows the plant walks straight
through the guard. Measured on origin/main: with a junction at the runs root,
followup_dir("runJ", root) RETURNS a path whose resolve() lands inside the
attacker's directory.

Route the check through platform_compat.is_link_or_junction, the shim-table row
for exactly this question. The import is guarded like this module's other
kiro_crew imports; the fallback is symlink-only and never a local reparse-point
probe, and its signature matches the real routine exactly because mypy requires
every conditional variant of a name to agree.

Only the runs ROOT is affected. Measured per plant site on main: a junction at
the run directory or at chat/ is already refused, because the anchor stays
legitimate there and the resolved containment check catches it. The runs root is
the one case that check cannot catch -- it is measuring against the attacker's
own anchor -- which is precisely what the pre-resolve check exists for.

The two other link guards in this app are not siblings: learning.py's lock path
and results.py's record path both guard FILE paths, and a junction is
directory-only, so a junction there fails is_file() and the guard declines.

The test stages the plant with a local mirror of test/conftest.py::make_dir_link,
which calls _winapi.CreateJunction unconditionally on Windows. It is mirrored
rather than imported because only the test/ testpath gets that conftest. It is
NOT platform_compat.symlink_or_junction: that tries os.symlink first, so a
runner with Developer Mode gets a symlink and the junction arm is never
exercised -- silently, while still reporting green.

test_a_junctioned_runs_ROOT_is_refused fails on origin/main with
"FileNotFoundError not raised". The run/ and chat/ cases are pinned as
preservation tests, green on both sides.

The test file is in .github/black-baseline.txt, so it is deliberately not
black-formatted here: running black over it reformatted 56 pre-existing lines.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
…0483)

* fix: cache usage reports and refresh every five minutes

* fix: distinguish cached usage errors from capability status
…oor (kirodotdev#10532)

`test_escaped_failed_is_reported_against_its_test_not_as_internalerror`
asserted `victim_duration - bystander_duration < 4.5` on a victim that
sleeps 3.0s. That leaves 1.5s for everything the runner adds around the
phases, and hosted windows-latest adds more than that under load: the
Backend Tests (Windows) (4) shard failed on it four times within an hour on
two unrelated PRs, across all three parametrizations, at 4.54s / 4.56s /
4.62s / 4.84s -- each one a slow runner overshooting by 40-340ms, none the
120s timeout the ceiling exists to rule out.

What the ceiling is FOR is telling "counted once" from "the guard's
synthesized report was summed as a second pass". The victim sleeps 3.0s, so
a double count is at least 6.0s by construction. The ceiling now sits at
that floor -- `3.0 <= victim_duration < 6.0` -- which is the exact property
the assertion carries, and tolerates up to 3.0s of host overhead instead of
1.5s. The bystander keeps its own assertion (a duration with no sleep in it
stays small) rather than being subtracted from the victim's, since the two
tests' overheads are not the same quantity.

The report-shape assertions (`victim_reports == [...]`, `timer_armed is
False`) are unchanged and still carry the one-report-per-phase claim.

Verification: static gates only (black, flake8, check_comment_history);
the shard runs in CI.

Fixes kirodotdev#10519
…e oldest (kirodotdev#10501)

The endpoint caps its answer at 50 rows and has two tiers whose stores answer
in OPPOSITE orders: the vector store sorts `updated_at DESC` (newest first),
while the JSONL store returns file append order (oldest first). Both tiers
applied the same tail slice, which is correct only for the second one -- on the
vector tier it selected the 50 OLDEST lessons and hid every recent one.

A lesson saved with `learn_add` was therefore absent from the very next
`learn_list`, so a write that had in fact persisted looked like it had silently
failed. Prompt injection was unaffected (that path ranks by relevance and
applies no such slice), which is what made the defect hard to see: the rule was
in effect while the tool meant to confirm it said otherwise.

Pass the cap to the store instead of slicing after the fact, so the ordering and
the limit live in one place and the read no longer materializes every lesson row
-- embedding blobs included -- to discard all but the newest few. Emit
oldest-first so both tiers agree; consumers depend on that direction, the
dashboard Memory tab taking its recent rows from the tail of the list.

Both tiers are pinned by regression tests over a population larger than the cap.

Co-authored-by: Zejiang Guo <zejiangg@amazon.com>
…s smoke (kirodotdev#10512)

The first run of `Smoke-install Windows installer (x64)` (added by kirodotdev#9585;
nightly 34742163687, head 591c37c) threw at
scripts/smoke-windows-install.ps1:235:

    KiroCrew Nightly 0.7.0-nightly.20260913t061222 registered no InstallLocation.

The install was healthy: exit 0, one new uninstall registration with the
right DisplayName and DisplayVersion. The script read `InstallLocation` off
the Uninstall entry, and electron-builder never writes it there. Its NSIS
template (`registryAddInstallInfo`, app-builder-lib 26.15.3) writes
InstallLocation, KeepShortcuts and ShortcutName under INSTALL_REGISTRY_KEY
= `<hive>\Software\<APP_GUID>`, and only the Add/Remove Programs values
under the Uninstall key; its own initMultiUser reads InstallLocation back
from the former. `.github/scripts/test-windows-installer.ps1` already pairs
each Uninstall root with the matching Software root for exactly this
reason; the new smoke script did not carry that over.

Consequence beyond the red job: the smoke job is part of the reusable
build-windows.yml, so its failure failed the whole `Build Windows Desktop`
call and `Publish Windows Desktop (nightly channel)` was skipped -- the
09-13 nightly shipped no Windows installer.

The script now derives the paired install-info key from the registration
it found (lift the leaf out of `\Microsoft\Windows\CurrentVersion\Uninstall\`
into the hive's Software root; the leaf IS the GUID since UNINSTALL_APP_KEY
defaults to APP_GUID), reads InstallLocation there, prints both keys, and
after the silent uninstall asserts the install-info key is gone too -- the
generated uninstaller deletes both, and a surviving one is what makes the
NEXT install read a stale InstallLocation.

Also corrects the comment in website/electron/build/installer.nsh that
recorded a field observation of "InstallLocation absent from the uninstall
key" as an unexplained mystery: an Uninstall entry without it is what every
healthy install looks like, so that reading says nothing about the value
initMultiUser consults. The design conclusion there (the update path must
not depend on the value) stands. docs/ci/e2e-gate.md and
docs/guides/windows-install.md now describe the gate accurately.

Verification: static only (no pwsh on the authoring host). The smoke job
is reachable from a branch through build-windows.yml's workflow_dispatch
packaging probe, which builds an unsigned installer from any ref and runs
this script against it; that dispatch is the proof for this change.

Fixes kirodotdev#10509
…ol row (kirodotdev#10511)

The first scheduled run of the `pod-scenarios` job added by kirodotdev#9585 (nightly
34742163687, head 591c37c) failed on both legs. Neither failure is a product
regression: nothing under `src/kiro_crew/sandbox` or the pod boot probe
changed between the green 09-12 run and this one. Both are day-one defects
of the new job, and they are coupled -- the Linux leg cannot reach the
second one until the first is fixed, and the macOS leg is failing on the
second one today.

Linux: every `pod up` refused with `userns probe failed (permanent):
unshare(CLONE_NEWNS) failed with errno 1 (EPERM)` followed by the pod
probe's FATAL `could not be sandboxed on this host (no_backend)`. The
hosted ubuntu-24.04 image restricts unprivileged user namespaces through
AppArmor, so the pod gateway has no Linux sandbox backend, and a pod pins
`agent.sandbox=auto` with `sandbox_allow_unsandboxed_exec` OFF
(`pod/runtime.py`). The probe's refusal is therefore correct -- serving a
gateway whose every agent turn would fail while `/health` answers 200 is
the condition it exists to catch -- and the fix belongs to the workflow.
The job now runs `sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0`
before the suite, the same step `ci.yml`'s `e2e` and `backend-test-sandbox`
jobs already run, and proves it with `unshare --mount --map-root-user true`
so a runner image that stops allowing it fails by name rather than six
scenarios deep. Seeding the unsandboxed opt-in into the pod was rejected:
it would pass the suite by running the product in a mode a real pod refuses.

macOS: `test_one_agent_turn_completes_with_a_tool_call` failed on
`assert "tool_call" in text` against a turn that had completed WITH its
tool: the captured stream carries `{"type": "tool", "content": "🔧 echo
hello-from-fake"}` followed by the fake's reply. `tool_call` is the ACP
wire term; `/api/chat` surfaces it to the client as an SSE row of
`type: "tool"` (`chat_runner` renders the title into it), and the literal
never appears in the body. The test now parses the `data:` rows and asserts
a row of type `tool` is present, which is the contract the dashboard
actually exposes. Deterministic, not a flake -- it would have failed on
Linux identically.

docs/ci/e2e-gate.md gains the userns paragraph beside the existing
systemd-session one, since the two are the Linux leg's two host
prerequisites.

Verification: static gates only (black, flake8, YAML parse,
check_comment_history). The job is nightly-only. `nightly.yml` does carry
`workflow_dispatch`, but a dispatch from a branch is NOT a safe probe: the
dispatch takes no inputs, so it runs every publish lane, and
`publish-docker.yml` has no `environment: prod` gate (the CLI, desktop and
Windows publishers do), so it would push a feature-branch image to the
nightly ghcr channel. The evidence is therefore (a) ci.yml's `e2e` job,
which boots the same gateway against the same fake backend on
ubuntu-latest behind the identical sysctl + unshare pair, and (b) the
failing run's own captured stream for the macOS assertion; the first green
proof is the next scheduled nightly after merge.

Fixes kirodotdev#10507
Fixes kirodotdev#10508
…kirodotdev#10235)

The artifact knowledge-sync handler runs on the gateway loop, and several
of its store calls are taken directly on that loop: the delete/rename/
upsert `get_source_by_uri` lookups, `ensure_artifact_source`,
`refresh_artifact_name`, one frame down in `ingest_artifact` the
`release_stale_claim` write, and the per-job `get_job_status` read in
`reconcile_artifacts`. The boot `start()` path, `remove_artifact` and the
two `_get_state` reads run in a worker thread; these do not.

Each of those takes the knowledge connection, so a contended query
busy-waits every task -- the watchdog heartbeat included -- for the
connection's whole busy timeout, and a stall past 25s makes the watchdog
kill the gateway. The `on_loop_db` guard logs the take with a stack.

Wrap each of those store calls in `asyncio.to_thread`, matching how
`start()` offloads `ensure_artifact_source`. The handler's ordering is
preserved (name refresh before ingest; the kind-change reconcile before
the ingest) and behaviour is otherwise identical. One take is left on the
loop on purpose: `ingest_artifact`'s post-ingest `get_job_status` read
sits between the commit and the fallback ownership write, so offloading
it opens a cancellation point that the ownership write must be redesigned
to survive -- a separate change with its own title. Extend the artifact
ingest tests to drive the upsert/delete/rename paths under the on-loop
guard's strict raising mode so a regression to an on-loop take fails
rather than only logs, and update the artifacts spec's auto-ingest section
to name the offloaded calls and the one deliberately left behind.

Co-authored-by: Junjie Qu <junjiequ@amazon.com>
…kirodotdev#10536)

Co-authored-by: Kiro Crew <kirocrew@users.noreply.github.com>
…irodotdev#10551)

TAG_RE required an ASCII alphanumeric first character while its tail is Unicode-aware, so non-Latin tags silently never registered. The leading class is now any Unicode alphanumeric, matching the tail and the documented rule; tags feed an in-memory index, never a path. Combining marks, zero-width and bidi controls stay excluded since they are not word characters.

Co-authored-by: Aniruddha Adak <aniruddhaadak80@users.noreply.github.com>
…irodotdev#10544)

Each of _semantic_candidates_v1, _semantic_candidates_v2 and _rank_lessons
picked its query embedding with a ternary nested inside a ternary, two of
them on one long line. Reading one meant knowing that Python groups
A if c1 else B if c2 else C to the right. Each is now an if/elif/else with
the same branches in the same order, so the "reuse the caller's vector,
else embed, else nothing" rule is visible at a glance. v2 keeps its extra
query_text guard, which is the one thing the three sites do not share.

In _semantic_candidates_v1, the loop-invariant query_embedding is not None
is now the local query_has_vector, named after the _hybrid_score keyword it
feeds, instead of being recomputed twice per row; the single-use rows alias
before the return is gone, matching how the v2 sibling ends.

Behaviour is unchanged at every site.
… live deadline (kirodotdev#10500)

A gateway restart left every babysit loop on a host dead: the persisted rows
were `active: false` with an EMPTY `stopped_reason` and a still-live
`next_due_ts`. `start()` only re-arms active rows, so nothing rescheduled
them, and the session-directive re-arm was refused as "retained as evidence
(stop reason: manual)" -- a stop nobody recorded; `manual` was the display
default `_add_unserialized` substituted for an empty reason.

Every deactivation this service performs leaves a mark (`update` records
`stopped_reason or "manual"` and clears the deadline; the timer bounds, the
terminal settlement and monitor retirements record theirs), so an inactive
row with NO mark and a live deadline was not stopped by the service -- a
torn/foreign write, a store migrated between hosts, a hand edit. `_load` now
resumes that shape when the row still carries its kill-switch path (persisted,
WARNING logged) and `start()` reschedules it at its own deadline; an empty
sentinel is the shape an older sentinel-drop refusal persisted, and stays
inactive. The one `_load` branch that deactivated without a reason
(sentinel dropped) now records `sentinel_dropped` and clears the deadline, so
it stays fail-closed and distinguishable, and `sentinel_dropped` joins the
system-imposed set the directive re-arm may displace. A reasonless row
WITHOUT a deadline is indistinguishable from a pause recorded before the
reason field existed, so it stays retained evidence; only the refusal message
changes, reporting the recorded reason instead of inventing `manual`.

Fixes kirodotdev#10499
…tdev#7019) (kirodotdev#10554)

The sync-io-in-async ratchet started at 91 on-loop sites across 5 files;
89 were offloaded by earlier PRs. The two survivors are the best-effort
UPDATE ingestion_jobs execute() and commit() inside the self-heal
rebuild's BaseException/CancelledError handler in
src/kiro_crew/knowledge/watcher.py, which the code deliberately keeps
inline: awaiting to_thread inside a cancel handler can be re-cancelled
before the finalize lands, breaking the single-flight guarantee.

Carry that documented exception as the gate's inline
`# on-loop-io-ok: <reason>` markers instead of a baseline entry, prune
the last baseline line via --update-baseline (header-only file remains),
and re-pin the gate test to the terminal state: the committed baseline
parses and stays empty.

Closes kirodotdev#7019
… its runner (kirodotdev#10515)

A CodeBuild-hosted runner can start, fail its broker session handshake, and exit
cleanly with the job it was started for still queued. The job's label names one
run attempt, so no other runner ever matches it, `timeout-minutes` never starts,
and the run stays in_progress until GitHub's own pending limit. On main the CI
concurrency group then holds every later push pending behind the orphaned run
and evicts it on the next push: one orphaned frontend shard held main for ten
hours and cost eleven main verdicts.

`.github/workflows/ci-runner-watchdog.yml` runs every 10 minutes on
ubuntu-latest and drives `scripts/ci/runner_watchdog.py`: list queued and
in-progress CI runs, call a run orphaned when a `codebuild-`-labelled job has
sat queued for more than 15 minutes, cancel it, wait for the cancellation to
land, and re-run it so `changes` recomputes the label and CodeBuild receives
fresh workflow_job.queued webhooks. Guard rails: young runs are not inspected,
fork runs and runs at attempt 3+ are reported but never touched, at most five
runs per tick, refused cancels and re-runs are logged and left for the next
tick, and a pending run with no jobs (waiting on its group) is reported, never
cancelled. Full re-run is the default because a failed-jobs re-run reuses the
first attempt's runner label; `RERUN_MODE: failed` opts into the cheaper form.

The detector is unit-tested against a fake API in
test/test_ci_runner_watchdog.py; docs/ci/ci-and-reviews.md documents the
failure mode, the watchdog, and the manual fallback.
…AcpRuntime (kirodotdev#10257)

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

Clicking a remote crew's session row in the Sessions list now opens that
session HERE — in the local pane, with its transcript — instead of handing
the whole app over to that crew's dashboard pane.

Two halves, both in this commit:

1. DISCOVERY (carried forward from the closed kirodotdev#7444). The merged Sessions
   list reads each connected crew's slots and interleaves peer-owned rows
   with local ones by recency, keeping the two key spaces distinct so a
   colliding key cannot leak local pin/folder/unread/running state onto a
   peer row.

2. ADOPT (new). Clicking such a row binds a FRESH local slot to the peer
   session that already exists, and backfills its transcript.

WHY THIS SHAPE

instance_id + remote_slot forwards its turns to a slot on the peer. Its
only create path mints a NEW peer session ("New chat on crew"), so there
was no way to reach a session the peer's own user had already started —
which is exactly the set this list shows. kirodotdev#7444 shipped those rows with a
pane switch as the click, and the review objected: the row should open
where it is listed.

That objection was right, and this commit retracts the claim in kirodotdev#7444 that
adopting an existing session was structurally impossible. It is not. The
bind is a POST-CREATE STAMP in api_chat_slot_create, and the 409
remote_already_bound guard only fires when a create resolves to an
EXISTING LOCAL slot. Adopt makes a fresh local slot, so the guard is not
in the way: adopt simply feeds a caller-supplied peer key where
create_peer_slot's minted one went. Everything downstream is unchanged.

WIRE

POST /api/chat/slots gains one optional field, adopt_remote_slot — the
peer session's own key, as listed by GET /api/instances/{id}/chat-slots.
No second endpoint: the local slot is created the same way either way and
only what it binds to changes. Requires instance_id (the owning crew).

  400 adopt_needs_instance   adopt without a crew
  404 adopt_target_unknown   not a currently-listed peer session, or a
                             hub-driven execution slot (not adoptable)
  502 remote_bind_failed     peer unreachable during validate/backfill

VALIDATION AND OWNERSHIP

The supplied key is validated against the peer's LIVE listing, through the
same read the listing route uses (extracted here as read_peer_slots rather
than duplicated). That rejects forged keys and excludes hub-driven slots
for free. agent, title and memory_mode are inherited from the validated
peer row, not from the request: memory_mode is the privacy boundary and
the session it belongs to already chose it, so an adopt resolves NO local
default — sending this machine's default risked turning an incognito peer
session into a persistent local transcript. The peer wins on agent and
title too, ahead of anything the caller sends rather than as a fallback:
the adopt path offers no picker for either, so a caller-supplied value
could only disagree with the session being adopted — opening the peer's
conversation under a different agent than the one answering in it, or
renaming the row the user just clicked.

Adopt is idempotent, and that holds for concurrent requests as well as
sequential ones. A repeat (instance_id, adopt_remote_slot) returns the
same local slot instead of creating a second, and reads neither the list
nor the transcript again. Two requests arriving together are decided by a
recheck placed immediately before slot creation, after every await on the
path: nothing between it and get_or_create_slot suspends, so on asyncio's
single thread check-and-create is atomic without a lock. Two local slots
bound to one peer session would not merely duplicate a row -- each
accumulates its own turns, so the transcripts diverge and read_peer_slots
filters the peer's row on whichever binding it happens to see.

BACKFILL

The peer's full history is read from its own slot path and appended before
the first frame, redacted through the existing peer-text sink, capped by
rows and reply bytes with a bounded-tail fallback and a visible notice
when truncated. A failed or malformed read is a notice, not a 500 — the
session still opens. The backfill is placed after the app-ownership and
member-assignment checks so a create that is about to be refused never
copies a transcript.

An adopted session stops appearing as a peer row, so the list does not
show it twice.

TESTS

38 new backend tests cover bind-not-mint, the untripped guard, forged and
hub-driven keys, unreachable/refusing/version-skewed peers, authorization
(app tokens and non-owner identities refused), idempotency including a
half-written binding, inherited metadata and redaction, backfill caps and
failure modes, and row mapping.

Frontend: the peer-row click is asserted to adopt (instance_id +
adopt_remote_slot) and NOT to reach the pane switch, and to switch to the
new LOCAL key the response names rather than the peer's key. The
pane-switch assertions in the base spec are inverted accordingly; the
federated Older-Sessions row keeps its selectInstance, which is a
different row class and unchanged here.

KNOWN GAPS

- Relayed-turn pending approval is a pre-existing relay_remote_turn gap,
  not introduced here.
- The visible session-peer-destination marker is removed: it existed to
  warn that the click did something the row did not promise, and adopt
  removes that surprise. Where the turns run is now carried in the row's
  title/aria hint. Worth a UX opinion in review.
- UX screenshots are not captured in this commit.

Co-authored-by: Chen Tong <cttong@amazon.com>
Route managed installs through the host-local update approval flow. Make automatic checks recurring and coalesce concurrent callers on one verdict.
Brings upstream's per-host AcpRuntime harness (kirodotdev#10238) and CodexHarness
(kirodotdev#10257), which lets a direct runtime such as Sage's review pool run on Codex
with the credential mask and permission routing the AcpClient path applies.

Fork carried into upstream's new shapes:
- Claude on AcpRuntime gets its own harness (acp/harness/claude.py); the
  fork's direct-runtime bindings (Sage, background) would otherwise be refused
  by harness_for(). SpawnPlan gains session_model / session_meta.
- Hands-free dictation moves into upstream's Composer / useComposerVoice.
- The fork's settingSources, session MCP gating and replayed-message fixes
  survive in AcpClient; the withheld flag keys on _seeds_local_settings so
  Codex and opencode mirrors are not stripped.
- Both conductor evaluator copies are the fork's product-evaluator adapter.

Taken from upstream over the fork:
- kirocrew-conductor mounts execute_bash again (never auto-approved), per
  kirodotdev#10265's work-ledger conductor.
- History delete no longer purges coordinator work items (kirodotdev#10019 keeps
  per-key state another process may own); test_work_items'
  permanent-delete purge test fails until that is decided.
- /api/sessions/context and context_info are removed (kirodotdev#9936).

Also fixes the MarkdownPanel Edit/Preview label keys left stale by an earlier
sync. Locale catalogs merged per key (0 contested); six Prettier-drifted TS
files merged on normalized stages.

Targeted suites (12.3k Python, 2k frontend): no failures beyond those already
failing on the fork base, except the work-item purge test above.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Upstream kirodotdev#9946 added this to the bundled accept_eval.py; the fork evaluates
acceptance in kiro_crew.work_acceptance instead, so the merge carried neither
the rule nor its tests. A pending run on a draft is refused rather than
polled; a probe that cannot answer leaves the pending standing, and resolved
runs are never probed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Upstream now derives restart hints from the config schema, and
subagent_max_per_parent{,_by_agent} is not restart-only there, yet
apply_limits never reloaded them: a saved cap waited for a restart nothing
announced. Admission reads both at use, so the assignment is the whole apply.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CodexHarness left SpawnPlan.session_model empty on the assumption a provider
re-applies the model. Sage's review pool builds AcpRuntime directly with no
provider behind it, so every review would silently run codex-acp's default.
The model still travels over the pipe, never argv.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The upstream merge adopted kirodotdev#10019's rule for history deletion: independent
session state (ledger, pins, autocompact overrides) is preserved because
another process can recreate the key after the owner scan, and purging would
destroy a successor's state. Coordinator work items are durable delegation
records, so they follow the same rule. The test now guards that neither purge
entry point runs, and the spec says so.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The merge kept one fork-worded paragraph in _CONDUCTOR_SYSTEM_PROMPT; the
conductor prompt, grants and both conductor skills now match upstream exactly.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 13, 2026
@Premshay
Premshay merged commit 80b2379 into main Sep 13, 2026
3 of 4 checks passed
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Sep 13, 2026
@github-actions

Copy link
Copy Markdown

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 444c37b2a46d50971bde5c123a374c2430364536; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

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

@Premshay
Premshay deleted the integration/fork-main-origin-main-20260913 branch November 13, 2026 11:08
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.