Skip to content

feat: show a stale-config badge on a chat running outdated config - #14810

Closed
billygerhard wants to merge 1 commit into
kirodotdev:mainfrom
billygerhard:feat/stale-config-turn-boundary-reload
Closed

billygerhard wants to merge 1 commit into
kirodotdev:mainfrom
billygerhard:feat/stale-config-turn-boundary-reload

Conversation

@billygerhard

@billygerhard billygerhard commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Show when a chat runs on outdated config, so the person knows a Reload of that session is needed to pick up an MCP server, agent spec or mcp.json change.

A chat's agent process reads its agent spec (including each mcpServers entry and the env it hands its server), the mcp.json files and the ACP backend once, when it is spawned. Enabling or editing an MCP server, or fixing an agent spec, after a chat started never reaches that chat. The remedy exists and keeps the conversation: Reload session in the session menu. Nothing tells the person it is owed, so they conclude the new server is broken, or start a new chat and lose the thread.

Why it matters

The failure is silent: the setting shows as enabled and the chat simply cannot see it. It hits anyone who configures tools mid-conversation, which is the normal way people add an MCP server. A visible "Config changed · Reload" button turns that silent failure into a one-click Reload, without the dashboard relaunching anything on its own.

Not a goal

  • Reloading a chat automatically. This change relaunches nothing. On main the dashboard's own MCP and agent-config writes (/api/mcp/, /api/agent/config) already reset every session (handlers/sessions.py:_reset_all_sessions); the badge covers the edits those resets never see -- a spec or mcp.json changed in an editor, by an agent, or through the other config routes -- and a person still presses Reload.
  • A new agent-triggered relaunch. The agent surface added here is read-only.
  • Flagging an MCP edit a hot-reloading kiro-cli (2.21+) has already applied live.
  • Reacting to a changed configured default model or effort, or to the MCP gateway's stub-server set (applied at the next gateway start).
  • Recovering a remote MCP server's transport after a network drop.
  • A "Reload affected chats" action on the Connections page after a server edit: Connections page: "Reload affected chats" after an MCP server edit #23137.
  • Making the phone form's visible label ("Config · Reload") part of the button's accessible name, which is the long form today: Stale-config Reload button: phone label is not inside its accessible name #23136.

What changed (motivation → approach → change)

Goal → approach: record what a chat's process was spawned with, compare it cheaply against what the same spawn would read now, and show the difference on every stale chat, idle ones included. The comparison runs in the background at each turn's end, right after any of the gateway's own config writes, on a stat-guarded sweep every 60 s for edits made outside the gateway, and on an agent's request; no config writer has to know which chats it affects.

  • Fingerprint (src/kiro_crew/dashboard/stale_config.py, new). Built from FIELDS, each file screened by the credential gate (hooks.validate_file_path) and then read whole through a component-wise pin of its directory (up to the spec resolver's 8 MB agent.PINNED_SPEC_DIR_MAX_TOTAL_BYTES budget), so a link or junction swapped in at any parent folder after the check is refused rather than followed, in two halves:
    • reconcilable: the mcpServers entries (with disabled / disabledTools) of the loaded spec and of the global and workspace mcp.json, plus @server refs ADDED to tools. On a hot-reloading provider the refs a completed turn ran with are folded into the record at the turn's end (adopt_live_refs), read from the receipt its admission took (take_turn_receipts, one file read on such a turn; detached synchronously when the turn ends so a queued successor's admission cannot overwrite it under the refresh) rather than from the disk as the turn ends: the reconcile mounts an added ref at the turn boundary but never unmounts one whose server keeps running, so a ref added, used by a turn and then removed, during that turn or later, reads stale rather than current. The one removal that is not stale there is a ref removed together with its server's switch-off (the dashboard's toggle writes both): the reconcile stops that server, so the fingerprint carries the set of servers declared and enabled in the spec and in each mcp.json the spec mounts (live_server_refs; an excluded mcp.json contributes only the Kiro Crew servers Crew mounts itself) and a removed ref whose server is outside it needs no Reload; each ref is looked up through the server it names (ref_servers), so a @server/tool ref is judged like a whole-server one. Stale only on a provider that does not apply MCP edits live (mcp_hot_reload.provider_hot_reloads). A Kiro Crew server's entry in either mcp.json is the exception: Crew reads it at each session start to decide whether to mount the session's identity element, so a change to it is stale on every provider. The mcp.json files are parsed as the session's own reader parses them (JSONC: comments and trailing commas), so a comment-only edit reads as unchanged; they are compared whole only when the spec mounts their servers (includeMcpJson as the backend reads it: absent is true on kiro-cli and false on KAS, and an array-backed backend never mounts them); otherwise only each server's disabled / disabledTools and the Kiro Crew identity-bound entries Crew reads at every spawn are compared. Toggling includeMcpJson is a spawn-only spec change.
    • A session whose projection Crew re-sends in place after a dashboard MCP write (KAS, apply_pending_mcp_reinjection) keeps its provider but runs on the spec and MCP set that load read. The admission of the turn that applies it (mcp_reinjection_pending) takes that config as a receipt on the record; when the provider's mcp_projection_generation has moved, the next check re-records its baseline from the receipt's spec and MCP parts (adopt_reprojection), keeping the spawn's backend, backend_key and derived_from, which a re-injection does not re-read. An edit made during that turn, a pending backend change and a default-spec edit still read stale. With no receipt, or while the re-injection is pending or failed, the spawn's baseline stands.
    • spawn_only: every other spec field (prompt, hooks, resources, all of allowedTools, non-@server tools, a REMOVED @server ref, ...) and the ACP backend; for a derived agent (kirocrew-worker, kirocrew-heartbeat) also the default spec's surface it is re-derived from at spawn (agent.derived_surface_fingerprint, the spawn's own freshness comparison, minus model, which is applied through its own path or kept out by a user pin and never by a Reload), since an edit to kirocrew.json a Reload would apply leaves the derived file on disk unchanged. Stale on every provider. A field the chat's backend never receives is left out, read from that backend's declared agent-config rulings (agent_sdk.backend_mcp_ability): a concern its mirror rules no-channel and Crew does not carry itself (SessionCapabilities.crew_fires_spec_hooks). Today that is hooks on claude and codex, so editing hooks there does not badge; on kiro-cli, KAS, goose and opencode it still does.
    • The spec's model field and the MCP gateway stub set are not inputs.
    • An input that exists but cannot be read (permission error, refused by the credential gate, over the size cap) or an agents directory that cannot be listed makes the answer unknown, never "current"; it is carried forward as recorded rather than compared. An absent file is a real change.
  • Windows. On Windows the badge does not scan config folders and reports unknown (stale_config.WINDOWS_SCAN_DISABLED: the fingerprint, the sweep's stat signature and the status check return before touching the filesystem), because resolving an agent-writable config path by name there can be redirected to a network share and trigger an outbound SMB authentication that leaks the Windows login. The badge works as described on macOS and Linux.
  • Unreadable project folder. An agent making the project's .kiro/agents folder unreadable no longer hides edits to the user-level spec: the two folders are tracked separately, so only the unreadable one is unknown and a chat running on the user-level spec is still badged when it changes. Config files are read within the spec resolver's 8 MB budget, so a planted oversized mcp.json reads as unknown instead of costing a large parse on every re-check.
  • Which spec file is the one the chat's backend loads (_agent_spec_files): kiro-cli reads *.json only (checkout .kiro/agents first, then ~/.kiro/agents), so a markdown spec is never its file; KAS reads ~/.kiro/agents first, either form, a .json twin beating the .md, then the crewmate folder (~/.kiro/mates/agents, and first for the mate conductor and worker), and falls back to the checkout's spec for a name neither declares, reduced to the keys it honours there (acp/harness/kas.resolve_projected_spec; agent_sdk.agent_specs.kas_project_spec_view), so a project-only agent's prompt edit badges and an edit to a checkout key KAS ignores does not; every other backend uses the spec acp/session_mcp reads for it, composed as that mirrored session consumes it: with same-named checkout and user specs the session runs on the USER spec with only the checkout spec's switch-off keys layered on (the checkout is not trusted to choose MCP servers), so the fingerprint digests that composed document through the same two session_mcp helpers (_mirrored_document), and a checkout-only server edit is not stale there while a user-spec argument edit is. The spec is resolved and read only through a pinned handle on each agents directory (agent.pinned_agent_spec_path, json_only=True for kiro-cli), never by the screened name again; each directory is pinned one path component at a time from the filesystem root, so a link swapped in at any parent folder after the check is refused rather than followed; a directory that cannot be pinned, that lists more than PINNED_SPEC_DIR_MAX_ENTRIES (4096) entries, or whose specs sum past PINNED_SPEC_DIR_MAX_TOTAL_BYTES (8 MiB, the aggregate read budget, since a declared name means every listed spec is parsed) reads as unknown, so the old fingerprint is carried forward and the chat is never badged on it.
  • Record (src/kiro_crew/dashboard/config_staleness.py, new; chat_runner.py). A turn whose live provider has no record yet fingerprints off the loop before it acquires the provider (a provider replaced during the acquire is fingerprinted once acquired) and records it against that provider (weakly keyed, first record per provider). A prewarmed provider is recorded by the eager spawn, from a fingerprint taken before its handshake; when the managed default spec is missing it takes none and leaves the heal to the spawn (regenerating it rebuilds every managed spec and re-reads the config dozens of times, where the eager path loads it once), and the first turn fingerprints the healed spec. A warm-pool process is fingerprinted before it starts (SessionManager.spawn_config_reader, wired by the gateway) and the claiming chat records that one. A process no turn started -- a hard stop's eager respawn or a reset's successor -- is fingerprinted before it starts (SessionManager.respawn_config_reader, wired by the gateway, for the spawn inputs the chat's previous process was recorded under) and carries it on the new provider only when the successor is started as the agent that record names (a hard stop's eager respawn asks for no agent and runs the default one, so a chat on another agent carries nothing and its next turn records the process it actually gets); the chat adopts it as that process's record. That pre-start read is bounded (RESPAWN_CONFIG_TIMEOUT_S, 2 s): a config directory that stalls delays no respawn, the successor starts without a receipt and reads as unknown until its next turn. A live process no record describes reads as unknown (stale null; the tool says the check could not run), never as current, and the badge stays off. Spawn-side fingerprints first run the spawn's own pre-start steps in its order — ensure_agent_materialized, then the require_fresh_derived_spec freshness gate — so a deleted managed spec the spawn regenerates, or a worker mirror it re-derives, is recorded as the spawn will read it; a gate refusal, which refuses the spawn too, records no fingerprint.
  • Refresh triggers (config_staleness.py). A middleware schedules a refresh of every live chat after a successful write through the agent, capability and MCP routes (/api/agents*, /api/agent/config, /api/capability/*, /api/mcp/*; the /api/mcp-gateway/* writes touch only mcp_gateway.* config or an in-process resolve cache, which no fingerprint reads, and the /api/agent-ask/* writes open or answer an agent's question card), off the request path and coalesced so a burst costs at most one extra pass; a test enumerates the registered non-GET agent, capability and MCP routes and pins each to a prefix. A change to the ACP backend in config.json arrives through the process ConfigWatch (subscribe_backend_changes, on agent.acp_backend / agent.member_acp_backend), so config.json keeps its single watcher. config_stale_sweep_loop ticks every CONFIG_STALE_SWEEP_SECS (60 s) for hand edits: it takes a stat-only signature of each live chat's inputs (stale_config.input_signature: lstat (mtime, size and ctime, so a permission change counts) of both agents directories plus their spec listings, so a newly added spec counts, and both mcp.json files; nothing is opened) and re-fingerprints a chat only when that signature changed since its last check. A reading left unknown by an unreadable input records the signature too, so it is not re-fingerprinted every tick. Work runs off the loop, at most four chats at once; a chat mid-turn (its turn's end covers it) is skipped, and one with no live, recorded process (an idle session that expired) has its badge cleared. The write-refresh middleware sits in each chain's ordered app.middlewares[:] = [...] list (dashboard/server_runtime/middleware_chain.py, handed in by both entrypoints), so that assignment cannot drop it; the sweep, its ConfigWatch subscription and the warm-pool reader are wired from the config_watch owner. The spawn record keeps a sha256 digest per input part, not the field text.
  • Badge. refresh_config_stale publishes config_stale and config_stale_inputs (display-safe labels: project-relative or ~ paths, each passed through the outbound credential/URL sanitizer, so an agent-planted spec whose file name carries a credential-shaped string is redacted on the slot, in broadcasts and in the session_config_status answer, for both the changed and the unreadable lists) on the slot projection, broadcasting only on a change; an unknown reading leaves the badge as it was. The Reload action clears it, and it clears on its own when the config returns to the spawned state. The frontend shows ONE call to act in the chat header, placed per width so the phone bar keeps its two controls (max-two-buttons-per-row). On the desktop title row it is a warn-toned Config changed · Reload button (StaleConfigReloadButton) right after the session title: one click calls the same useSessionActions().reload(slotKey) the menu row calls, and it is disabled while a turn or sub-agents run, through a hook it shares with that row; while its own reload is in flight it is aria-busy and the arrow turns (in both forms), so a button working on the press reads apart from one blocked by a running turn (hooks/useReloadBlocked.ts). While a chat is stale the title's hover Rename and Auto-title buttons are not shown (SessionTitleControl hoverActions; both stay in the session menu, which lists Auto-title on the desktop only then), so the row holds two controls: the session menu and Reload. A header reload the gateway refuses (a turn started first, or sub-agents still working) is reported through the chat's action-error notice above the composer (with the agent hand-off), not an alert and not a notice of its own in the header row; the button stays enabled for a retry and a double press sends one request. The inline Reload is hidden, not unmounted, while an Auto-title Undo is offered (Undo is a control the row cannot hide), and Reload stays in the session menu meanwhile; a reload already in flight still reports its failure to the header's notice. The button is keyed by chat, so moving to another stale chat mid-reload gives that chat its own enabled button and the first chat's late result reports nowhere. On the phone bar it is a non-interactive cue inside the existing title/menu trigger (StaleConfigCue): an alert glyph and Config · Reload before the title, the glyph's accessible label carrying the full tooltip, so a tap on the title opens the session menu whose Reload session row applies the change; the bar adds no control of its own. Its tooltip names the changed file ("… changed since this session started. Reload the session to apply."). The sidebar row carries a warn-colored alert mark (CircleAlert, not a refresh arrow) directly after the agent name, with the same tooltip. The session menu's Reload session row stays as a second path and says "config changed · reload to apply", or, while Reload is blocked, "config changed — reload when the turn ends" / "… when sub-agents finish". When changed files are named, only that list truncates to fit the menu; the remedy after it always shows in full, and hovering shows the whole sentence. On a phone (below md) the note drops onto its own line under the Reload label and the remedy wraps, and every menu that renders the session actions is capped to the viewport width (max-w-[calc(100vw-1rem)]), so the row fits at 320px in every locale. The condition is named "Config changed" on every surface, in every catalog.
  • Agent surface: a read-only session_config_status session-control tool (GET /api/session-control/config-status, strict-internal), authorized as session_summary is except that the caller's own chat is a valid target (the usual case: checking that your own MCP edit reached you), and re-checked after the config read. It returns stale (true / false / null), what changed and what could not be read, refreshes the same badge, and never reloads. Its in-repo consumer is the debug-gateway builtin skill (src/kiro_crew/builtin_skills/debug-gateway/SKILL.md, "Ask before you conclude", step 4): an agent that has just added or changed an MCP server or agent spec for a chat calls it before concluding the change did not land, and tells the user to press Reload when the chat has a stale config. Without it, that agent sees the new server missing and tells the user the server is broken. It is one identity="strict" row of mcp_dashboard.TABLE beside session_summary, so the table's session-control gate, SESSION_CONTROL_TOOLS and the channel-agent block all cover it. Blocked for channel agents with the other cross-session reads. The dashboard MCP server now has 32 tools.
  • Docs: docs/system-specs/modules/session.md (Stale-config detection), src/kiro_crew/docs/agent-spec-fields.md (which field makes a chat stale), src/kiro_crew/docs/session-control.md, docs/system-specs/modules/session-control.md (tool/route table), the feature map.

Backwards compatibility

Compatible: one read-only route and tool and two slot-projection fields are added; no existing route, payload field or behavior changes, and this change relaunches nothing.

Tests

  • test/test_stale_config.py:
    • fingerprint halves by field, both mcp.json files, backend, markdown and per-backend spec resolution, whole-file reads past 4 MB, the size cap, unreadable/refused/absent inputs, a spec or mcp.json nested past the JSON parser's depth read like a syntax error and an unlistable agents directory; a same-named user spec added or removed while the workspace spec is loaded is not stale (the shadowed path is in no digest), and a workspace-spec chat stale for an mcp.json edit names only that input when a user spec also appears; a loaded spec that loses read permission is unknown and carried forward, not absent; a symlinked, hardlinked or directory spec-named entry for another agent beside the spec (user or workspace scope) is skipped, so a later edit of the real spec still marks the chat stale and the input is not unknown;
    • a hooks edit does not badge a codex or claude chat (a prompt edit on the same backend still does) and does badge kiro-cli, goose and opencode;
    • is_stale by half and provider (a hot-reloaded MCP edit is not stale; a spawn-only edit is);
    • the record kept per provider, the prewarm and warm-pool records; a prewarm with the managed spec missing records nothing and leaves the heal to its spawn; a hard stop's eager respawn and a reset's successor recorded with no turn, so a later spec edit badges the chat; a respawn keeping a warm-pool claim's own fingerprint; a carried fingerprint for other inputs not adopted; an eager respawn carrying no receipt for an agent it does not run, and a reset's successor started as the recorded agent carrying it; a live provider with no record reported unknown, not current;
    • the badge set only when stale, cleared when the config returns, unchanged on an unknown reading, and the Reload action clearing it;
    • idle chats: badged right after a gateway-side MCP add with no turn; badged after a hand edit on one sweep tick and cleared when the edit is reverted; an unchanged stat signature fingerprints nothing; a new spec file in the directory changes the signature; a chat mid-turn or with no process is skipped; the middleware fires only on a successful write; a write burst coalesces into at most two passes; the gateway wires both triggers;
    • session_config_status: the verb, the caller reading its own chat, its refusals (mirrored target, session control off, a fenced caller reaching a peer it did not create), the route's refusal mapping and strict-internal registration, the tool's replies (a check that names no file says to try again rather than blaming a config file) and its channel block;
    • and that the turn path has no automatic reload.
    • Windows (driven on any host through stale_config.WINDOWS_SCAN_DISABLED): the fingerprint, the stat signature and the status check touch no filesystem helper, the signature is constant, the status is unknown without recomputing, and two such fingerprints never compare stale. Each test fails with the short-circuit removed.
    • a spec file named with a credential-shaped string shows redacted in its label (workspace and user scope), on the slot projection and in the status's changed list after it is planted, and in the unreadable list when it cannot be read;
    • the prewarm-cancel test waits for the fingerprint stub with a bounded deadline, fails at once if the spawn returns first, and releases its worker in finally; the permission-signature test injects distinct st_ctime_ns values through PinnedDirectory.lstat instead of waiting on the filesystem clock;
  • website/src/components/StaleConfigBadge.test.tsx: the sidebar mark is the alert glyph (no refresh arrow) with the plain tooltip and generic fallback; the header button reloads its slot in one click, is disabled while a turn runs and while sub-agents are attached, carries no order- class at any breakpoint (only the "Config changed" words hide below sm), renders nothing once current, and is not inside the session-menu trigger. website/src/test/ChatPage.mobileSingleTopbar.test.tsx and ChatPage.mobileTopBarActions.test.tsx: on the phone bar the title trigger contains the cue (glyph + "Config · Reload", full tooltip as its label) only while stale, the bar renders no Reload button, and the cue is no button or focus target; on the desktop inline row the button follows the title group.
  • website/src/components/SessionActionsMenu.cov80.test.tsx: the Reload row's stale note, alone and beside "sub-agents working", only the changed-input list truncates, the remedy clause stays whole in all three states, and the title is the full sentence; on a narrow screen the row wraps and the note stacks under the label (basis-full, md: restoring the desktop row) and the remedy wraps (whitespace-normal, md:whitespace-nowrap md:shrink-0). website/src/test/ChatHeaderMenu.slack.test.tsx: the header session menu is capped to the viewport width. The capture script fails if the menu or the remedy reaches past a 320px viewport, in English or Japanese. website/src/test/ChatSidebar.staleConfigBadge.test.tsx: the sidebar mark sits directly after the agent name, ahead of the memory-mode glyphs, and is the alert glyph with the plain tooltip. The capture script also fails if the header button is not right after the title, or if a click on it does not POST the session's reload.
  • Loader parity: for kiro-cli, KAS and each of the five array-backed backends, four layouts (workspace JSON + user JSON, workspace .md + user JSON, user .md only, a name-declared spec beside a filename match; plus workspace-only and three crewmate-folder layouts for KAS) assert the fingerprint watches the file the real loader picks (harness.kas.resolve_projected_spec, session_mcp._agent_spec_and_snapshot_for, kiro-cli's JSON discovery with markdown_spec_for_agent), so loader drift fails a test.
  • includeMcpJson parity: for absent, true, false, null and a non-bool flag, the per-backend mount rule is pinned to its owner: KAS to what kas_agents.to_client_custom_agent forwards, each array backend to session_mcp.session_mcp_servers (which never hands over an mcp.json server), and kiro-cli, whose rule lives in the kiro-cli binary, to the includeMcpJson reading agent_capabilities applies. A last test fails when a backend joins the registry without a pinned rule (pi has no in-repo owner; it is pinned as not mounting). Each was mutation-probed against the stale_config copy.
  • Robustness: a raising inputs, fingerprint, record or refresh step never breaks a turn (the real _run_chat path, through the fallback-attribution harness); a Reload or rebind landing while a check reads the config drops that answer instead of re-badging the fresh session; each agents directory's listing is streamed into a bounded signature: the lexicographically smallest SIGNATURE_MAX_SPEC_ENTRIES (256) names in a bounded heap, plus a fixed-size overflow marker (count and an order-independent XOR of per-entry sha256 over name and stat) that changes on any edit, add or removal past the cap; no list of all names is built. Gateway cleanup cancels and awaits the sweep task and cancels the ConfigWatch subscription (both entrypoints), and the built-app test asserts neither survives runner.cleanup().
  • Wiring and footprint: the built start_api_server app carries the write-refresh middleware and a config write through it schedules the refresh; both entrypoints list it inside their ordered middleware chain; a badged chat whose session expired is cleared; the record's per-input parts are 64-character digests (the @server tool refs too, capped at FINGERPRINT_MAX_TOOL_REFS (256) with one overflow entry) even for a 5 MB spec; the sweep is enumerated as a slot.running reader in test_slot_running_readers.py.
  • Provider contract: pool_spawn_config is declared on LLMProvider (default None, no receipt) and read directly; an input unreadable at spawn is adopted once and persisted, so a later edit to it is stale; an unlistable agents directory keeps the recorded spec selection (spec_path / spec_ws / user_spec_path are carried forward) and reads unknown, not changed.
  • Mutation probes, all killed: each of the three post-await identity checks, the overflow marker, the cap, the overflow digest ignoring stats, the bookkeeping guards around inputs, record and refresh, the menu note's blocked wording, the middleware left out of either entrypoint's chain, the expired-session clear removed, the part digest replaced by the raw text, the sweep's reader-enumeration entry dropped, the ABC default, the pool fill setting the receipt, reading it with getattr again, the adopted baseline not persisted, the selection metadata not carried forward, the write-triggered refresh disabled, firing on a failed write or on reads, or never running; the sweep's stat guard removed, its signature never stored, or the sweep running unguarded; the mid-turn skip removed; the spec-directory listing dropped from the signature; the user agents directory dropped from it; the middleware not installed; the badge set regardless of staleness, the hot-reload exemption removed (in is_stale and in the status), the verb skipping its gate, the tool dropping the refusal, the Reload action not clearing the badge, the frontend badge shown without config_stale, the menu note shown unconditionally; the tool-ref digest and its cap/overflow; the member-DM backend-key label; the aggregate spec-read budget (EFBIG); the component-wise pin reverted to one absolute open; the sidebar badge moved back behind the memory-mode glyphs; the remedy clause made truncating; the mcp.json read put back to a by-name read after the gate; /api/mcp-gateway/ put back in the refresh prefixes; the includeMcpJson reading per backend, the restriction view, and the effective-view picker; the spawn-fingerprint heal dropped; the Kiro Crew identity entry compared after the hot-reload shortcut; the sweep guard skipped on unknown readings and ctime dropped; the pre-acquire fingerprint taken unconditionally; /api/capability/ dropped from the refresh prefixes; the spawn-fingerprint freshness gate dropped; the shadowed user spec's path hashed into the spawn-only digest; the backend-unconsumed-field filter removed; the pinned resolver skipping an unreadable spec instead of raising; the pinned resolver raising on a refused link or non-regular entry instead of skipping it; the shadowed user spec's path counted by changed_inputs; the remedy clause put back to shrink-0 whitespace-nowrap; the Reload row's narrow wrap removed; the header menu's viewport cap removed; RecursionError dropped from either spec-parse catch; the tool's no-file reply put back to blaming a config file; the sanitize_outbound call dropped from display_input (all four redaction tests fail); the spawn fingerprint skipped in _take_spawn_fingerprint (the prewarm-cancel test fails in seconds, no hang); ctime dropped from the entry stat (the permission-signature test fails); the respawn's carry call dropped (eager respawn and reset successor each fail their case); the no-record answer put back to stale: false (both unknown-status tests fail); the eager spawn's missing-spec skip removed (both eager config-load tests fail with 29 loads, and the missing-spec prewarm test fails).

Manual verification

Captured against the built SPA with the gateway stubbed (website/scripts/capture-stale-config-badge.mjs), and checked visually. The detection itself is covered by the backend tests above, which run on real files.

Screenshots / video

A chat on outdated config: the Config changed · Reload button right after the session title, and the alert mark on its sidebar row, directly after the agent name; the other chat shows neither.

Config changed · Reload button after the session title, alert mark on the sidebar row

The header button's tooltip naming the changed file and the remedy (headless Chromium paints no native tooltip, so the capture draws the button's own title text).

Reload button tooltip naming the changed file

The session menu, the second path: "config changed (…) · reload to apply" on the Reload session row: the changed-file list truncates, the remedy stays whole.

Session menu Reload session row with the config-changed note

The same menu at a 320px phone width, in English and in Japanese (the longest rendering of the row): the menu fits the viewport, the note sits under the Reload label, the file list truncates and the remedy wraps onto the next line instead of being cut off.

Session menu at 320px in English: note stacked under Reload session, remedy wrapped

Session menu at 320px in Japanese: note stacked under the Reload label, remedy wrapped

More states (04–10, 13)

While a turn runs: the header button and the Reload session row are both greyed; the file list truncates and "— reload when the turn ends" stays whole.

Reload button and Reload session row greyed while a turn runs

The generic tooltip of a stale chat with no changed file named: "This session's config changed since it started. Reload the session to apply."

Generic config-changed tooltip

While sub-agents work: the header button and the Reload session row are both greyed; the file list truncates and "— reload when sub-agents finish" stays whole.

Reload button and Reload session row greyed while sub-agents work

The sidebar alert mark's tooltip: names the changed file and says to reload the session.

Sidebar alert mark tooltip

The phone bar at 390px with a long session title: the title/menu trigger carries the alert glyph and Config · Reload before the title (which truncates), and the bar adds no button of its own; a tap opens the session menu with Reload session in it. The desktop row keeps the one-click button.

Config · Reload cue inside the title trigger at a 390px viewport

The session menu of a stale chat with no changed file named: the Reload session row's generic note, "config changed · reload to apply".

Session menu generic config-changed note

That chat's sidebar mark tooltip, generic wording: "This session's config changed since it started. Reload the session to apply."

Sidebar generic config-changed tooltip

A header reload the gateway refuses (sub-agents still working): the failure shows in the chat's action-error notice above the composer, with its agent hand-off; the header row gains no control, the button stays enabled for a retry, and no alert dialog opens.

Header reload failed: the chat's action-error notice

Related Issues

Refs #10211 (this shows the stale state and points at Reload; it does not reload automatically).
Follow-ups opened from review: #23136 (phone accessible name), #23137 (Reload affected chats on Connections).

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

@billygerhard
billygerhard requested a review from a team September 28, 2026 19:52
@billygerhard
billygerhard requested a review from a team as a code owner September 28, 2026 19:52
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS (a BLOCK with no Trigger and no Outcome does not block)

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

UX-Verdict: PASS

cannot evaluate: missing the header Reload button's in-flight state. No screenshot shows the spinning arrow that is supposed to set a working press apart from a button blocked by a running turn.

Evidence gaps

  • StaleConfigReloadButton while a reload is in flight. In this state the button is disabled, aria-busy is set, and the arrow spins (pending ? ' animate-spin'). The code comment says this is what makes "a disabled button working on the press read apart from one blocked by a running turn". The 13 attachments show the button enabled (01, 02, 06, 09, 12), blocked (05, 08) and after a failure (13), but never pending. A still of the desktop button just after a click would close the gap; a phone capture of the short form's spinner would help too.

Notes

  • The stale note on the phone's Reload row cuts the path list off at ~/.k… (attachment 04, and 05-ja). On a phone that leaves no readable input, and there is no tooltip to fall back on. On narrow widths, use reload_press_needed ("config changed · reload to apply") instead of a path list the screen can't show.
  • In attachment 13, the failure notice ("Sub-agents are still working… Try again when they finish.") renders above the header. Meanwhile the Reload button next to the title stays enabled and fully coloured. It should disable while sub-agents run, the same way the menu row does (05, 08), so the user isn't offered a second press that fails the same way.

[UX-REVIEWED] a7fe162

Description read

[DESCRIPTION-READ] 49f96e0dcd3a8d25d387128164c1510676cc6beec7c60898eb953e63fd640e8c

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

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of a7fe162601790f8c7fce554df2a614f31bb79ce8 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. The badge is additive and fails toward "unknown", and every failure in the change detector is caught and dropped.

Notes

  • stale_config.py (~1,600 lines) rebuilds each spawn reader's rules a second time: hot-reload ref adoption, KAS reprojection receipts, includeMcpJson per backend, the derived-surface mirror. If a spawn reader changes and this copy is not updated, the badge silently reports a stale chat as current, or a current one as stale. Having the spawn path emit a digest of what it actually read would keep the two from drifting.
  • In _turn_admit, await _take_spawn_fingerprint(...) runs before the provider is acquired, and it has no timeout. _respawn_config caps the same read at RESPAWN_CONFIG_TIMEOUT_S. A slow config directory therefore delays a turn's start with no limit, which the respawn path does not allow. Use the same bound in both places.
  • WarmSessionPool._pool_spawn_config runs inside the start slot, also with no timeout. Bound it the same way.

[DESIGN-REVIEWED] a7fe162

Description read

[DESCRIPTION-READ] 52a08f1d4b1ebce273199abd7a0624c88a62557e8b07f180938236766a6c58d1

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 Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

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

Premise-level review of a7fe162601790f8c7fce554df2a614f31bb79ce8 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: the badge removes a real, silent failure, and no existing mechanism detects a stale config. Three riders add surface the Goal does not need.

Notes

  • Item 6 — oversized: the Goal is "so the person knows a Reload … is needed". The session_config_status MCP tool, GET /api/session-control/config-status and the new debug-gateway skill step add permanent agent-facing surface beyond that. Subtraction: delete the tool, the route and the skill step 4; the badge alone serves the Goal.
  • Item 7 — unjustified move: while a chat is stale, the header hides the hover Rename and Auto-title buttons (hoverActions={!currentSlot?.config_stale}) and moves Auto-title into the menu. The desktop header has no documented control cap, and no one is named who was failing to find these controls. Subtraction: drop hoverActions, onUndoOfferedChange and the stale-only onAutoTitle.
  • Item 8 — oversized: the base already has a fallback, since "a live process no record describes reads as unknown". Even so, the PR stamps a fingerprint before start on warm-pool, respawn and reset processes (spawn_config_reader, respawn_config_reader, pool_spawn_config). Subtraction: delete those readers and the pool_spawn_config contract property, and let such processes read unknown until their first turn.

What this change ships

Inventory (8 items) — 5 justified

Intent: let a person see that a running chat needs Reload to pick up an MCP, agent-spec or mcp.json edit. ADDITION.

  1. Desktop header shows a "Config changed · Reload" button after the title — justified
  2. Phone bar title trigger shows a "Config · Reload" cue — justified
  3. Sidebar row shows an alert icon after the agent name — justified
  4. Reload session menu item gets a note naming what changed — justified
  5. Badge re-checks on its own: at turn end, after config writes, and on a 60 s sweep — justified
  6. Agents can query another session's config staleness through a new tool and route — oversized
  7. Stale chat hides hover Rename and Auto-title; Auto-title moves into the menu — unjustified move
  8. Warm-pool, respawn and reset processes are fingerprinted before they start — oversized

[FIRST-PRINCIPLES-REVIEWED] a7fe162

Description read

[DESCRIPTION-READ] 15bcc91f10293fb3ef271730d9bc4f5cfb2789570a677ba93b9f8abd5ac34b97

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 Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — 🔴 changes requested (blocking)

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

1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

BLOCKING -- src/kiro_crew/dashboard/stale_config.py:1555 -- KAS reinjection leaves refreshed worker chats marked stale

_NOT_REPROJECTED_PARTS = frozenset({"backend", "backend_key", "derived_from"})
Trigger: On a KAS gateway, enable an MCP server while a kirocrew-worker chat is live. The next turn’s take_turn_receipts runs the derived-spec freshness gate, and reinjection loads that refreshed spec. config_stale_status then calls adopt_reprojection.
Outcome: Adoption retains the old derived_from digest despite the session running the updated derivation. Subsequent checks keep displaying “Config changed · Reload” and reporting stale configuration for an already-applied change.
Anchor: defect
Fix: Adopt derived_from from the projection receipt; preserve only backend and backend_key from the spawn baseline.

[BLOCK-MERGE] a7fe162
[GPT-REVIEWED] a7fe162

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

LOW harm, not the unbounded harm the fence assumes. The worst outcome is a false "Config changed · Reload" badge that the operator clears with a Reload. The trigger is ordinary, though, so the strict-rarity bar for FLAG is not met.

Conditions I confirmed:

  • take_turn_receipts (patch L1392–1421) takes projection_receipt from spawn_config_fingerprint. That function runs require_fresh_derived_spec, which re-derives the worker mirror (patch L1386–1388).
  • adopt_reprojection (patch L3962–3979) then copies the old derived_from back from the spawn record. That part digests the default spec minus only model (patch L3360/L3374, L2529).

[ADJUDICATION] a7fe162 total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] a7fe162

[ADJUDICATION-FENCED] a7fe162 fenced=1 flagged=0
UPHOLD-FENCED F1 src/kiro_crew/dashboard/stale_config.py:1555 -- The trigger (enabling an MCP server while a KAS worker chat is live) is an ordinary operation, not an extreme combination, so the rarity bar for FLAG is not met; the overriding human should note the observed harm is only a false-positive Reload badge, cleared by a Reload, with no credential, ceiling or data consequence.
[GPT-ADJUDICATED-FENCED] a7fe162

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] c5d377a

@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 Sep 28, 2026
@billygerhard
billygerhard force-pushed the feat/stale-config-turn-boundary-reload branch from a3f0c66 to 9fd1eff Compare September 30, 2026 00:42
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Sep 30, 2026
billygerhard added a commit to billygerhard/KiroCrew that referenced this pull request Sep 30, 2026
Record the product-shape decision behind kirodotdev#14810: a chat whose spawn-time config changed reloads its agent process at the start of its next turn, keeping the conversation, only when idle with no sub-agents attached; otherwise the reload waits and the Reload row shows it. Refs kirodotdev#10211.
billygerhard added a commit to billygerhard/KiroCrew that referenced this pull request Sep 30, 2026
Record the product-shape decision behind kirodotdev#14810: a chat whose spawn-time config changed reloads its agent process at the start of its next turn, keeping the conversation, only when idle with no sub-agents attached; otherwise the reload waits and the Reload row shows it. Refs kirodotdev#10211.
billygerhard added a commit to billygerhard/KiroCrew that referenced this pull request Sep 30, 2026
Record the product-shape decision behind kirodotdev#14810: a chat whose spawn-time config changed reloads its agent process at the start of its next turn, keeping the conversation, only when idle with no sub-agents attached; otherwise the reload waits and the Reload row shows it. Refs kirodotdev#10211.
billygerhard added a commit to billygerhard/KiroCrew that referenced this pull request Sep 30, 2026
Record the product-shape decision behind kirodotdev#14810: a chat whose spawn-time config changed reloads its agent process at the start of its next turn, keeping the conversation, only when idle with no sub-agents attached; otherwise the reload waits and the Reload row shows it. Refs kirodotdev#10211.
billygerhard added a commit to billygerhard/KiroCrew that referenced this pull request Sep 30, 2026
Record the product-shape decision behind kirodotdev#14810: a chat whose spawn-time config changed reloads its agent process at the start of its next turn, keeping the conversation, only when idle with no sub-agents attached; otherwise the reload waits and the Reload row shows it. Refs kirodotdev#10211.
billygerhard added a commit to billygerhard/KiroCrew that referenced this pull request Sep 30, 2026
Record the product-shape decision behind kirodotdev#14810: a chat whose spawn-time config changed reloads its agent process at the start of its next turn, keeping the conversation, only when idle with no sub-agents attached; otherwise the reload waits and the Reload row shows it. Refs kirodotdev#10211.
billygerhard added a commit to billygerhard/KiroCrew that referenced this pull request Sep 30, 2026
Record the product-shape decision behind kirodotdev#14810: a chat whose spawn-time config changed reloads its agent process at the start of its next turn, keeping the conversation, only when idle with no sub-agents attached; otherwise the reload waits and the Reload row shows it. Refs kirodotdev#10211.
billygerhard added a commit to billygerhard/KiroCrew that referenced this pull request Sep 30, 2026
Record the product-shape decision behind kirodotdev#14810: a chat whose spawn-time config changed reloads its agent process at the start of its next turn, keeping the conversation, only when idle with no sub-agents attached; otherwise the reload waits and the Reload row shows it. Refs kirodotdev#10211.
billygerhard added a commit to billygerhard/KiroCrew that referenced this pull request Sep 30, 2026
Record the product-shape decision behind kirodotdev#14810: a chat whose spawn-time config changed reloads its agent process at the start of its next turn, keeping the conversation, only when idle with no sub-agents attached; otherwise the reload waits and the Reload row shows it. Refs kirodotdev#10211.
@billygerhard
billygerhard force-pushed the feat/stale-config-turn-boundary-reload branch from 9fd1eff to bb5d57d Compare September 30, 2026 16:57
@billygerhard

Copy link
Copy Markdown
Contributor Author

Disposition of the review findings on 9fd1effc28, addressed in bb5d57d214 (rebased onto origin/main @ aec81410e2, one commit):

First Principles

  • Item 1 (product-shape change without an accepted RFC): the design is now written up as the stale-config session reload RFC in docs(rfc): automatic stale-config session reload at the turn boundary #15409, and this head implements it as written (field-level fingerprint, workspace-spec spawn-only changes held for a Reload press, model and stub servers excluded, calling-chat reload requested for its next boundary, the three _reset_all_sessions callers unchanged). The RFC is not on main yet, so this item awaits a maintainer decision.
  • Item 7 (SpawnConfigRecord.inputs has no consumer): it now has a production reader. chat_runner.config_reload_status, which backs the session_reload verb's stale / manual_only report, recomputes the fingerprint from the record's own inputs, because the verb runs outside a turn and has no crew-binding resolution of its own to rebuild them from. The docstring now says that, and no longer claims a turn-boundary retry reads it.
  • Item 8 (description contradicted by the diff): the agent surface is in this head — session_reload tool, POST /api/session-control/reload, reload_slot_session shared by the route and the verb, session-control.md (24 tools) and the verb / route / tool tests — and the spec hunk describes it instead of "No agent verb". The description's What-changed and Tests sections were rewritten from this diff.

UX

  • Wording: the Reload row now reads "config changed · reloads at next message" (cause, then effect), translated in every shipped catalog and the pseudolocale regenerated.
  • Evidence: committed under temp-screenshots/stale-config-reload/ — 01-session-menu-reload-pending.png (open session menu, pending note on the Reload row) and 02-transcript-page.png (the "Session reloaded to pick up config changes" notice in the transcript), rendered from the production build with website/scripts/capture-stale-config-reload.mjs.

Design: the description now matches the diff (see item 8).

GPT advisories: the function-local hooks and config.paths imports in stale_config.py moved to module scope (the agent import stays local for its cycle). The stub-server finding no longer applies: per the RFC the stub set is not a reload input, since a stub change takes effect only at the next gateway start.

Opus advisory: the global mcp.json is now hashed at agent._KIRO_MCP_JSON, the path the spawned session reads, not the KIRO_HOME-relative one; pinned by a test that points the two at different directories.

Backend Tests (Windows) (2): the one failure was test/test_memory_store_dashboard.py::test_dashboard_backup_uses_configured_retention[3-3] (backup_keep read back as 7 instead of 3 right after an atomic_write of config.json; 21956 passed on that shard). This PR does not touch the memory store, the backup route or the config loader, and the test passes on Linux; it is a Windows config-reload timing flake in that test, not this change. This push re-rolls it.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed f9cc62b for the two upheld GPT findings on cc241df.

  • F1 (KAS checkout fallback). KAS resolves the user-level spec first and falls back to the checkout's .kiro/agents spec for a name the user level does not declare (harness.kas.resolve_projected_spec), reduced to PROJECT_SPEC_HONOURED_KEYS. The fingerprint read the user level alone, so a project-only agent's prompt edit never badged. _agent_spec_files now reads the checkout scope for KAS when the user scope has no spec, and the selected checkout document is reduced through agent_sdk.agent_specs.kas_project_spec_view (the SDK seam; stale_config stays out of acp), so an edit to a key KAS ignores there is not stale. The unlistable-scope check follows the same rule. The KAS parity test now compares against resolve_projected_spec itself (it had compared against load_agent_spec, which is why it missed this) and gains a workspace-only layout; one behaviour test pins fallback, filter, and the user-level spec taking over.
  • F3 (empty mcp.json). {}, {"mcpServers": null} and {"mcpServers": {}} now hash to the same identity and restriction views as an absent file. Parametrized test over all three.
  • F2 was downgraded on adjudication; not acting.

Each fix was mutation-probed (6 tests fail with the fixes reverted). Gate scripts, main's ratchet test, 2,352 tests, lint and mypy green locally. Description updated for the KAS rule.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed d8f66c5 for the two blocks on f9cc62b. Both follow from the crewmate work that landed on main today (#23010): KAS gained a third spec scope and a new kind of session, and the badge had not followed.

  • GPT (crewmate folder). resolve_projected_spec reads a crewmate's own spec from mate_agents_dir() (and the mate conductor/worker spec there before the user level). _agent_spec_files now reads KAS's scopes in that resolver's order, stopping at the first that holds the spec: user level, crewmate folder, checkout; crewmate folder first for a mate service agent. The crewmate spec is digested as the user-trusted spec it is, the unlistable-scope check covers the scopes actually read, and the sweep's stat signature stats the crewmate folder too. Parity test gains three crewmate-folder layouts plus a mate-service-agent case; one behaviour test pins that an edit there badges a KAS chat and moves the sweep signature.
  • Opus (worker session key label). select_provider_backend routes a crewmate's worker session to agent.member_acp_backend, but the badge labelled the moved key with is_member_session_key alone. The label now uses the same predicate as the gate (member DM or crewmate worker). Pinned beside the member-DM test.

Each fix mutation-probed (5 tests fail with them reverted, plus the signature case). Gate scripts, main's ratchet test, 1,039 tests, lint and mypy green locally. Description updated for the KAS scope order.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (53f1778): one import-list collision in session_control.py (main's process_state beside this PR's read_config_status; both kept). Added/removed lines identical to d8f66c5; pins unchanged and verified by their tests; gate scripts, main's ratchet test and the stale-config suite green locally.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed a3d1a79 for the two upheld findings on 53f1778, plus a rebase onto current main (one pin-file collision, pins re-taken from the test).

  • GPT F1 (empty mcp.json). The settings read passed bytes straight to the JSONC parser, so a file left at zero bytes, JSON whitespace or a lone BOM read as unparseable and demanded a Reload. It now applies the session reader's own rule (session_mcp._read_mcp_settings): one leading BOM dropped, an empty or whitespace-only file is {}. Five parametrized cases pin that {} to each of those shapes is not stale on either provider kind. GPT F2 was downgraded on adjudication; not acting.
  • Opus (crewmate-folder label). When KAS's spec came from ~/.kiro/mates/agents/, the badge tooltip and config-status answer named ~/.kiro/agents/<name> instead. The label now names the crewmate folder when the recorded spec path sits in it. Pinned.

Both mutation-probed (5 tests fail with the fixes reverted). Gate scripts, main's ratchet test, 443 stale-config and pin tests, lint and mypy green locally.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed 75e8814 for the one upheld GPT finding on a3d1a79: the crewmate-folder label I added last round called mate_agents_dir() from the label builder, which runs on the event loop inside config_stale_status (it resolves the Kiro home). Both directories the labels need are now resolved in _recompute, which already runs off the loop, and handed to display_input; the label builder resolves nothing itself. The pinned test asserts the home resolver is never called from the label path, and the crewmate-folder badge test now checks the status answer end to end.

F2 (user-spec MCP fields during a workspace-scope outage) and F3 (turn-boundary ref capture, third time) were downgraded as disproportionate; not acting. Gate scripts, main's ratchet test, 500 stale-config and pin tests, lint and mypy green locally.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (28ab101). Main's #23656 moved several chat-turn helpers out of chat_runner.py and, with them, every create_task call that file held; the composition contract now confines create_task to the chat-turn owner modules. This PR's one background scheduler, _schedule_config_stale_refresh, therefore moves verbatim into chat_turn/queue_cycle.py beside _turn_record_outcome (the phase it follows in the turn's finally), and chat_runner imports it from there. One moved name in the turn_admission import list follows main. No behaviour change: added/removed lines are identical to 75e8814 apart from the two import lines. Gate scripts, main's ratchet test, 1,535 chat-runner and stale-config tests, 268 contract tests, lint and mypy green locally.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed 97362a9 for the upheld GPT finding on 28ab101 (errors-use-error-notice): a Reload that failed after the user had switched chats was dropped, since the button's unmount guard returned before the host's notice and also suppressed the hook's alert fallback.

Fix, in the shape the adjudication named: ReloadCallbacks.onError may now return false to say the caller could not show the failure, and useSessionActions raises its own alert in that case (the one surface that outlives the header; components may not call alert themselves under the renderer lint). The button returns false once unmounted, so the failure reaches the user and still never lands in the next chat's header. Two pinned tests (hook and button), both fail with the fix reverted; tsc, eslint, 103 frontend tests green.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed 78aa17a for the upheld GPT finding on 97362a9 (errors-use-error-notice, again on the late-failure path): the previous head's alert fallback is itself a native dialog the rule forbids.

The badge has one render site, whose onError is the page's showActionError, and that notice outlives the chat switch that unmounts the button. So a failure landing after unmount now goes to that same ErrorNotice, titled with the originating chat's name (so it is not read as the current chat's failure, the gap Opus found on 10-20). No new state, no new strings, no alert; the false-return seam added last round is removed from the hook. Pinned in the button test (host notice gets the message, titled "Chat A"; no alert; nothing rendered in B's header), mutation-probed. tsc, eslint, 102 frontend tests green.

The Linux shard 3 red on the previous head was test_session_capabilities (an unraisable-exception warning at GC), which this PR does not touch and which passes locally; this push re-runs it.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed ace6f48 for the upheld GPT finding on 78aa17a, plus my own type slip from the previous head.

  • GPT F1. live_server_refs counted every enabled server in both mcp.json files, including when the spec sets includeMcpJson: false and never starts them. So switching a spec server off and dropping its ref, with an excluded mcp.json still declaring that name, demanded a Reload the hot reload had already applied. An excluded mcp.json now contributes only Crew's identity-bound servers (which Crew mounts from those declarations whatever the flag says); a mounted one contributes all of them, as before. Two pinned tests (excluded vs mounted; a Crew server in an excluded file stays live), mutation-probed. Description updated.
  • Frontend Lint & Type Check on 78aa17a was mine: the button's slot prop type lacked title. Fixed; the real npm run typecheck (tsconfig.app.json) is now what I run locally. The build jobs that failed on that head were downstream of the lint job.

Rebased onto current main (17 commits, no conflicts). Gate scripts, main's ratchet test, 659 pin and stale-config tests, lint, mypy, tsc, eslint green locally. UX, Design, First Principles and Opus had passed.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed bd361ae for the Opus block and the frontend shard on ace6f48, plus a rebase (one pin-file collision; 312 rows re-taken from the test).

  • Opus. On every backend but KAS the fingerprint read the "user" scope at ~/.kiro/agents directly, while agent_spec_path resolves it through spec_dir_for, which sends a mate service agent to the crewmate folder. So a crewmate DM on a mirror backend ran on a conductor spec the badge recorded as absent, and rebuilds never badged. The non-KAS user scope (and the listing check) now go through spec_dir_for(agent, kiro_agents_dir_path()), the same resolver. Pinned for claude and kiro-cli against agent_spec_path itself, with a stale user-level copy present; mutation-probed.
  • Frontend Tests (3) was mine: a page-level test still pinned the old "late reload failure is dropped" behaviour that the component-level fix two heads ago replaced. It now asserts the page notice names the originating chat.
  • Security Scope Review on that head never resolved its scope (generate job did not finish); re-rolled by this push.

Gate scripts, main's ratchet test, 661 pin and stale-config tests, lint, mypy, typecheck green locally. GPT's remaining findings were all downgraded; UX, Design and First Principles passed.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed c592dd2 for the two blocks on bd361ae, plus a rebase (main added two provider methods beside this PR's pool_spawn_config property; both kept).

  • GPT F1 (fenced; its adjudicator flagged it as an edge case, which does not clear it). Two status checks of one process could finish out of order: a turn-end refresh still reading the old spec when a config write's refresh reads the new one and badges the chat, then the older result clears the badge and the guarded sweep's cached signature keeps it cleared. The spawn record now carries a refresh generation: a check that finished after a newer one began publishes nothing (same drop path as a Reload landing mid-check). One field on the existing record, no new slot state; pinned by a test that runs the overtaking check inside the older one's read.
  • Opus. A kirocrew-worker or heartbeat chat runs on a spec re-derived from kirocrew.json at spawn, so an edit to the default (an allowedTools revocation) that a Reload would apply never badged, since the derived file on disk had not moved. The fingerprint now carries the default's surface for the derived agent (agent.derived_surface_fingerprint, the spawn's own freshness comparison) as a spawn-only part. Pinned: a mirrored-key edit badges on both provider kinds and names spec; a non-mirrored edit does not; the kirocrew agent itself carries no such part. Description updated.

Both mutation-probed. Gate scripts, main's ratchet test, 739 pin, facade and stale-config tests, lint, mypy green locally. GPT's other findings were downgraded; UX, Design and First Principles passed.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed f7d1729 for GPT's upheld F2 on c592dd2.

  • The derived_from part added last round hashed the whole default-spec surface for a derived agent, model included, so a default-model change badged every kirocrew-worker chat stale although Reload changes nothing for a pinned worker and the model path handles the unpinned one; the PR's own contract keeps model out of the spawn-only half. derived_surface_fingerprint now takes without= and the badge passes {"model"}; the spawn's own freshness hash is untouched (default argument). The derived-agent test gains a default-model change asserted not stale on either provider kind; mutation-probed. Description updated.
  • F1 (a ref added, consumed and removed inside one turn on a hot-reloading provider) was downgraded by the adjudicator; not acting.
  • Bundle Size Gate red on c592dd2: ModelEffortDropdown chunk 505.0 KB vs 500.0 KB. This PR's frontend hunks are unchanged since bd361ae, where the gate passed; the growth came with the base (#23271, 30 files in website/src), and #23867 re-measures that ceiling on main. Will clear on the next rebase after it lands.

Gate scripts, main's ratchet test, 739 pin, facade and stale-config tests, lint, mypy green locally. Opus, UX, Design and First Principles passed on c592dd2.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed c00b063: a conflict-free rebase onto main after #23867 re-measured the ModelEffortDropdown chunk ceiling, which was the only red on f7d1729 (Bundle Size Gate). The diff is unchanged hunk for hunk; all five lanes passed f7d1729 and the rest of the matrix was green.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed 5373231: rebase after #19135 added session_handoff beside this PR's session_config_status in the dashboard tool inventory. Both tools kept in the MCP table row, feature-map row, docs index sentence and validation facade manifest; counts and pins recomputed (39 tools, 23 session-control tools, 313 route-table rows). No code change; the badge diff is hunk-for-hunk identical to c00b063, which all five lanes passed.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed e32f0f1 for GPT's upheld finding on 5373231.

The refresh-generation fence added two rounds ago returned before the turn-end fold, so a turn-end check overtaken by a config write's refresh dropped the refs the turn had mounted; with the ref then removed from the spec, nothing later could learn it and the badge stayed "current". config_stale_status now folds the completed turn's refs into the record under the provider/record identity fences and before the generation fence (what a turn ran with is a fact about the process, whichever check publishes). A superseded check that learned nothing still publishes nothing; one whose fold changed the record re-reads once as the newest check, so the badge is published against the folded baseline rather than left wrong. Bounded by _STATUS_READS_MAX = 2. Pinned by a test that runs the overtaking refresh inside the turn-end read (ref recorded, final badge stale, three generations consumed); both halves mutation-probed (fence-before-fold and no-re-read each fail it).

Gate scripts, main's ratchet test, 514 stale-config/contract tests, lint, mypy green locally. Opus, UX, Design and First Principles passed 5373231.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed 0414a90 for the two blocks on e32f0f1.

  • Opus. session_config_status authorized with operation config_status, which the new HANDOFF_WIDENED_OPERATIONS (feat(dashboard): hand a session to the session that should manage it #19135) did not list, so after a handoff the manager was refused a read session_summary allows and the creator kept it. config_status now sits in the widened set beside summary, as the docs promise; the handoff test's widened-verb walk covers it.
  • GPT F1 (fenced). A KAS session re-injected in place after a dashboard MCP write (apply_pending_mcp_reinjection) keeps its provider object, so the record kept comparing against the spawn's fingerprint and the badge went on demanding a Reload for a change already applied. LLMProvider.mcp_projection_generation (default 0; the ACP provider counts each successful re-injection, with the handle swap) is noted on the record; when it has moved, the check re-records its baseline from the read it just made. While the re-injection is pending, or failed and stays pending, the count has not moved and the spawn's baseline stands, so the change still reads stale. Pinned: pending stays stale, a moved count clears and re-baselines, a later edit is judged against the new baseline, non-int declarations read as never re-sent; the re-inject tests pin the count on success and on a cancelled load. Description updated.
  • F2 (ref added, mounted and removed inside one turn) was downgraded; not acting.
  • Backend shard 4 on both Linux and Windows failed in test_governance_policy_viewer on an enterprise-build policy fetch (urlopen error), network on the runner; the PR touches nothing under platform/ beyond PinnedDirectory, and the file passes locally.

All three fixes mutation-probed. Gate scripts, main's ratchet test, 2030 contract/provider/session-control/stale-config tests, lint, mypy green locally. UX, Design and First Principles passed e32f0f1.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed d195b13 for the two blocks on 0414a90, both against last round's re-injection re-baseline.

  • GPT F1 (fenced): the baseline must be what the load read, not the turn-end read. The turn that applies a pending re-injection now takes a receipt at admission (take_projection_receipt, one file read, only when the provider reports mcp_reinjection_pending), stored on the record; when mcp_projection_generation has moved, the check re-records from that receipt. A prompt edit made during the turn is therefore judged against what the load read and reads stale (pinned). With no receipt (the mark landed after admission) the spawn's baseline stands, erring toward a Reload offered (pinned).
  • Opus: only what a re-injection re-reads moves. adopt_reprojection takes the receipt's spec and MCP parts (refs included) and keeps the record's backend, backend_key and derived_from; a backend change badged before the re-injection stays badged after it (pinned, plus a unit test of the part merge, including that a part the spawn never carried is not invented).
  • LLMProvider.mcp_reinjection_pending joins mcp_projection_generation as a declared default-False surface; the ACP provider answers from its mark (pinned on take and on apply).

All three halves mutation-probed (whole-projection adoption, turn-end-read baseline, no receipt each fail their pin). Shard 2 red = test_native_skill_projection_rewrites::test_two_concurrent_releases_each_prune_their_own_view (in-process lock timing; untouched by the PR; passes locally); shard 4 = the same enterprise policy fetch as before. Gate scripts, main's ratchet test, 2126 tests, lint, mypy green locally. UX, Design and First Principles passed 0414a90.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed ab5c908, test-only: test_acp_bindings' frozen member inventory of AcpProvider gains the two properties the last two rounds declared (mcp_projection_generation, mcp_reinjection_pending), which is what reddened backend shard 5 on both platforms. No code change; all five lanes had cleared d195b13. The other reds are not this PR's: shard 4 is the enterprise policy fetch failing identically on #23223, Windows 7 is a PermissionError in test_runtime_cleanup_windows on the runner's temp dir.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed c02ee5f: the same inventory fix rebased onto current main, which had re-sorted the test_acp_bindings inventory under ab5c908 (merge conflict on the test file alone). Diff unchanged hunk for hunk.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed 321a1f0: rebase onto current main (+210). One conflict in agent_sdk/agent_specs.py, where main added authored_spec_is_toolless / authored_spec_toolless_verdict at the same spot as this PR's mirrored_session_spec / kas_project_spec_view; both kept, main's first. Main's #23977 also moved test_fallback_row_attribution_8560.py into test_dashboard_chat.py, so the turn-harness import in test_stale_config_status.py now points there. No code change; the diff is otherwise hunk-for-hunk identical to c02ee5f, which all five lanes passed.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed 846bfce for GPT's upheld F2 on 321a1f0.

  • A crewmate-folder spec is digested through the user slot (user_spec = specs.user or specs.mate), but only an unknown user scope marked the user_spec input unreadable, so a crewmate folder losing read permission with no edit moved the spawn-only digest and badged a KAS chat stale instead of unknown. The scope test now covers both scopes that feed that slot (_USER_SLOT_SCOPES), so carry_forward carries the path and fields together. Pinned (unreadable crewmate folder: spec + user_spec unreadable, carried parts unchanged, not stale); mutation-probed.
  • F1 (ref added before a turn and removed during it) was downgraded; not acting.
  • The Coverage Gate red on 321a1f0 was fail-closed behind a cancelled Frontend Lint & Type Check job (the matrix never started); this push re-runs it.

Gate scripts, main's ratchet test, 681 stale-config/contract/bindings tests, lint, mypy green locally. Opus, UX, Design and First Principles passed 321a1f0.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed 7bc3739 for GPT's upheld finding on 846bfce.

On a hot-reloading provider the turn-end fold took the refs from the disk as the turn ended, so a ref added before a turn and removed during it (server kept) was never recorded and the badge stayed "current" with the tool still mounted. The admission receipt already taken for a pending re-injection now also covers this: take_turn_receipts reads the config once before a turn on a recorded provider that re-injects or hot-reloads, and the turn-end fold uses that receipt (record.turn_receipt), falling back to the turn-end read only when no admission was observed. The receipt-taking is guarded end to end so a provider that does not declare the capability cannot fail the turn (the bookkeeping harness test caught exactly that). Pinned: added-then-removed-during-the-turn reads stale with the ref recorded; no receipt where the provider does not hot-reload. Both halves mutation-probed (fold from the turn-end read; no receipt taken). Description updated.

Gate scripts, main's ratchet test, 1892 tests, lint, mypy green locally. Opus, UX, Design and First Principles passed 846bfce.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed 6d018ba: rebase after main added session_set_color beside this PR's session_config_status in the dashboard tool inventory. Both kept in the MCP table row, feature-map row, docs index sentence, session-control page, validation import and facade manifest, and the metrics-test note; counts and pins recomputed (40 tools, 24 session-control tools, 314 route-table rows). No code change; the badge diff is hunk-for-hunk identical to 7bc3739, which all five lanes passed. The shard-4 red on both platforms there was test_telegram_dispatcher (two audit-list asserts in code this PR does not touch).

@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed 04f9bdb for GPT's upheld finding on 6d018ba.

The turn-end refresh read the turn receipt off the record while it ran; a queued successor turn admitted during the refresh's file reads overwrote that receipt with its own ref-free one, which the refresh then consumed and cleared, losing the mounted @a. The receipt is now detached synchronously when the refresh is scheduled (detach_turn_receipt in _schedule_config_stale_refresh) and passed through refresh_config_stale(turn_receipt=...) to config_stale_status, which never reads or clears the record's receipt itself, so a successor's receipt is left for the successor. Pinned: the overtaking admission writes its receipt inside the completed turn's recompute, the completed turn still reads stale, and the successor's receipt survives untouched; plus the detach helper's no-record case. Both halves mutation-probed (status reading the record; scheduler passing none). The order-pin test caught the stub-signature mismatch again, as designed.

Security Scope Review red on 6d018ba was its generate job not finishing (infra); it re-runs with this push. Gate scripts, main's ratchet test, 1894 tests, lint, mypy green locally. Opus, UX, Design and First Principles passed 6d018ba.

@billygerhard

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (+282) to clear a merge conflict; pushed c5d377ab3a.

  • state_parts/slot_session.py: docstring field list only; kept main's _saved_created_by / crew_mode_agent beside this PR's _spawn_config / config_stale / config_stale_inputs.
  • Composition pin: MCP route table rows 315 (main's 313 + this PR's 2), digest re-taken from the test.
  • test_stale_config_scan_paths.py: main's feat(acp): add GitHub Copilot CLI as a selectable ACP harness #22403 added copilot as a session-MCP-array backend whose projection is mirror, so it joins the pinned array set and the mirror-parity backends (parity tests pass for it).

No badge code changed. Gate scripts, lint, mypy, 2,359 targeted backend tests, npm run typecheck and the PR's 172 frontend tests are green.

A chat's agent process reads its agent spec, mcp.json files and ACP
backend once, at spawn, so an edit made after the session started never
reaches it, and nothing told the person a Reload was owed. Record a
field-level fingerprint of those inputs against the provider a chat
runs on (at the turn, the prewarm, and the warm-pool spawn) and compare
it at each turn's end, right after the gateway's own config writes, and
on a stat-guarded 60s sweep for edits made outside it, so idle chats are
badged too. A chat whose process runs on changed config gets a
"Config changed · Reload" button right after its title that reloads the
session in one click (disabled while a turn or sub-agents run); on a
phone the title trigger carries that cue and opens the menu with Reload
in it. Its sidebar row gets an alert mark; both
tooltips name the changed file, and the session menu's Reload row says
a press applies it. The signal clears on a Reload or when the config
returns to its spawned state. Nothing is relaunched automatically.

Detection follows the file each backend loads (kiro-cli reads JSON
specs only; KAS the user-level directory), reads whole files up to the
50 MB cap, treats an unreadable input or unlistable agents directory as
unknown, and does not flag an MCP edit a hot-reloading kiro-cli applied
live. Agents read the same answer through a read-only
session_config_status session-control tool.
@billygerhard

Copy link
Copy Markdown
Contributor Author

Pushed a7fe162601 for the GPT finding on c5d377ab3a (Windows: the turn-receipt path ran the managed-spec heal step, which probes the user agents directory, before reaching the Windows short-circuit).

  • spawn_config_fingerprint now skips ensure_agent_materialized / require_fresh_derived_spec when WINDOWS_SCAN_DISABLED; the reading there is unknown regardless, so nothing is lost.
  • _take_spawn_fingerprint skips the managed_spec_missing probe under the same flag.
  • Two pinned tests in test/test_stale_config_scan_paths.py (both fail with the guards reverted). The spawn path's own heal still runs as it does on main; this only stops the badge adding a probe of its own on Windows.
  • Also rebased onto current main (no conflicts).

@billygerhard

Copy link
Copy Markdown
Contributor Author

Closing: the underlying request (#10211) is parked and not on the current plan, so I'm not carrying this further. The problem and the cases this PR covered are summarised on #10211 for whoever picks it up.

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) merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants