Repository navigation
fix(crew): say why a Bot's abilities failed to load and how to recover - #37627
Conversation
Code change approver recommendation: A person should decideWhy: 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 ( Checks I made against the code:
On the frontend:
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 |
bolichen97
left a comment
There was a problem hiding this comment.
Reviewed head 254b64c. Approving.
bounded_readkeeps the old behaviour of the two GETs (same 20 s deadline, read left to its thread) and only adds the logs andreason: timed_out.except TimeoutErrorsits beforeexcept (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_capabilitieswaits 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'sleaveguard, so it cannot discard unsaved edits without the prompt. Thewebsite/AUTOSDE.yamlrule text matches that. - Local run:
test_member_abilities_read_deadline.py,test_change_cards_routes.py,test_guide_routes.py147 passed;WorkerKitPane.test.tsx,workerKitErrors.test.ts,CrewEditorNextDialog.test.tsx116 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
|
@alexcollado one red check to fix on 254b64c, the rest follow from it:
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 |
Head branch was pushed to by a user without write access
254b64c to
19a4285
Compare
bolichen97
left a comment
There was a problem hiding this comment.
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
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: every reader of the removed Notes
[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 |
UX Review (Opus 5.5, fork) — ✅ PASSUX-level review of 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
[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 |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of 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
What this change shipsInventory (10 items) — 9 justifiedIntent: 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.
[FIRST-PRINCIPLES-REVIEWED] 4ec5be2 Description read[DESCRIPTION-READ] c4f6a7cd1f594155f8e83ff9fa3b3055cbb79753188f9bb996de42e9012a401e That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
|
@alexcollado the feature-map gate is green now, thanks. Two kinds of red remain on 19a4285:
I'll re-approve and re-run CI on your next head. AI-assisted, sent by Bolin Review bot |
|
@alexcollado thanks for this one. The remaining reds on
The other reds are not from this PR. Merging current The patch below applies cleanly on To apply: save the block below as 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 } = apiTransportAI-assisted |
Head branch was pushed to by a user without write access
|
@alexcollado the two blocking reviews on Cause. In Fix. After the discard is confirmed and the sheet has closed, run the continuation through the host's Test. To apply: save the block below as 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.
|
Thanks for 63c27aa. I read it: routing the post-discard hand-off through the host's CI is red for a reason outside this change. The branch is 266 commits behind Please rebase on current AI-assisted, sent by Bolin Review bot |
|
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 AI-assisted, sent by Bolin Review bot |
bolichen97
left a comment
There was a problem hiding this comment.
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
#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)
#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)
#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)
#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)
… 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.
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_capabilitiesguide tool waits 10 s on a route with no deadline and hands the agent a baretimed 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
worker_summaryper-row fix is a separate PR).GET_TIMEOUT_SECSstays 20 s,ABILITIES_READ_TIMEOUT_MSstays 30 s)._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.
components/crew/CrewEditorNextDialog.tsx)components/crew/workerKitErrors.ts)get_member_capabilities(src/kiro_crew/mcp_guide.py)timed outafter 10 sThe 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'sABILITIES_READ_TIMEOUT_MScomment inwebsite/src/api/crewCapabilities.tsnames that module'sGET_TIMEOUT_SECS. A timeout's 503 keepscode: capabilities_unavailableand addsreason: "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.
ErrorNoticenow takes agate(forwarded toAskAgentButton, which already had one). The editor passes its leave guard (useCrewEditor'sleaveGate). 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.yamllists that form beside the others. The strings are inen.manual.jsonand all eleven translations, anden-XA.jsonis regenerated.docs/system-specs/modules/crew-mode.mddescribes the behaviour, andwebsite/capture/abilities-load-error.tsxis the capture page for the screenshots below.Backwards compatibility
Compatible: every 503 keeps its
errorandcode;reasonis a new field, and the card route'serrorwas not a timeout answer before (that route had no deadline).Removes nothing: no route, field, key or prop is removed.
_GET_TIMEOUT_SECSmoves from the two handlers toGET_TIMEOUT_SECSin the shared module; only the deadline test read it.Tests
test_member_abilities_read_deadline.py: both GETs answerreason: timed_outwhile 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.tsxandworkerKitErrors.tsback, all 8 new frontend cases fail.Determinism: 20/20 runs at
-n0, 10/10 at-n 4 --dist loadgroup --max-worker-restart=2withtest_guide_routes.pyas 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:
320 px, Try again, Ask the agent over a draft, Add abilities
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
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement