Skip to content

fix(crew): say why a Bot's abilities failed to load and how to recover - #37627

Merged
iamwhatever merged 3 commits into
kirodotdev:mainfrom
alexcollado:fix/abilities-load-error-help
Nov 18, 2026
Merged

iamwhatever merged 3 commits into
kirodotdev:mainfrom
alexcollado:fix/abilities-load-error-help

Conversation

@alexcollado

@alexcollado alexcollado commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: When a Bot's abilities fail to load, the Bot editor and the guide tool say why and offer a way forward instead of a dead end.

When the Bot editor's Abilities read times out (a Bot with ~120 added rows and a ~700-skill catalog, or a folder on a hung mount), the pane shows only "Couldn't load this bot's capabilities." It offers no retry and no hand-off, and it gives no hint of the cause. The gateway logs nothing. The get_member_capabilities guide tool waits 10 s on a route with no deadline and hands the agent a bare timed out.

Why it matters

The owner of a slow Bot cannot see its abilities, cannot retry without closing the editor, and cannot find out which Bot was slow or by how much. The agent they ask cannot explain it either.

Not a goal

  • Making the read itself faster (the worker_summary per-row fix is a separate PR).
  • Changing either deadline (GET_TIMEOUT_SECS stays 20 s, ABILITIES_READ_TIMEOUT_MS stays 30 s).
  • Bounding the change-card state reads (_capability_state, capability_ref_hint).

What changed (motivation → approach → change)

A timed-out read now tells everyone the same thing: the pane, the gateway log and the agent.

Who Before After
Abilities pane (components/crew/CrewEditorNextDialog.tsx) one inline line, no actions a block notice: the title plus why it ran out of time (many added abilities, or a slow or unreachable drive), Try again, and Ask the agent
Add abilities pane (components/crew/workerKitErrors.ts) generic load error the same timed-out sentence
Gateway log nothing the Bot and the limit when the GET gives up, and the real duration when the read finishes late. Any other 503 logs the error's type only
get_member_capabilities (src/kiro_crew/mcp_guide.py) timed out after 10 s waits 30 s; the route stops at 20 s and returns a sentence the agent can relay

The three abilities GETs (agent_capabilities.py, member_worker_kit.py, change_cards.py) share one bounded, logged read, dashboard/handlers/_bounded_read.py. The dashboard's ABILITIES_READ_TIMEOUT_MS comment in website/src/api/crewCapabilities.ts names that module's GET_TIMEOUT_SECS. A timeout's 503 keeps code: capabilities_unavailable and adds reason: "timed_out", so the pane can tell it apart from an unreadable file.

Ask the agent was off in the editor, because the hand-off navigates away from a modal that can hold unsaved edits. ErrorNotice now takes a gate (forwarded to AskAgentButton, which already had one). The editor passes its leave guard (useCrewEditor's leaveGate). Over unsaved panes it raises the editor's own discard confirm and hands off only after the user discards, because the Bots page's guard only refuses and raises that confirm. With nothing unsaved it goes through the host's guard. website/AUTOSDE.yaml lists that form beside the others. The strings are in en.manual.json and all eleven translations, and en-XA.json is regenerated. docs/system-specs/modules/crew-mode.md describes the behaviour, and website/capture/abilities-load-error.tsx is the capture page for the screenshots below.

Backwards compatibility

Compatible: every 503 keeps its error and code; reason is a new field, and the card route's error was not a timeout answer before (that route had no deadline).

Removes nothing: no route, field, key or prop is removed. _GET_TIMEOUT_SECS moves from the two handlers to GET_TIMEOUT_SECS in the shared module; only the deadline test read it.

Tests

  • test_member_abilities_read_deadline.py: both GETs answer reason: timed_out while the read is still blocked and log the Bot. A read that finishes late logs its duration; one within the limit logs nothing.
  • test_change_cards_routes.py: the card route answers a blocked read with the model-facing sentence, and the guide tool waits longer than the route's deadline.
  • CrewEditorNextDialog.test.tsx: the timed-out and generic texts. Try again reads again and shows the bands. Ask the agent runs only through the leave guard, and a veto leaves the editor as it was. With the Bots page's own guard wiring: nothing unsaved hands off at once; unsaved edits hand off only after the discard is confirmed, and Keep editing drops it.
  • workerKitErrors.test.ts, WorkerKitPane.test.tsx: the timed-out sentence for both deadlines.

Proof: not provable -- other: the backend hunks import a new module, so prove.py's revert fails at collection, and it does not run vitest. Checked by hand: with the four handler files back at the merge-base (head 8e8ed400ce, the same backend code as now), the two stalled-read cases and both card-route tests fail; at head 254b64c, with CrewEditorNextDialog.tsx and workerKitErrors.ts back, all 8 new frontend cases fail.

Determinism: 20/20 runs at -n0, 10/10 at -n 4 --dist loadgroup --max-worker-restart=2 with test_guide_routes.py as a co-tenant, both backend files' 87 ids shuffled (seed 19499), and the three frontend files 5/5 under --sequence.shuffle. The stalled-read test blocks on an event until released; the late-finish test moves the module's own clock binding.

Manual verification

Done on a capture page that mounts the real editor with every API answered locally (website/capture/abilities-load-error.tsx, served by the Vite dev server on 127.0.0.1): the timed-out notice in both themes and at 320 px; Try again (the pane goes back to its loading line while the read runs); Ask the agent over an unsaved General edit raises the editor's discard prompt and stages nothing; the Add abilities timed-out line. Still required on a running gateway: a capabilities GET held past 20 s, and the two warning lines in the gateway log.

Screenshots / video

The Abilities section after a timed-out read, light and dark:

Timed-out notice, light

Timed-out notice, dark

320 px, Try again, Ask the agent over a draft, Add abilities

Timed-out notice at 320 px, light

Timed-out notice at 320 px, dark

Try again: the pane shows its loading line while the read runs

Ask the agent over an unsaved edit raises the discard prompt

Add abilities: the timed-out line

Related Issues

Part of #37625

Sibling sweep

Swept: git grep -n -e "_capability_service(app).get" -e "asyncio.wait_for(asyncio.to_thread" -- src/kiro_crew/dashboard
Sibling: src/kiro_crew/dashboard/change_cards_readers.py:933 -- not affected -- a change card's state read during propose and Undo, not a read the pane or the guide tool waits on

Pattern harvest

Rule candidate: review-prompt
Pattern: a GET that answers a timeout 503 without a log line naming the subject and its elapsed time

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

@alexcollado
alexcollado requested review from a team and KiroCrewCaptain as code owners November 15, 2026 14:24
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Nov 15, 2026
@KiroCrewCaptain

KiroCrewCaptain commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates a 12% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 627 lines, more than the 400 it may approve on its own.

The PR moves the three capability GETs onto one shared, logged read with a 20 s deadline (bounded_read). When that read times out, the 503 keeps its error and code and gains reason: "timed_out". The card route used by the guide tool had no deadline before and now uses the same 20 s one. Its timeout error is a sentence the model can pass on to the user, and the guide tool waits 30 s, so the route's own answer comes back before the tool times out.

Checks I made against the code:

  • Guide tool timeout: mcp_core_parts.gateway._get already takes a keyword-only timeout. The other test stubs of _get either take *a, **k or never call get_member_capabilities.
  • Exception order: catching TimeoutError before (OSError, ValueError) is correct. The project requires Python 3.12, where asyncio.TimeoutError is the built-in TimeoutError.
  • No secrets in the log: the new warning for other failures logs only the error's type and the Bot name, never the error text.
  • Old constant: no tests reference the removed _GET_TIMEOUT_SECS, and the asyncio imports removed from the two handlers are not used anywhere else in them.

On the frontend:

  • *Ask the agent:

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 19a4285196 · 627 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@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 15, 2026
bolichen97
bolichen97 previously approved these changes Nov 15, 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.

Reviewed head 254b64c. Approving.

  • bounded_read keeps the old behaviour of the two GETs (same 20 s deadline, read left to its thread) and only adds the logs and reason: timed_out. except TimeoutError sits before except (OSError, ValueError), so the timeout is told apart and other errors still log only their type, not their text.
  • The card route had no deadline before; it now answers a model-facing sentence, and get_member_capabilities waits 30 s, past the route's 20 s, so the agent gets that sentence instead of a transport timeout.
  • Ask the agent now goes through useCrewEditor's leave guard, so it cannot discard unsaved edits without the prompt. The website/AUTOSDE.yaml rule text matches that.
  • Local run: test_member_abilities_read_deadline.py, test_change_cards_routes.py, test_guide_routes.py 147 passed; WorkerKitPane.test.tsx, workerKitErrors.test.ts, CrewEditorNextDialog.test.tsx 116 passed.

Non-blocking: timed_out_for_model puts the member query value into text the agent reads. It is the caller's own value and length-capped by _QUERY_MAX, so this is fine as is.

Fork CI runs on this head are approved.

AI-assisted, sent by Bolin Review bot

@bolichen97
bolichen97 enabled auto-merge (squash) November 15, 2026 16:10
@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 15, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

@alexcollado one red check to fix on 254b64c, the rest follow from it:

  • Source Gates: feature-map gate: this change adds or removes a dashboard feature but leaves docs/feature-map/README.md untouched. The new Try again / Ask the agent actions on the Abilities load error count as a dashboard feature change, so please add a line for them in docs/feature-map/README.md.
  • Await Fast Gate, Coverage Gate (frontend-test=skipped -- failing closed) and PR Readiness are downstream of that gate and should clear once it passes.

My approval stands and auto-merge is on, so it merges once CI is green. After you push, I'll re-check the diff and approve the fork CI runs on the new head.

AI-assisted, sent by Bolin Review bot

auto-merge was automatically disabled November 15, 2026 16:45

Head branch was pushed to by a user without write access

@alexcollado
alexcollado force-pushed the fix/abilities-load-error-help branch from 254b64c to 19a4285 Compare November 15, 2026 16:45
bolichen97
bolichen97 previously approved these changes Nov 15, 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.

Re-reviewed head 19a4285. The only change since my approval on 254b64c is the new Bot abilities load error row in docs/feature-map/README.md, which is what the feature-map gate asked for. Approving again; auto-merge stays on. Fork CI runs on this head are approved.

AI-assisted, sent by Bolin Review bot

@bolichen97
bolichen97 enabled auto-merge (squash) November 15, 2026 17:07
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 4ec5be2bbb9e613f84cf052bfefd33d1eaa25ba4 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: every reader of the removed _GET_TIMEOUT_SECS is updated, the reason field is additive, and the screenshots are committed.

Notes

  • On a hung mount, each Try again (and each guide-tool retry) leaves one more thread blocked in asyncio's shared default executor. Before, the pane had no retry button, so this was harder to trigger. Enough clicks could starve every other to_thread caller in the gateway. A cheap guard: skip a new read while one for the same Bot is still running.
  • website/AGENTS.md's ErrorNotice rule still says "Next to an unsaved draft, leave it off". Only website/AUTOSDE.yaml learns about the gate form. Update the router line in the same commit so the next author doesn't follow the stale rule.

[DESIGN-REVIEWED] 4ec5be2

Description read

[DESCRIPTION-READ] 3639f0cbf7fe18ce8796ed6af321c1fdbbf7bd24c95cd0cd8ce9819f981de160

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

UX-level review of 4ec5be2bbb9e613f84cf052bfefd33d1eaa25ba4 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks: the attachments show every control this PR adds. No first-time reader has looked at them, because this fork lane has no blind read; pushing the branch to this repository would add one.

Notes

  • The notice title "Couldn’t load this bot’s capabilities." says "capabilities", but its body and the pane heading say "abilities" (attachment-04). Switch the title to "abilities", and keep the body from restating the title: "Loading ran out of time. A bot with many added abilities, or a folder on a slow drive, can take longer."
  • In attachment-01, the discard prompt raised by Ask the agent offers "Discard changes and close". Nothing in it says a chat with the agent opens next. Give this path a confirm label such as "Discard and ask the agent".
  • No screenshot shows the other 503 error, the one that isn't a timeout ("The gateway log has the details."). It doesn't say where that log lives either, so the user has no next step beyond Try again and Ask the agent.

[UX-REVIEWED] 4ec5be2

Description read

[DESCRIPTION-READ] bf273842ee2ceb9912f056c28ab13c4cee321bcafc890c638ee3fe72f25d521e

That sha256 names everything this verdict read: the PR description, plus the 10 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 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — ✅ PASS

Premise-level review of 4ec5be2bbb9e613f84cf052bfefd33d1eaa25ba4 via the fork AI-review pipeline — 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. One note: the diff adds a second parser for error-body fields, though the same PR already uses the existing one.

Notes

  • Item 4 — duplicate of website/src/utils/errorReport.ts:parseErrorField: the diff widens the private refusalDetail into refusalField(err, 'detail' | 'reason') in workerKitErrors.ts, while CrewEditorNextDialog.tsx in the same diff reads reason with parseErrorField(error.body, 'reason'). That makes two parsers for one JSON body field (1 existing, 1 widened). Subtraction: delete refusalField and call parseErrorField(err.body, …) ?? '' behind the instanceof ApiError check.

What this change ships

Inventory (10 items) — 9 justified

Intent: when a Bot's abilities fail to load, the owner and the agent learn why and can retry or hand it off. This is a FIX.

  1. The Abilities load error is now a block notice with a title and a likely-cause sentence — justified
  2. A Try again button reads the capabilities again — justified
  3. Ask the agent is now offered in the editor; over unsaved edits it raises the discard confirm first — justified
  4. The Add abilities pane shows the timed-out sentence — duplicate of utils/errorReport.ts:parseErrorField
  5. Timeout 503s on all three routes now carry reason: timed_out — justified
  6. The gateway log names the Bot when a read times out or finishes late; other 503s log the error type only — justified
  7. The card capabilities route now has a 20 s deadline — justified
  8. get_member_capabilities now waits 30 s and gets a sentence the agent can relay — justified
  9. ErrorNotice gets a gate prop, and the frontend review rule allows that form — justified
  10. Capture page and screenshots — justified

[FIRST-PRINCIPLES-REVIEWED] 4ec5be2

Description read

[DESCRIPTION-READ] c4f6a7cd1f594155f8e83ff9fa3b3055cbb79753188f9bb996de42e9012a401e

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 4ec5be2bbb9e613f84cf052bfefd33d1eaa25ba4 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 4ec5be2

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 4ec5be2bbb9e613f84cf052bfefd33d1eaa25ba4 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 4ec5be2

@bolichen97

Copy link
Copy Markdown
Contributor

@alexcollado the feature-map gate is green now, thanks. Two kinds of red remain on 19a4285:

  • GPT 6.1 Review (blocking), test/test_change_cards_routes.py:892: the stalled-read test's GET has no time bound of its own, so if the route's deadline ever regresses, the test hangs until pytest-timeout kills the worker instead of failing. The fix is small: wrap the GET in kiro_crew.testing.wait.finished(...) and keep release.set() in finally, the way test_member_abilities_read_deadline.py already does. I agree with this one; please push it.
  • E2E (stub ACP backend, offline), Render Benchmark, i18n Render Gate and Real Adapter Contract Tests are not yours: the fork runner moved to ubuntu-26.04 and Playwright 1.58.2 cannot install Chromium there. That is tracked in CI: fork PR jobs fail on the kirocrew-linux-4-core runner's new ubuntu-26.04 image (Playwright install, codex sandbox tests) #37647 and I'm fixing it on our side.

I'll re-approve and re-run CI on your next head.

AI-assisted, sent by Bolin Review bot

@iamwhatever

Copy link
Copy Markdown
Contributor

@alexcollado thanks for this one. The remaining reds on 19a4285196 have two real causes in the PR, plus one stale comment:

  1. Backend Tests (3.12, 5) / (Windows) (8): the new dashboard/handlers/_shared_bounded_read.py matches the _shared_*.py owner pattern, so test/test__shared_handlers_facade.py counts it as a facade owner that is not registered. It is not a facade owner, so the fix is to rename it to _bounded_read.py and update its importers.
  2. GPT 6.1 Review: the GET in test_a_timed_out_capabilities_read_tells_the_model_what_to_say (test/test_change_cards_routes.py) has no time bound of its own. The fix wraps it in kiro_crew.testing.wait.finished(...) and keeps release.set() in finally, the way test_member_abilities_read_deadline.py already does.
  3. website/src/api/crewCapabilities.ts still points at _GET_TIMEOUT_SECS in agent_capabilities.py. It now names GET_TIMEOUT_SECS in _bounded_read.py.

The other reds are not from this PR. Merging current main into the branch picks up #37653, #37677 and #37697, which clear E2E (stub ACP backend, offline), Render Benchmark, i18n Render Gate, Real Adapter Contract Tests and Backend Tests (3.12, 7).

The patch below applies cleanly on 19a4285196. With it the facade, change-card route and abilities-deadline tests pass locally (165 passed).

To apply: save the block below as fix.patch, then run git apply --index fix.patch && git commit -m "fix(crew): keep the bounded capability read out of the _shared facade family", then git merge origin/main and push.

Patch (10 files, +18 / -14)
diff --git a/docs/feature-map/README.md b/docs/feature-map/README.md
index ab1a1c107d..9bf67781ac 100644
--- a/docs/feature-map/README.md
+++ b/docs/feature-map/README.md
@@ -255,7 +255,7 @@ and the Apps group's unpinned set, to a fresh browser profile.
 | Hooks | Event-triggered agent runs | `?tab=hooks` | `pages/HooksPage.tsx`, `pages/hookEventWireValues.ts` (internal split of HooksPage — the event names the picker offers and the rows show, no new user-facing destination) | `handlers/hooks.py` | `GET,POST /api/hooks`, `PUT,DELETE /api/hooks/{hook_id}`, `GET /api/kiro-hooks`, `POST /api/kiro-hooks/rescan` |
 | Workflows | Saved dynamic-workflow definitions and their runs. **Remove** takes a saved workflow out of the library after a confirmation; it is a tombstone, so past runs and workflows adapted from it keep their lineage. A run's detail reads in two modes: the phase **Tree** (what happened, newest work last) and a **Graph** that draws the run's PLANNED phase graph (read off the run's own captured script source) and colours each node from the live run state (planned / running / ran ok / ran failed), marks a phase the plan could not promise runs at all, marks work that ran without being predicted, and says when the plan is partial because the preview hit its ceiling. The plan rides the run-detail snapshot and is requested only while Graph mode is open | `?tab=workflows` | `pages/overview/WorkflowLibraryTab.tsx`, `components/workflows/WorkflowsRuns.tsx` (Tree / Graph switch), `components/workflows/WorkflowRunGraph.tsx` (the drawing), `components/workflows/planModel.ts` (pure model: pair the plan with what ran), `pages/chat/workflowRunsPoll.ts` (internal helper: the chat side panel's runs-list poll cadence; no new user-facing feature) | `handlers/workflows.py`, `workflows/preview.py` (read the planned graph off a script's source), `workflows/update_from_run.py` (append a finished run as a saved workflow's next revision) | `POST /api/workflows/run`, `GET,POST /api/workflows/definitions`, `DELETE /api/workflows/definitions/{ref}`, `POST /api/workflows/author`, `GET /api/workflows/runs/{id}` (carries `plan` when `plan=1`), `GET,POST /api/workflows/runs/{id}/update-definition` (append a finished run to a saved workflow; no dashboard control yet) |
 | Bot abilities | A Bot that owns its file shows **Comes with** (read-only: what the worker base provides) and **Added to** (what its own file adds, each stored row with **Remove**); **Add abilities** unions another agent's connections, skills, resources and auto-approvals into the file, skipping anything already present. The exception is **behavior directions**: the agent's prompt, minus any opening text the worker base already carries, replaces the file's single directions slot; an agent without directions leaves it alone, and **Remove** clears it. The worker appends the slot after its built-in instructions, and the slot records no source agent. Picking an agent previews at once (bound to the file and the agent as previewed, so an apply after either changed shows a fresh preview), listing the auto-approvals it writes | `/capabilities?tab=crews` → Bot → **Abilities** (also from the Bots page's editor; General's **View abilities**) | `components/crew/WorkerKitPane.tsx`, `components/crew/CrewEditorNextDialog.tsx` | `handlers/member_worker_kit.py` (`kiro_crew/mate_worker_kit.py`) | `GET,PUT /api/agents/{name}/worker-kit`, `POST /api/agents/{name}/worker-kit/preview` (each also as `/api/agents/b64/{name_b64}/...` for a name that needs encoding, #20083) |
-| Bot abilities load error | When a Bot's abilities read fails, the Abilities section shows a notice instead of the bands: a read past the 20 s gateway limit (`reason: timed_out`) or the 30 s dashboard limit names the likely causes (many added abilities, a slow or unreachable drive) and points at the gateway log, which names the Bot and how long the read took. **Try again** reads again; **Ask the agent** hands the error to a chat through the editor's leave guard, so unsaved edits ask first. The `get_member_capabilities` guide tool reads the same view under the same limit and answers a sentence the agent can relay | `/capabilities?tab=crews` → Bot → **Abilities** when the read fails | `components/crew/CrewEditorNextDialog.tsx`, `components/crew/workerKitErrors.ts` | `handlers/_shared_bounded_read.py` (used by `handlers/agent_capabilities.py`, `handlers/member_worker_kit.py`, `handlers/change_cards.py`) | `GET /api/agents/{name}/capabilities`, `GET /api/agents/{name}/worker-kit`, `GET /api/cards/agent/capabilities` |
+| Bot abilities load error | When a Bot's abilities read fails, the Abilities section shows a notice instead of the bands: a read past the 20 s gateway limit (`reason: timed_out`) or the 30 s dashboard limit names the likely causes (many added abilities, a slow or unreachable drive) and points at the gateway log, which names the Bot and how long the read took. **Try again** reads again; **Ask the agent** hands the error to a chat through the editor's leave guard, so unsaved edits ask first. The `get_member_capabilities` guide tool reads the same view under the same limit and answers a sentence the agent can relay | `/capabilities?tab=crews` → Bot → **Abilities** when the read fails | `components/crew/CrewEditorNextDialog.tsx`, `components/crew/workerKitErrors.ts` | `handlers/_bounded_read.py` (used by `handlers/agent_capabilities.py`, `handlers/member_worker_kit.py`, `handlers/change_cards.py`) | `GET /api/agents/{name}/capabilities`, `GET /api/agents/{name}/worker-kit`, `GET /api/cards/agent/capabilities` |
 
 `/agents`, `/mc-agents` and `/connections` are legacy paths that redirect here;
 `/knowledge` redirects to `?tab=knowledge`. `/hooks` also stands alone as a
diff --git a/docs/system-specs/modules/crew-mode.md b/docs/system-specs/modules/crew-mode.md
index 5f0164797d..4b58093a3c 100644
--- a/docs/system-specs/modules/crew-mode.md
+++ b/docs/system-specs/modules/crew-mode.md
@@ -907,7 +907,7 @@ their refusal codes below are unchanged.
 The section shows a spinner until its two reads, `GET .../capabilities` and
 `GET .../worker-kit`, settle, and both read files that can block in the kernel
 as long as a hung mount does. Each GET gives up on its read after 20 s
-(`GET_TIMEOUT_SECS`, `dashboard/handlers/_shared_bounded_read.py`) and answers
+(`GET_TIMEOUT_SECS`, `dashboard/handlers/_bounded_read.py`) and answers
 `503 capabilities_unavailable` with `reason: "timed_out"`, leaving the blocked
 read to its thread because a GET mutates nothing. The gateway log records both
 ends with the Bot's name: a warning when the GET gives up, and one with the real
diff --git a/src/kiro_crew/dashboard/handlers/_shared_bounded_read.py b/src/kiro_crew/dashboard/handlers/_bounded_read.py
similarity index 100%
rename from src/kiro_crew/dashboard/handlers/_shared_bounded_read.py
rename to src/kiro_crew/dashboard/handlers/_bounded_read.py
diff --git a/src/kiro_crew/dashboard/handlers/agent_capabilities.py b/src/kiro_crew/dashboard/handlers/agent_capabilities.py
index 0f66c0578e..b5798787a1 100644
--- a/src/kiro_crew/dashboard/handlers/agent_capabilities.py
+++ b/src/kiro_crew/dashboard/handlers/agent_capabilities.py
@@ -12,12 +12,12 @@ from kiro_crew.agent_capabilities import CapabilityError, CapabilityService
 from kiro_crew.config.loader import KiroCrewConfig
 from kiro_crew.dashboard.agent_name_segment import agent_route_name, invalid_agent_name_response
 from kiro_crew.dashboard.chat_utils import drained_to_thread
+from kiro_crew.dashboard.handlers._bounded_read import TIMED_OUT, bounded_read
 from kiro_crew.dashboard.handlers._shared import (
     enumerate_skill_catalog,
     require_owner_dashboard_request,
     skill_uri_for_key,
 )
-from kiro_crew.dashboard.handlers._shared_bounded_read import TIMED_OUT, bounded_read
 from kiro_crew.dashboard.state import DashboardState
 
 logger = logging.getLogger(__name__)
diff --git a/src/kiro_crew/dashboard/handlers/change_cards.py b/src/kiro_crew/dashboard/handlers/change_cards.py
index c74cd631f4..3919bd3e17 100644
--- a/src/kiro_crew/dashboard/handlers/change_cards.py
+++ b/src/kiro_crew/dashboard/handlers/change_cards.py
@@ -45,7 +45,7 @@ from kiro_crew import change_card_catalog as catalog
 from kiro_crew.dashboard import change_cards as cards
 from kiro_crew.dashboard import chat_cards
 from kiro_crew.dashboard.change_cards import CardError, CardStore, card_store_for
-from kiro_crew.dashboard.handlers._shared_bounded_read import (
+from kiro_crew.dashboard.handlers._bounded_read import (
     TIMED_OUT,
     bounded_read,
     timed_out_for_model,
diff --git a/src/kiro_crew/dashboard/handlers/member_worker_kit.py b/src/kiro_crew/dashboard/handlers/member_worker_kit.py
index aff2a54f30..d7fe88fa4a 100644
--- a/src/kiro_crew/dashboard/handlers/member_worker_kit.py
+++ b/src/kiro_crew/dashboard/handlers/member_worker_kit.py
@@ -14,8 +14,8 @@ from aiohttp import web
 
 from kiro_crew.dashboard.agent_name_segment import agent_route_name, invalid_agent_name_response
 from kiro_crew.dashboard.chat_utils import drained_to_thread
+from kiro_crew.dashboard.handlers._bounded_read import TIMED_OUT, bounded_read
 from kiro_crew.dashboard.handlers._shared import require_owner_dashboard_request
-from kiro_crew.dashboard.handlers._shared_bounded_read import TIMED_OUT, bounded_read
 from kiro_crew.mate_worker_kit import WorkerKitError
 
 
diff --git a/src/kiro_crew/mcp_guide.py b/src/kiro_crew/mcp_guide.py
index 854880cb5c..4d469ec3ae 100644
--- a/src/kiro_crew/mcp_guide.py
+++ b/src/kiro_crew/mcp_guide.py
@@ -732,7 +732,7 @@ _LIVE_MAX_TARGETS = 16
 #: dashboard shows (an in-memory read; no tab is asked).
 _UI_LANG_WAIT_SECONDS = 1.0
 #: How long ``get_member_capabilities`` waits for its route: past the route's
-#: own 20 s deadline on the read (``_shared_bounded_read.GET_TIMEOUT_SECS``).
+#: own 20 s deadline on the read (``_bounded_read.GET_TIMEOUT_SECS``).
 _MEMBER_CAPABILITIES_WAIT_SECONDS = 30.0
 
 
diff --git a/test/test_change_cards_routes.py b/test/test_change_cards_routes.py
index 95e17d7a03..b3549bb6de 100644
--- a/test/test_change_cards_routes.py
+++ b/test/test_change_cards_routes.py
@@ -855,7 +855,7 @@ def test_crewmate_delete_memory_line_uses_the_display_name():
 
 
 def test_shim_routes_get_member_capabilities(monkeypatch):
-    from kiro_crew.dashboard.handlers import _shared_bounded_read
+    from kiro_crew.dashboard.handlers import _bounded_read
 
     sent: list[tuple[str, float]] = []
     monkeypatch.setattr(mcp_guide, "_strict_session_key", lambda: (SK, ""))
@@ -868,13 +868,14 @@ def test_shim_routes_get_member_capabilities(monkeypatch):
     assert [path for path, _ in sent] == ["/api/cards/agent/capabilities?member=mate"]
     # Waits past the route's own deadline, so a slow read reaches the model as the
     # route's explanation rather than a bare transport timeout.
-    assert sent[0][1] > _shared_bounded_read.GET_TIMEOUT_SECS
+    assert sent[0][1] > _bounded_read.GET_TIMEOUT_SECS
 
 
 def test_a_timed_out_capabilities_read_tells_the_model_what_to_say(world, tmp_path, monkeypatch):
     import threading
 
-    from kiro_crew.dashboard.handlers import _shared_bounded_read
+    from kiro_crew.dashboard.handlers import _bounded_read
+    from kiro_crew.testing.wait import finished
 
     release = threading.Event()
 
@@ -884,12 +885,15 @@ def test_a_timed_out_capabilities_read_tells_the_model_what_to_say(world, tmp_pa
 
     monkeypatch.setattr(cards, "member_capabilities_view", blocked)
     monkeypatch.setattr(
-        _shared_bounded_read, "GET_TIMEOUT_SECS", 0.05
+        _bounded_read, "GET_TIMEOUT_SECS", 0.05
     )  # flake-ok: the read blocks until released, so the deadline always expires first
 
     async def go(client):
         try:
-            response = await client.get("/api/cards/agent/capabilities?member=Radar", headers=AGENT)
+            response = await finished(
+                client.get("/api/cards/agent/capabilities?member=Radar", headers=AGENT),
+                "GET /api/cards/agent/capabilities with its read blocked",
+            )
             return response.status, await response.json()
         finally:
             release.set()
diff --git a/test/test_member_abilities_read_deadline.py b/test/test_member_abilities_read_deadline.py
index 62b3156ad9..eec0c15c71 100644
--- a/test/test_member_abilities_read_deadline.py
+++ b/test/test_member_abilities_read_deadline.py
@@ -20,7 +20,7 @@ from aiohttp import web
 from aiohttp.test_utils import TestClient, TestServer
 
 from kiro_crew import mate_worker_kit
-from kiro_crew.dashboard.handlers import _shared_bounded_read as bounded_read_module
+from kiro_crew.dashboard.handlers import _bounded_read as bounded_read_module
 from kiro_crew.dashboard.handlers import agent_capabilities as capabilities_handler
 from kiro_crew.dashboard.routes.agents import register
 from kiro_crew.testing.wait import finished
diff --git a/website/src/api/crewCapabilities.ts b/website/src/api/crewCapabilities.ts
index eb6d613779..cbb1359f01 100644
--- a/website/src/api/crewCapabilities.ts
+++ b/website/src/api/crewCapabilities.ts
@@ -66,8 +66,8 @@ export interface CapabilityPreview extends CapabilityView {
 }
 /** Deadline for the two reads the Bot editor's Abilities pane waits on, which
  *  shows its spinner until they settle. Longer than the gateway's own 20s bound
- *  on each read (`_GET_TIMEOUT_SECS` in `dashboard/handlers/agent_capabilities.py`
- *  and `member_worker_kit.py`), so its coded 503 normally answers first; this
+ *  on each read (`GET_TIMEOUT_SECS` in `dashboard/handlers/_bounded_read.py`),
+ *  so its coded 503 normally answers first; this
  *  ends the wait when no answer comes back at all. */
 export const ABILITIES_READ_TIMEOUT_MS = 30_000
 const { getWithSignal, post, put, j } = apiTransport

AI-assisted

auto-merge was automatically disabled November 16, 2026 13:07

Head branch was pushed to by a user without write access

@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Nov 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor

@alexcollado the two blocking reviews on e8728567b8 (Opus 5.5 and GPT 6.1) point at the same defect, and PR Readiness follows them.

Cause. In useCrewEditor.ts, leaveGate parks the hand-off in closeProceed when the editor has unsaved panes. confirmDiscard then calls it directly, and AskAgentButton runs it with leaveGranted: true. So the host page's leave guard is never asked. On /members that drops a pending Heartbeat save, or a Schedules / goals / export draft, without a prompt. Saying yes to discarding the editor's edits is not a yes to losing the page's own work.

Fix. After the discard is confirmed and the sheet has closed, run the continuation through the host's leave. It runs from an effect after the close renders, so the page's guard already sees the editor as closed and does not ask about the editor's edits a second time.

Test. CrewEditorNextDialog.test.tsx gets a case where the page's guard refuses a leave (a write still in flight): unsaved editor edit, Ask the agent, confirm discard. The page guard must still refuse, so nothing is handed off. This case fails on e8728567b8 (sendErrorToChat called once) and passes with the fix. Locally, src/components/crew, src/pages/members and CrewEditorNextDialog.test.tsx pass (87 files, 1553 tests), and tsc -p tsconfig.app.json and eslint are clean.

To apply: save the block below as fix.patch, then run git apply --index fix.patch && git commit -m "fix(crew): keep the host page's leave guard after the editor discard" and push.

Patch (2 files, +28 / -6)
diff --git a/website/src/components/crew/useCrewEditor.ts b/website/src/components/crew/useCrewEditor.ts
index 1996bcc7c1..d9cfe98102 100644
--- a/website/src/components/crew/useCrewEditor.ts
+++ b/website/src/components/crew/useCrewEditor.ts
@@ -803,6 +803,7 @@ export function useCrewEditor(args: UseCrewEditorArgs): CrewEditorController {
   // What runs after a confirmed close-discard: an action that leaves the editor
   // (an error notice's hand-off) and waited on the discard confirm.
   const closeProceed = useRef<(() => void) | null>(null)
+  const leaveAfterClose = useRef<(() => void) | null>(null)
   // Reset the pane whenever the editor points at a new crew (or closes).
   const paneSeededFor = useRef<string | null>(null)
   useEffect(() => {
@@ -921,10 +922,11 @@ export function useCrewEditor(args: UseCrewEditorArgs): CrewEditorController {
     if (target === 'close') {
       closeSheet()
       // A hand-off that asked to leave over unsaved edits runs once they are
-      // discarded (`leaveGate`).
-      const after = closeProceed.current
+      // discarded (`leaveGate`). Discarding the editor's edits is not consent
+      // to lose the host page's own drafts or pending writes, so it still goes
+      // through the host's `leave`, after the close has rendered.
+      leaveAfterClose.current = closeProceed.current
       closeProceed.current = null
-      after?.()
     } else if (target === 'collapse') { collapseProceed.current?.(); collapseProceed.current = null }
     else if (target) setPane(target)
   }, [discardAsk, closeSheet, settleDiscardAnswer])
@@ -936,6 +938,12 @@ export function useCrewEditor(args: UseCrewEditorArgs): CrewEditorController {
       closeProceed.current = null
     }
   }, [discardAsk, settleDiscardAnswer])
+  useEffect(() => {
+    const after = leaveAfterClose.current
+    if (discardAsk !== null || !after) return
+    leaveAfterClose.current = null
+    leave(after)
+  }, [discardAsk, leave])
 
   const discardTakesSheet =
     discardAsk === 'close'
diff --git a/website/src/test/CrewEditorNextDialog.test.tsx b/website/src/test/CrewEditorNextDialog.test.tsx
index bef5f4fb17..adfcc4ff76 100644
--- a/website/src/test/CrewEditorNextDialog.test.tsx
+++ b/website/src/test/CrewEditorNextDialog.test.tsx
@@ -771,7 +771,7 @@ describe('CrewEditorNextDialog — Capabilities view (read-only two bands)', ()
   // The Bots page's own wiring: its registered guard refuses a leave over
   // unsaved panes and only raises the editor's discard confirm, so the
   // hand-off must ride that confirm instead of the page guard.
-  function PageHost() {
+  function PageHost({ pendingWrite = false }: { pendingWrite?: boolean }) {
     const [editingCrew, setEditingCrew] = useState('oncall')
     const crewAgentsQuery = useQuery({ queryKey: ['kirocrew-agents'], queryFn: () => mockApi.kirocrewAgents() })
     const leave = useGuardedLeave()
@@ -786,6 +786,8 @@ describe('CrewEditorNextDialog — Capabilities view (read-only two bands)', ()
     })
     const { dirtyPanes, requestClose } = ctl
     useRegisterNavigationLeaveGuard(() => {
+      // A write of the page's own (a Heartbeat save) still in flight refuses.
+      if (pendingWrite) return false
       if (!editingCrew || dirtyPanes.size === 0) return true
       requestClose()
       return false
@@ -793,13 +795,13 @@ describe('CrewEditorNextDialog — Capabilities view (read-only two bands)', ()
     return <CrewEditorModal ctl={ctl} />
   }
 
-  async function openOnBotsPage() {
+  async function openOnBotsPage(pendingWrite = false) {
     mockCaps.get.mockRejectedValue(new ApiError(503, 'capabilities_unavailable', '{"error":"capabilities_unavailable","code":"capabilities_unavailable","reason":"timed_out"}'))
     const qc = new QueryClient({ defaultOptions: { queries: { retry: false } } })
     const store = configureStore({ reducer: { dashboard: dashboardReducer, chat: chatReducer, notifications: notificationsReducer } })
     render(
       <QueryClientProvider client={qc}><Provider store={store}><MemoryRouter>
-        <NavigationLeaveGuardProvider><PageHost /></NavigationLeaveGuardProvider>
+        <NavigationLeaveGuardProvider><PageHost pendingWrite={pendingWrite} /></NavigationLeaveGuardProvider>
       </MemoryRouter></Provider></QueryClientProvider>,
     )
     return screen.findByTestId('crew-editor-next-dialog')
@@ -829,6 +831,18 @@ describe('CrewEditorNextDialog — Capabilities view (read-only two bands)', ()
     await waitFor(() => expect(screen.queryByTestId('crew-editor-next-dialog')).toBeNull())
   })
 
+  it('on the Bots page, still asks the page guard after the editor discard is confirmed', async () => {
+    const dialog = await openOnBotsPage(true)
+    fireEvent.change(within(dialog).getByTestId('display-name-input'), { target: { value: 'Renamed' } })
+    fireEvent.click(within(dialog).getByTestId('next-rail-builtFrom'))
+    const notice = await within(dialog).findByTestId('next-builtfrom-error')
+    fireEvent.click(within(notice).getByRole('button', { name: /ask the agent/i }))
+    fireEvent.click(await screen.findByTestId('crew-sched-discard-confirm'))
+    await waitFor(() => expect(screen.queryByTestId('crew-editor-next-dialog')).toBeNull())
+    // Discarding the editor's edits does not waive the page's pending write.
+    expect(sendErrorToChat).not.toHaveBeenCalled()
+  })
+
   it('lists comes-with tools, MCP servers and skills in collapsible kind groups, none removable', async () => {
     const dialog = await openNew()
     fireEvent.click(within(dialog).getByTestId('next-rail-builtFrom'))

AI-assisted

Confirming the editor's discard ran the Ask the agent hand-off directly,
and the hand-off is marked leave-granted, so the host page's own leave
guard was never asked: a pending Heartbeat save or a Schedules, goals or
export draft on /members was lost without a prompt. Run the continuation
through the host's leave once the sheet has closed.
@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 labels Nov 17, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

Thanks for 63c27aa. I read it: routing the post-discard hand-off through the host's leave after the sheet closes is the right fix, and the new test (a pending page write still refuses after the editor discard) covers it. I'll approve once CI is green.

CI is red for a reason outside this change. The branch is 266 commits behind main, so the emoji-icon gate in Fast Gate could not find a merge base ("ratchet-scope: found no shared history") and compared against the base tip. Every glyph line main gained since the fork then counted as "added" by this PR, and Await Fast Gate failed with it. None of the flagged lines are in this PR's files.

Please rebase on current main and push. I'll re-review the new head.

AI-assisted, sent by Bolin Review bot

@bolichen97

Copy link
Copy Markdown
Contributor

The CI fix has landed: #38678 (the in-repo copy of #33281) merged, so the diff-scoped gates now measure from the merge commit's first parent. Please rebase this branch onto current main and push; the emoji-icon and Fast Gate reds should clear on the new head. My approval carries over once I re-check the new head.

AI-assisted, sent by Bolin Review bot

@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 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 4ec5be2. The new commit only merges current main into the branch (a remerge diff shows no hand-resolved changes), so the change is still e872856 plus 63c27aa, which I reviewed. That brings in the CI fix from #38678, so the emoji-icon gate should pass now. CI runs on this head are approved.

One note: PR Hygiene may count the merge commit; if it does, a rebase onto main instead of the merge clears it.

AI-assisted, sent by Bolin Review bot

@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 17, 2026
@iamwhatever
iamwhatever disabled auto-merge November 18, 2026 01:39
@iamwhatever
iamwhatever merged commit 539737a into kirodotdev:main Nov 18, 2026
102 of 104 checks passed
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Nov 18, 2026
buluoray pushed a commit that referenced this pull request Nov 19, 2026
#37627)

* fix(crew): say why a Bot's abilities failed to load and how to recover

When the Bot editor's Abilities read timed out, the pane showed only
"Couldn't load this bot's capabilities." with no retry, no hand-off and
no hint of the cause, the gateway logged nothing, and the
get_member_capabilities guide tool waited 10 s on a read with no
deadline and returned a bare transport timeout.

A timed-out read now answers 503 capabilities_unavailable with
reason timed_out, and the gateway logs the Bot and how long the read
took. The pane shows a block notice that names the likely causes,
offers Try again, and offers Ask the agent through the editor's leave
guard so unsaved edits are never discarded silently. The guide route
reads under the same 20 s deadline, the tool waits past it, and a
timeout reaches the model as a sentence it can relay.

* fix(crew): keep the host page's leave guard after the editor discard

Confirming the editor's discard ran the Ask the agent hand-off directly,
and the hand-off is marked leave-granted, so the host page's own leave
guard was never asked: a pending Heartbeat save or a Schedules, goals or
export draft on /members was lost without a prompt. Run the continuation
through the host's leave once the sheet has closed.

---------

Co-authored-by: Alexander Collado <17326459+alexcollado@users.noreply.github.com>
Co-authored-by: zejiangg <zejiangg@amazon.com>
(cherry picked from commit 539737a)
buluoray pushed a commit that referenced this pull request Nov 19, 2026
#37627)

* fix(crew): say why a Bot's abilities failed to load and how to recover

When the Bot editor's Abilities read timed out, the pane showed only
"Couldn't load this bot's capabilities." with no retry, no hand-off and
no hint of the cause, the gateway logged nothing, and the
get_member_capabilities guide tool waited 10 s on a read with no
deadline and returned a bare transport timeout.

A timed-out read now answers 503 capabilities_unavailable with
reason timed_out, and the gateway logs the Bot and how long the read
took. The pane shows a block notice that names the likely causes,
offers Try again, and offers Ask the agent through the editor's leave
guard so unsaved edits are never discarded silently. The guide route
reads under the same 20 s deadline, the tool waits past it, and a
timeout reaches the model as a sentence it can relay.

* fix(crew): keep the host page's leave guard after the editor discard

Confirming the editor's discard ran the Ask the agent hand-off directly,
and the hand-off is marked leave-granted, so the host page's own leave
guard was never asked: a pending Heartbeat save or a Schedules, goals or
export draft on /members was lost without a prompt. Run the continuation
through the host's leave once the sheet has closed.

---------

Co-authored-by: Alexander Collado <17326459+alexcollado@users.noreply.github.com>
Co-authored-by: zejiangg <zejiangg@amazon.com>
(cherry picked from commit 539737a)
buluoray pushed a commit that referenced this pull request Nov 19, 2026
#37627)

* fix(crew): say why a Bot's abilities failed to load and how to recover

When the Bot editor's Abilities read timed out, the pane showed only
"Couldn't load this bot's capabilities." with no retry, no hand-off and
no hint of the cause, the gateway logged nothing, and the
get_member_capabilities guide tool waited 10 s on a read with no
deadline and returned a bare transport timeout.

A timed-out read now answers 503 capabilities_unavailable with
reason timed_out, and the gateway logs the Bot and how long the read
took. The pane shows a block notice that names the likely causes,
offers Try again, and offers Ask the agent through the editor's leave
guard so unsaved edits are never discarded silently. The guide route
reads under the same 20 s deadline, the tool waits past it, and a
timeout reaches the model as a sentence it can relay.

* fix(crew): keep the host page's leave guard after the editor discard

Confirming the editor's discard ran the Ask the agent hand-off directly,
and the hand-off is marked leave-granted, so the host page's own leave
guard was never asked: a pending Heartbeat save or a Schedules, goals or
export draft on /members was lost without a prompt. Run the continuation
through the host's leave once the sheet has closed.

---------

Co-authored-by: Alexander Collado <17326459+alexcollado@users.noreply.github.com>
Co-authored-by: zejiangg <zejiangg@amazon.com>
(cherry picked from commit 539737a)
buluoray pushed a commit that referenced this pull request Nov 19, 2026
#37627)

* fix(crew): say why a Bot's abilities failed to load and how to recover

When the Bot editor's Abilities read timed out, the pane showed only
"Couldn't load this bot's capabilities." with no retry, no hand-off and
no hint of the cause, the gateway logged nothing, and the
get_member_capabilities guide tool waited 10 s on a read with no
deadline and returned a bare transport timeout.

A timed-out read now answers 503 capabilities_unavailable with
reason timed_out, and the gateway logs the Bot and how long the read
took. The pane shows a block notice that names the likely causes,
offers Try again, and offers Ask the agent through the editor's leave
guard so unsaved edits are never discarded silently. The guide route
reads under the same 20 s deadline, the tool waits past it, and a
timeout reaches the model as a sentence it can relay.

* fix(crew): keep the host page's leave guard after the editor discard

Confirming the editor's discard ran the Ask the agent hand-off directly,
and the hand-off is marked leave-granted, so the host page's own leave
guard was never asked: a pending Heartbeat save or a Schedules, goals or
export draft on /members was lost without a prompt. Run the continuation
through the host's leave once the sheet has closed.

---------

Co-authored-by: Alexander Collado <17326459+alexcollado@users.noreply.github.com>
Co-authored-by: zejiangg <zejiangg@amazon.com>
(cherry picked from commit 539737a)
bolichen97 added a commit that referenced this pull request Nov 19, 2026
… main (#39387)

Backports to release/0.13.0 the fixes from #39342, squashed into one
commit and brought up to date with release/0.13.0 after the Kiro Memory
preview backport (#39360). Picks, in order; each [pick sha] is the
commit on the #39342 branch, whose body has main's cherry-picked-from line:

- fix(monitor): wake the session once when its watched PR merges or closes (#37776) [pick 84da419]
- fix(security): match deny rules against Windows program suffixes and cmd/PowerShell in-word escapes (#33569) [pick e4941b7]
- fix(mimocode): refuse a chat that would answer from Xiaomi's hosted model unsigned (#37629) [pick 1bfdce3]
- fix(acp): end a quiet agent-started cycle on the shared runtime's stale gate (#37932) [pick fa870a2]
- fix(conductor): re-read goal-conductor after a compaction (#37917) [pick ccdd67c]
- fix(security): refuse a command nested past 32 substitutions before the floors walk it (#37875) [pick 2f9bd67]
- fix(mates): carry a moved Bot's shell toolsSettings entry as execute_bash instead of holding it (#37973) [pick 16022f4]
- fix: hold an app to its own sessions, jobs and runs (#37804) [pick 3dff0c0]
- fix(acp): keep a KAS chat's stored record when its resume fails after the load (#37955) [pick 6ceb7b5]
- fix(gateway): ignore a repeat SIGTERM during graceful shutdown (#38031) [pick b48287d]
- fix(security): keep a quote in a $( ) from hiding a later ssh (#37558) [pick b9fed61]
- fix(agent): rebuild takes a server's disabledTools from the kiro global (#38147) [pick c50bbcc]
- fix(mcp_gateway): keep the backend when a stub leaves an open listen (#38121) [pick 3e9c7f9]
- fix: refresh plan and model list after a kiro-cli sign-in to another account (#38053) [pick 5ad3d36]
- fix(slack): keep a picture sent in a linked thread for the dashboard turn (#38076) [pick 7f8903e]
- fix: keep a resolved tool policy when the gateway is too slow to answer (#36669) [pick 9be5691]
- fix: open owner-only files and prune overlay folders without following links (#36994) [pick 6a1acc9]
- fix: refuse the local token mint to app backends (#38113) [pick d166dab]
- fix(subagent): hold a spawn's first prompt for its MCP servers (#38127) [pick e3e0298]
- fix(security): refuse a headless git --output write with no approver (#36326) [pick 1abee40]
- fix(restore): require an explicit mode, never default to replace (#38094) [pick ca86c06]
- fix: make the deny gate's shell walk linear in command length (#36437) [pick 22c100b]
- fix(chat): let a cancelled background start finish its session teardown (#36664) [pick b1dd34f]
- fix(acp): refuse a start when two differing specs declare the agent's name (#38411) [pick 80ccfff]
- fix: probe a silent turn while its co-tenant keeps the process busy (#38662) [pick 6354490]
- fix(kas): let a reopened chat switch to models its load select omits (#38376) [pick 1640822]
- fix(cloud): install a patched node 22 on run on aws instances (#38732) [pick 059cb90]
- fix: write member record files without following links (#37303) [pick aac9642]
- fix: fail a kas start fast once the host has turned its mcp off (#38677) [pick e147238]
- fix(decisions): fall back to HTTP/1.1 when h2 is missing (#38759) [pick fc16482]
- fix(mcp_gateway): free a spawn permit when its backend exits before initialize (#38793) [pick a084ba2]
- fix(kas): start an app chat whose tool policy hides every kirocrew-cron tool (#38761) [pick ccea5a9]
- fix(acp): give the tool-stall watchdog a margin over native waits (#34117) [pick b5d9e89]
- fix(mcp): bind the working-folder answer to its launch; observe launch changes behind name grants (#38983) [pick a1069be]
- fix(mcp): hide the gateway secret files from the npm install and third-party probe spawns (#39000) [pick 14d8571]
- fix(sandbox): fold env name case on Windows in the agent env scrub (#33997) [pick 9bdce76]
- fix(apps): let app turns follow the Auto approval mode (#38830) [pick e8336df]
- fix: end a dashboard turn stopped while it is still being prepared (#36478) [pick 37fff93]
- fix(acp): cleanup_session deletes the record on the session's own host (#39046) [pick 31b5ec4]
- fix(acp): scan only the new part of a streamed tool result (#38852) [pick e2870db]
- fix(sandbox): make an unscoped session host the OOM victim, not the gateway (#39189) [pick 2be6dde]
- fix(security): read aws s3 downloads piped into tail, with 2>&1, or with an AWS_PROFILE prefix (#38271) [pick bf65d97]
- fix: redact four display and log paths and use a fixed 502 message for session switch refusals (#38982) [pick 55d9ec7]
- fix(sandbox): pin a credential-masking app's folder after the masks on the namespace backend (#34339) [pick afd2b14]
- fix(acp): wait for systemd scope admission as its own startup stage (#37008) [pick 3e29c86]
- fix(acp): wait for systemd scope admission on the AcpClient spawn path (#38303) [pick 85f0a25]
- fix(acp): stamp the spawn instance on the AcpClient child (#38810) [pick f36eb5a]
- fix: end the turn when the agent never confirms a stop (#38512) [pick 2665c9d]
- fix(kas): renew a refused crew sign-in instead of failing every start (#38978) [pick 2f48cac]
- fix(security): keep self-host detection when the ssh verb is a glob (#34056) [pick ab53f10]
- fix(security): judge each substitution body for ssh-to-self (#37616) [pick d5b7ac3]
- test: check the ssh floor's nesting bound below the gate's depth cap (#37964) [pick 6c9ae1d]
- fix(mate): apply held Bot limits on shared claude sessions and refuse unnarrowed KAS children (#39212) [pick 721bbbe]
- test(integration): wait out and reset the hidden-chat refresh between boots (#37933) [pick e77586d]
- fix(browser): fall back to Kiro's Chromium under Automatic when Chrome's remote debugging is off (#39265) [pick 31912eb]

Left out of #39342's set (not needed for 0.13.0): the provider_labels
refactor, #34045, #36668, #39120 and #37627.

Merge with release/0.13.0: kept both imports in runtime_session_load,
runtime_spawn_launch and session_provider; session_allocation lists the
memory_policy owner; the keep-record resume path passes kas_memory_mode
as main does; dropped the ACP_BACKENDS_SESSION_EVICTION import that
moved to session_provider_new_conversation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants