Skip to content

feat(dashboard): report rejected gateway writes in one notice - #10910

Closed
rnoack1 wants to merge 1 commit into
kirodotdev:mainfrom
rnoack1:feat/report-rejected-gateway-writes
Closed

rnoack1 wants to merge 1 commit into
kirodotdev:mainfrom
rnoack1:feat/report-rejected-gateway-writes

Conversation

@rnoack1

@rnoack1 rnoack1 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A rejected session write (pin, colour, move, send, reload) is reported to the user in one always-mounted notice with an "Ask the agent" hand-off, instead of silently reverting.

Five session-write actions dropped a rejected write silently or behind a native alert(). Pin, colour, move to folder, send to instance and reload all applied their change optimistically and then reverted it when the server refused — with no error, no notice and no retry affordance.

The user sees a pin flip and flip back. Nothing tells them the write was rejected, and the UI they are looking at is the correct post-revert state, so there is nothing to inspect.

Why it matters

These are the actions a user repeats fastest. A silent revert reads as the app losing input at random, and the natural response is to try again — which is exactly the wrong move if the server refused for a reason that will refuse again.

Several of these surfaces are menus that unmount on select, so the failure arrives after the component that issued it is gone. That is why a local useState error cannot work here and why the notice has to live somewhere that outlives the click.

Not a goal

  • The ~18-control offline sweep (declared as a sibling unit).
  • Changing any write's behaviour — only its reporting.

What changed (motivation → approach → change)

One store, one sink, five reporters.

Piece What it does
utils/actionFailure.ts Module store (useSyncExternalStore) holding rejected-write reports, newest shown: { message, subject?, report?, heading? }
components/ActionFailureNotice.tsx The one rendered sink — an ErrorNotice banner with the "Ask the agent" hand-off and a dismiss control
App.tsx ×2, pages/PopoutFrame.tsx The three always-mounted shells that mount the sink, so a failure reported from an unmounted menu still lands
website/AGENTS.md One line beside the ErrorNotice rule: a new always-mounted shell mounts ActionFailureNotice too
docs/feature-map/README.md A row for the notice, beside the crash report notice it is mounted next to

Any action reports with reportActionFailure(message, subject?, report?, heading?). The sink is deliberately not in ChatPage — a session write issued from the command palette on a non-chat route must still land, and a page-level sink would double-render on /chat.

  • Five adopters: hooks/useSessionActions.ts (pin, reload), hooks/useMoveSlotToFolder.ts, components/SessionColorSwatches.tsx (both call sites) and components/SendToInstanceSubmenu.tsx.
  • The banner heading states what actually happened. Actions that change the session read Couldn't update "<name>". A failed send reads Couldn't send a copy of "<name>" and a reload Couldn't reload "<name>" — none changes a setting. Their messages state the resulting state ("The copy was not delivered — this session is unchanged." / "No new session was created."). A report with no subject gets the neutral heading Couldn’t complete that action. The peer's fix-it sentence rides in the send message, quoted, scrubbed and capped (redactThenCap, MAX_MESSAGE), so it survives the menu closing. A newer failure stacks on top, saying how many earlier ones wait, and dismissing it brings the previous back; messages are past tense, so none goes stale. A failure that lands while a remote instance tab fills the window waits in the hidden local pane and shows on the return to Local. Each report carries its journal entry, so "Ask the agent" hands over the endpoint and status. The hand-off asks first: it runs through useGuardedLeave (via ErrorNotice's askAgentGate), so a page holding an unsaved draft gets the same discard prompt as any other navigation. A write whose session has left the list by the time the server refuses reports nothing, whichever direction it went. A bulk pin revert gets a plural heading (Couldn’t update 3 sessions, via pluralKeys.json) and names the sessions with Intl.ListFormat.
  • An in-menu failure has exactly one surface at a time. SendToInstanceSubmenu keeps the menu open on failure and renders an inline ErrorNotice on the row plus a sibling "Ask the agent" item, replacing the old Failed badge. The page notice takes the SAME failure over when the menu closes and the row stops existing, so the peer's sentence and the hand-off never appear twice at once. The failure is held per instance, so a retry that succeeds withdraws its own hold rather than banner-ing something the user already fixed. The inline notice is capped at max-w-[240px] and wraps, so a long server sentence cannot stretch the flyout to the viewport edge.
  • A rejected write says why, not just what it undid. "The pin change was undone." alone leaves a blind retry as the only move, which is wrong when the server will refuse the same way again. So pin, move and colour append a cause clause (writeFailureCause in utils/actionFailure.ts): an ANSWERED refusal quotes the server's own words, scrubbed and capped with the journal's budget (Kiro Crew said “…”. Ask the agent if it refuses again.), and a rejection nothing answered names the one thing that clears it (Kiro Crew is unreachable. Reconnect and try again.). It is duck-typed on status, not instanceof ApiError, because several suites mock api/client wholesale and a class check would send a real refusal down the nothing-answered branch. reload_failed_rejected loses "the gateway answered with an error" for the product name and a next step.
  • Reload has one message per code the gateway answers with. It reads the 409 body's code with parseErrorCode: turn_in_flight says the agent is mid-turn, session_rebound says the session was replaced while the reload ran, slot_subagents_running says sub-agents are still working, and only an unrecognised 409 code keeps a hedged "not in a state that allows a reload". Any other answered status gets a definite rejection message; "gateway unreachable" wording is kept only for a genuine transport failure.

This PR is one unit of a split. A single larger change carried this store plus a ~18-control offline sweep at 4224 added lines, which is not reviewable. This unit is the reporting mechanism and its adopters; the offline sweep lives entirely in the sibling unit, and this one depends on no sibling.

Rebase onto main (2026-10-20)

Rebased onto current main as one commit. Two adopters were dropped because main changed under them:

  • Mode: chore(frontend): remove Autopilot mode #15359 removed Autopilot mode, so modeMutation / toggleMode no longer exist. The mode adopter, its mode_change_failed strings and its tests are gone.
  • Fork: main now handles a failed duplicate itself (cause-specific duplicate_* copy, plus the fork_corpus_too_large notice via forkFailureNoticeOffsite). That handler is kept as is; this PR's fork_failed strings and fork tests are removed. Moving those messages onto reportActionFailure can be a follow-up.

The two journal-report and transport-text tests that drove the mode write now drive the pin write.

Also on this head: clicking a failed send row's inline error no longer sends the copy again (the error now stops pointerup too, since a Radix item that saw no pointerdown clicks itself on pointerup; pinned with the real Radix item in test/SendToInstanceSubmenu.inlineError.test.tsx).

Sibling sinks, and what is deliberately NOT in this unit. ChatPage's showActionError slot (pages/chat/page/turnActions.ts) still reports fork and steer failures inside /chat, and ImportSessionOutcomeNotice reports imports. A new reporter for a write whose menu can unmount, or that can fire off /chat, uses reportActionFailure.

Two merges are left out on purpose, and neither is small:

  1. Folding showActionError into the store. showActionError has 195 references across 34 files, and setActionError is threaded as a Dispatch<SetStateAction<…>> through 10 more with a preserveOnSwitch flag the store does not model and a slot-switch clear (composerDrafts.ts) that reads it. The notice also renders above the composer rather than in the app shell, so folding it moves where every one of those 195 sites reports. That is a unit of its own, not a rider on this one.
  2. Moving main's fork-failure messages onto reportActionFailure. Main handles a failed duplicate itself with cause-specific duplicate_* copy plus the fork_corpus_too_large notice; Move the agent, model and effort switch toast onto the shared action-failure notice #14892 covers only agentSwitchNotice.

Issues for both are owed and not yet filed.

Backwards compatibility

Compatible in behaviour: additive UI reporting, no API or storage contract changes. The catalogs under i18n/locales/*.json (source i18n/locales/en.manual.json) do change existing keys: components.sendToInstanceSubmenu.failed is deleted (its Failed badge is replaced by the inline notice) and hooks.useSessionActions.reload_failed's copy is rewritten, both across all 13 locales; hooks.useSessionActions.reload_failed_rejected is reworded again on this head, to name the product and a next step instead of "the gateway answered with an error"; every other key is new (the per-action *_failed messages and headings, pin_change_failed_named, the reload_failed_busy / _rebound / _conflict / _rejected variants, and the two shared cause clauses utils.actionFailure.unreachable / .refused). The Korean refused value uses ‘ ’ around its operand and {{productName}}이(가), which src/i18n/style/koStyle.test.ts requires of an interpolated value and a placeholder 조사.

Tests

Each adopter has a rejection test asserting the notice appears with the right heading and subject, and a success control asserting no notice appears when the write succeeds — so a test cannot pass by the notice being permanently mounted (test/sessionWriteFailures.test.tsx, test/actionFailure.test.ts, test/ActionFailureNotice.test.tsx, test/App.actionFailureNotice.test.tsx, test/SessionColorSwatches.test.tsx, plus updated suites for the adopters). Pinned specifically: each reload 409 code gets its own copy (and an unknown code the hedged fallback), a rejected pin hands its journal report to the notice, a report with no subject gets the neutral heading, a peer's refusal text is scrubbed of credentials and capped before either notice shows it, a hand-off the leave guard vetoes navigates nowhere and stages nothing (test/errorToAgent.test.tsx pins the gate reaching every button placement), a bulk pin revert counts and names every session, an untitled one by its key, a second rejection stacks over the first, the banner says how many earlier ones wait, and dismissing it brings the first back (bounded, oldest dropped), a refused reload leads with Couldn’t reload, and a rejected pin, mode, move or colour write on a session that has left the list reports nothing. test/ChatPage.sessionTabs.test.tsx pins that the chat page renders no second sink, and test/actionFailure.test.ts pins that the store's test reset keeps a mounted notice subscribed, so the shell tests see the store's own notification.

Added on this head: a failed send shows the peer sentence on the row with the banner ABSENT, and the banner appears carrying it only once the menu unmounts; and a pin rejected with an ApiError quotes the server's reason instead of the reconnect step, with the plain-Error case beside it as the control. Three negative controls ran: restoring the immediate report reddens exactly the no-duplication test; suppressing the cause clause reddens all 8 message assertions; and collapsing the answered branch reddens only the quoting test, so the branch is load-bearing rather than decorative.

tsc -p tsconfig.app.json, eslint src --max-warnings 0, the i18n gate (19 checks, diff-scoped included) and the phantom-classes / theme-colors / restyle-ratchet gates pass. The whole src/ tree runs 52,248 passed; 77 failures across 23 suites are inherited from the base, proved by running those same suites on a pristine worktree at this PR's merge base with a byte-identical lockfile: 20 failing test names identical in the first 11 suites, and in the other 12 every failure at this head also fails at the base, which additionally fails one this head passes. This PR's diff touches none of those 23 files.

Manual verification

Captured against the built SPA served on loopback with fixture APIs (no gateway): a rejected colour PATCH (subject form, dashboard and embed shells) and a 502-refused send-to-instance with the per-action banner and capped inline notice. The no-subject, bulk, fork and reload frames and the stacking recording come from the shipped ActionFailureNotice rendered alone with the real store, i18n and theme, fed the exact arguments each of those reporters passes; the capture asserted each heading and message before the shot, and the recording asserted the order the two banners appear in.

Re-captured on this head: website/scripts/capture-send-to-instance-error.mjs is repointed from the Failed badge this PR removes to the inline ErrorNotice, and extended to photograph the handover. It drives the real built SPA against a fixture peer that answers 502 transfer_peer_too_old, and asserts, before each shot, that the row's notice carries the peer's cause and remedy with no status code, that the row has an "Ask the agent" item, that no page banner is showing while the menu is open, and that on close the banner carries the quoted peer sentence under the Couldn’t send a copy of … lead with the menu shut. 4 frames, 0 harness errors.

Screenshots / video

Banner — subject form, with the "Ask the agent" hand-off and dismiss control:

ActionFailureNotice subject form: Couldn't update "Sprint planning"

Banner — no-subject form: a write on an untitled session gets the neutral heading Couldn’t complete that action, with the same hand-off and dismiss control:

ActionFailureNotice no-subject form: Couldn’t complete that action. The color change was undone.

Banner — refused reload: its own lead, since a reload changes no setting, over one of the per-code messages (here the agent is mid-turn):

ActionFailureNotice reload form: Couldn’t reload “Sprint planning”. Session reload failed — the agent is mid-turn.

Two refusals before the reader looks: a folder move lands on top of a color change, and the banner says one earlier failure is waiting. Dismissing the move brings the color change back, and dismissing that clears the banner:

Before the dismiss — the move failure on top, with the waiting line:

Stacked notice before dismiss: Couldn’t update “Sprint planning”. The move was undone. 1 earlier failure is waiting — dismiss this one to see it.

After one dismiss — the earlier color failure, and no waiting line because nothing is left under it:

Stacked notice after one dismiss: Couldn’t update “Research notes”. The color change was undone.

The same sequence as a recording:

Stacked notices: dismissing the newer move failure reveals the earlier color failure, then nothing

Banner — bulk pin revert: one plural heading, and every reverted session named in the sentence:

ActionFailureNotice bulk form: Couldn't update 3 sessions. The pin change was undone for Sprint planning, Release notes, and Bug triage.

Embed shell — the banner is its own row directly below EmbedTabStrip; no overlap, the strip's tabs and controls stay clickable:

ActionFailureNotice in the embed shell below EmbedTabStrip

Send failure. The frame below is from a pre-rebase build and is superseded: it predates both the quoting of the peer sentence and the handover above, and it still shows the Autopilot entry #15359 removed. Fresh frames for this head are captured and staged (the row with the peer sentence and one hand-off, the banner after the menu closes, and a light-theme pair); they are not attached yet, because minting a user-attachments URL needs the web editor or gh >= 2.99 and this host has 2.96.0. Judge the handover from the harness assertions above until they land.

Send failure: per-action heading, remedy sentence in the message, capped inline notice

Related Issues

no linked issue: split unit of a larger internal sweep; no tracked issue exists for this surface.

Pattern harvest

When the component that issues a write can unmount before the reply, the error surface has to be owned by something that outlives it. A module store read with useSyncExternalStore is enough — no context provider, no reducer, and it keeps the reporting call a one-liner at each of the seven sites.

Checklist

  • One commit
  • Type-check, unit tests and i18n gates run locally
  • No new dependencies

Contribution License Agreement

I confirm this contribution is made under the terms of the project's contribution licence.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention labels Sep 15, 2026
@dwu96

dwu96 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review.

When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically.

@rnoack1
rnoack1 marked this pull request as ready for review September 15, 2026 00:49
@rnoack1
rnoack1 requested review from a team and cixuuz September 15, 2026 00:49
@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of ccae712cf4270611b44e867b6f4e1b32b8c1e52c via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that only one of App.tsx's two ActionFailureNotice mounts (embed shell and dashboard local pane) can render at a time; otherwise one failure shows twice.

[DESIGN-REVIEWED] ccae712

Description read

[DESCRIPTION-READ] dd6dd34d3951f1a1ef54269b2f64e1ef6c5abc7eb5e65676408104ec5053b366

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — 🔴 BLOCK

UX-level review of ccae712cf4270611b44e867b6f4e1b32b8c1e52c via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: BLOCK

cannot evaluate: missing the cause clause that every pin, move and colour notice now carries; the screenshots show older copy that this head no longer renders.

Evidence gaps

  • Cause clause on pin, move and colour notices. withWriteFailureCause always adds either Kiro Crew said “{{reason}}”. Ask the agent if it refuses again. or Kiro Crew is unreachable. Reconnect and try again. Every banner in attachments 01, 02, 04, 05, 07 and 08 ends at the bare "The color change was undone." / "The move was undone." / "The pin change was undone for …". Neither branch appears anywhere, so the copy users will actually read has not been shown. Close it with fresh stills of a colour, move or pin refusal for both branches (answered and unreachable).
  • The send handover: inline row error, then the page banner. Attachment 09 is not this revision. Its menu still has "Switch to Autopilot", which the description says chore(frontend): remove Autopilot mode #15359 removed. Its banner prints the peer sentence on a second line without the “…” quotes this head adds. It also shows the banner and the inline row error at the same moment, which contradicts the claim that "the two never show at once". Close it with two current stills: menu open with only the row error, and menu closed with only the banner. The capture script already produces these as send-to-instance-failed-dark.png and send-to-instance-banner-dark.png.
  • The reload messages for slot_subagents_running, session_rebound, reload_failed_conflict and reload_failed_rejected. Only the mid-turn message is shown (attachment 03). Close it with one still per message, or one representative still plus the text of the others.

Watch

  • Send failure moves from the row to the banner with no visual link. Closing the menu unmounts the row error, and the same failure mounts in the page banner (animate-rise), far from the row. A user who just read the error on the row sees it vanish and a red banner appear. That will happen every time a send fails, so it matters more than a one-off. Either show the banner as soon as the menu closes in a way that clearly reads as the same failure, or state in the description why a hard cut is acceptable here.

[UX-REVIEWED] ccae712

Description read

[DESCRIPTION-READ] 231fd50fd2c429d4e2b4580ffbf61b6271afdf15df886a579273b237751493ed

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

Copy link
Copy Markdown
Contributor

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

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

Adjudication upheld 1 of 1 blocking finding(s); those must be resolved before merging.

BLOCKING -- website/src/components/SendToInstanceSubmenu.tsx:213 -- Send failures disappear when the menu closes before the response
held.current.set(id, {
Close the session menu while a send is pending and its source remains listed → cleanup drains the empty map → a delayed 502 reaches onError, updating only abandoned component state → neither notice renders.
Anchor: errors-use-error-notice
Fix: Track mounted state; hold failures while mounted, but call reportActionFailure directly for rejections arriving after unmount.

[BLOCK-MERGE] ccae712
[GPT-REVIEWED] ccae712

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

F1: Medium harm, and silent. The send fails with nothing on screen, so the user may believe a copy reached the peer when it did not.
Conditions, confirmed in the patch: the unmount cleanup only drains held (SendToInstanceSubmenu.tsx cleanup at the useEffect(() => () => …, []) hunk). onError only does held.current.set(...) and then setStates (lines ~632–643 in the new file). So a rejection that arrives after the menu has closed is stored in a map nobody reads again, and nothing recovers it. The finding is anchored to errors-use-error-notice, which has blocking: true in .review-base-rules/website-AUTOSDE.yaml:622-623. The real fix is cheap: a mounted ref plus one branch in onError.

[ADJUDICATION] ccae712cf4270611b44e867b6f4e1b32b8c1e52c total=1 uphold=1 downgrade=0
UPHOLD F1 website/src/components/SendToInstanceSubmenu.tsx:213 reason=autosde-blocking-rule
[GPT-ADJUDICATED] ccae712cf4270611b44e867b6f4e1b32b8c1e52c

@github-actions

github-actions Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — 🟡 CONCERNS

Premise-level review of ccae712cf4270611b44e867b6f4e1b32b8c1e52c 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/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The new app-wide failure store is a second page-level error sink next to ChatPage's showActionError, so /chat now has two banners for one class of failure.

Not justified as shipped

  • Item 1 — duplicate of pages/chat/page/turnActions.ts showActionError: the description says "showActionError … still reports fork and steer failures inside /chat". Grepping showActionError finds about 20 non-test reporter files feeding that page notice. ImportSessionOutcomeNotice (components/ImportSessionItem.tsx:129) is a third module-level outcome store. This PR adds a fourth surface rather than one that replaces the others. The difference in lifetime (it outlives an unmounted menu) is real, and the description defers the merge on purpose, so this is accepted-and-deferred, not a demand.
    Subtraction: in a follow-up, delete the ChatPage actionError slot and route its reporters through reportActionFailure, leaving one sink.
    Clears when: a linked follow-up issue tracks folding showActionError (and the import outcome store) into utils/actionFailure.ts, or the description names which banner wins when both show on /chat.

What this change ships

Inventory (8 items) — 7 justified

Intent: a refused session write (pin, colour, folder, send, reload) tells the user it failed and offers "Ask the agent", instead of silently reverting. This is a FIX, framed as feat.

  1. A new app-wide banner for refused session writes, mounted in the dashboard, embed and popout shells — duplicate of showActionError (ChatPage sink kept alongside)
  2. A refused pin/unpin, folder move or colour change now shows a notice instead of reverting silently — justified
  3. A refused reload shows the in-page notice instead of a native alert() — justified
  4. A failed send-to-instance row shows an inline error plus an "Ask the agent" item instead of the "Failed" hover badge — justified
  5. Pin, move and colour notices quote the server's reason, or say "unreachable, reconnect" — justified
  6. Reload messages are chosen per gateway code (turn_in_flight, session_rebound, slot_subagents_running, other 409) — justified
  7. A newer failure stacks over an older one with an "earlier waiting" line; dismissing it reveals the previous one — justified
  8. website/AGENTS.md rule: a new always-mounted shell must mount ActionFailureNotice — justified

[FIRST-PRINCIPLES-REVIEWED] ccae712

Description read

[DESCRIPTION-READ] 21f49394c1424051f4f428baa1fc94170e41d62f382eb32b6b5bb4b48bd937cb

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

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

Review details

No findings that block the merge.

FINDING — website/src/components/SendToInstanceSubmenu.tsx:588 — the failure is only reported if it is already in held when the menu unmounts. Closing the menu with Escape or an outside click while a send is still in flight runs the cleanup with an empty map. The options-level onError from useMutation still fires after the unmount, so the later held.current.set(id, …) writes into a map that nothing ever reads, and the failed copy is never shown anywhere. A related case: onMutate never removes an earlier hold, so a retry that is still in flight when the menu closes reports the old failure in the page banner → Fix: in onError, call reportActionFailure directly once an unmounted ref is set, and held.current.delete(id) in onMutate.

FINDING — website/src/components/SendToInstanceSubmenu.tsx:570 — choosing the row's ErrorNoticeMenuItem "Ask the agent" item hands the error off and does not call preventDefault, so the menu closes. The unmount cleanup then reports the same held failure, and the page banner reappears with a second hand-off for an error the user has already given to the agent → Fix: give ErrorNoticeMenuItem an onHandoff callback (it is in ErrorNotice.tsx, which this PR already edits) and use it to delete that instance's held entry.

[OPUS-REVIEWED] ccae712

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 16, 2026
@rnoack1
rnoack1 force-pushed the feat/report-rejected-gateway-writes branch from 19df22d to 1389806 Compare September 16, 2026 22:12
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Sep 16, 2026
@rnoack1
rnoack1 force-pushed the feat/report-rejected-gateway-writes branch from 1389806 to f2d2359 Compare September 16, 2026 23:57
@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: action required A blocking check or review needs attention labels Sep 16, 2026
@rnoack1
rnoack1 force-pushed the feat/report-rejected-gateway-writes branch from f2d2359 to ef171fd Compare September 17, 2026 02:51
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 17, 2026
@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Test reset helper severs the live store subscription span=47a35e441d94

fixed in d05b2cd: __resetActionFailureForTests now sets current = null and calls emit(), the same as clearActionFailure, and no longer clears listeners. A notice mounted before the reset stays subscribed, and an unmounted one unsubscribes itself (RTL auto-cleanup is active).
New test in test/actionFailure.test.ts: it mounts a useActionFailure reader, resets, then reports, with no other re-render trigger. It fails on the old helper and passes on the new one (mutation-checked both ways), so the three shell assertions in test/App.actionFailureNotice.test.tsx now pass because of the store's own notification.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Mount of the sink is convention-by-discipline across three shells span=90c9289d86c1

fixed in d05b2cd: website/AGENTS.md gains one sentence beside the errors-use-error-notice rule. It says a new always-mounted shell must also mount ActionFailureNotice, as the two App.tsx shells and pages/PopoutFrame.tsx do, and names test/App.actionFailureNotice.test.tsx as the test that pins the dashboard mount.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • A fork-lane review has no first-time reader (lane limitation) span=58a0c5f8fc16

rebutted: the item names this lane's own fork limitation, which no change to the diff or the body can lift. It lists three attached frames: the dashboard banner, the popout banner, and the in-menu inline notice with its sibling "Ask the agent" item.
Those same controls have rendered tests: test/ActionFailureNotice.test.tsx, test/App.actionFailureNotice.test.tsx and components/SendToInstanceSubmenu.cov80.test.tsx.
A blind read needs the branch pushed to the base repository, which is a maintainer's call for a fork PR.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Store keeps only the newest rejection, so close failures report only the last span=eb9e9b9144f1

rebutted, kept by design: the notice is a single slot on purpose, so a burst of rejections never stacks into a wall of banners, and the newest one is always the one on screen.
An earlier failure is not silent. Its write has already visibly reverted in place, and its ApiError sits in the error journal (recordError), which the hand-off and the error report both read.
A bulk pin revert in one batch is already folded into one plural report (pin_change_failed_heading). A queue would need its own ordering, dismissal and per-item hand-off, which is new UI outside this PR's goal.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Mixed named/untitled pin batch omits the untitled session span=aa43add523ec

fixed in f6538da: a multi-session pin revert names every reverted session and never filters, so an untitled one appears as its key (the same title || key the session list shows, e.g. SessionTabStrip.tsx, SessionGridView.tsx). The heading count equals the named list, and reverted[0].report belongs to names[0].
A batch with exactly one reverted session is unchanged: an untitled one still gets the neutral no-subject heading.
Regression in test/sessionWriteFailures.test.tsx covers one untitled and two named sessions. It checks heading "3 sessions", the key in the sentence, and that the report endpoint is the untitled session's own. It is mutation-checked: the old code gives "2 sessions".

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Hand-off report chosen independently of the filtered names list span=067a7df47a74

fixed in f6538da: names = reverted.map(c => c.name || c.key) no longer filters, so names.length === reverted.length and the report (reverted[0].report) always belongs to names[0]. The banner can no longer name one session while handing off another's request.
This span recurred x4 (it is file-scoped to useSessionActions.ts, and each hit was a different defect), so an opus-pinned read-only retrospective ran first. It ruled KEEP for the bulk-pin aggregation: the store replaces rather than queues, so per-candidate reports would drop N-1 rejections. The invariant it recorded: the notice is a total function of the one reverted array, with no second independently computed set.
The retrospective walked every branch: 0 reverted, 1 named, 1 untitled, N all named, N mixed, N all untitled, and N whose first entry has no report. Its verdict was fix-complete, with nothing else to remove.

@NicholasRBowers

NicholasRBowers commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor
  • Overlong API errors lose structured hand-off context span=dd2971c707e8

rebutted: the added sites pass the raw err.message that the anchored rule prescribes ("pass the same string the site already had and ErrorNotice recovers the structured context by message match", website/AUTOSDE.yaml:661). The 34 findReport( call sites already on main use the same form.
A miss needs a slot-write error body over MAX_MESSAGE (2000 chars) that is neither HTML nor short JSON. Even then the notice, its subject and the hand-off all render, and AskAgentButton.tsx:58 falls back to the failure sentence.
The send site caps its text because it shows the peer's words on screen, and its lookup match follows from that display cap.
Capping only the other added sites would make them the one set of callers whose lookup differs from main's. Capping inside findReport changes the lookup for all 34 existing callers, and it lets two long errors that share a 2000-char prefix pick up each other's report. That is a separate change from this PR's goal.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Added controls have had no cold read (lane limitation) span=d719059991be

rebutted: the item names this lane's own fork limitation, which no change to the diff or the body can lift. The controls it lists are in attachments 01-03.
The same controls have rendered tests: test/ActionFailureNotice.test.tsx, test/App.actionFailureNotice.test.tsx and components/SendToInstanceSubmenu.cov80.test.tsx.
A blind read needs the branch pushed to the base repository, which is a maintainer's call for a fork PR.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • No-subject and bulk banner forms ship without a frame span=2be25b47b834

acknowledged, left for the maintainer's look: both forms reuse the attached banner component and layout unchanged and differ only in the heading string, as the lane itself notes.
The no-subject form was rendered locally in dark and light themes: bold "Couldn't complete that action", then the message, the hand-off and the dismiss control. It could not be attached from this host.
The bulk heading and its count and name agreement are pinned in test/sessionWriteFailures.test.tsx. The no-subject form is pinned in test/ActionFailureNotice.test.tsx.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Same refusal shown twice while the send menu is open span=6637ba7648b4

rebutted, deliberate: the in-menu row notice and its sibling item keep the failure and its hand-off reachable by keyboard inside the open menu. The page banner is what survives the menu closing, which the lane confirms holds.
Removing either loses one of those two cases. Both hand-offs send the same report, so reading them as two actions still gives the user the same result.
The lane asks only to watch for it; that look is left for the maintainer.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • app-wide failure notice is absent from the feature map span=1461f955f94d

fixed in 6378331: docs/feature-map/README.md gains a "Rejected session-change notice" row under Standalone operator surfaces, beside the crash report notice it is mounted next to. It names what the banner is, when it appears (a refused pin or unpin, reload, duplicate, mode switch, folder move, color change or send to another instance), the three shells that mount it (App.tsx dashboard and embed, pages/PopoutFrame.tsx), the store and its four reporters, and the seven routes whose refusals it reports.
scripts/check_feature_map.py with FEATURE_MAP_BASE_REF=origin/main reports the change accounted for, and scripts/docs_lint.py passes.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Ask the agent in the embed and popout banners hard-loads the full dashboard span=b05f3068c7bf

rebutted: this is the shared hand-off's existing behavior in those windows, not something this PR introduces. On main, PopoutFrame renders <ChatPage embedded embedMode="chat" popout />, and that ChatPage already mounts askAgent notices (upload-error and sid-error) that take the same path. App.tsx documents it: popout and embed windows never install the soft navigator, so they "fall through to the hard-nav path instead".
Turning the hand-off off in these two shells would make this one notice the exception among the popout's notices. Routing a popout's hand-off to the main window is a change to sendErrorToChat for every notice, which is outside this PR's goal of reporting rejected writes.

@NicholasRBowers

NicholasRBowers commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor
  • No-subject heading and popout-shell mount are in no frame span=51593cec773e

kept as is: both are the same component as the banner shown in the attached frames, and the reviewer notes this is not an evidence gap. The no-subject heading is pinned by test/ActionFailureNotice.test.tsx. The popout mount is the single <ActionFailureNotice /> line in pages/PopoutFrame.tsx and has no test of its own. The CLI on the machine driving this PR cannot attach new images, so both frames are left for a maintainer to check in the running app.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • reload_failed_rebound: "while it ran" reads as the session span=1d64a255e213

fixed in 6378331: the message now reads "this session was replaced while the reload ran". en-XA is regenerated, and the assertion in test/sessionWriteFailures.test.tsx is updated and passes.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Stale banner after recovery: a later success does not clear the notice span=75e4de87abe4

kept as is, same ruling as the earlier reply: auto-hide on success was removed on purpose after every form of it raced. The notice is past tense ("was undone"), so it stays true after a retry, and it has a dismiss control. A success-driven clear could also erase a failure the user never saw.

@NicholasRBowers

NicholasRBowers commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor
  • Cold-read cap: copy variants unread by a first-time reader span=092bdfdfb7fe

kept as is, same as the earlier reply: the reviewer marks this as its own fork-lane limitation, not a gap in the PR. The variants reuse the one banner shown in the attached frames. The neutral heading and the duplicate, send and bulk-pin wording are asserted in test/ActionFailureNotice.test.tsx and test/sessionWriteFailures.test.tsx.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Feature map overstates notice behavior span=2f6082500a24

fixed in 939275d: the "Rejected session-change notice" row no longer says the banner carries the server's reason. It now says what each case shows. Pin or unpin, mode, folder and color name the session and say what was undone. A failed fork says no new session was created. Reload picks its reason from the gateway's error code. A send to another instance quotes that instance's scrubbed, capped words. In every case the server's detail reaches only the Ask the agent hand-off, which matches the comment in utils/actionFailure.ts.
scripts/check_feature_map.py with FEATURE_MAP_BASE_REF=origin/main and scripts/docs_lint.py pass.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Closing a session during fork, reload or send still reports a stale neutral notice span=aa43add523ec

fixed in 939275d: the fork and reload error handlers in hooks/useSessionActions.ts, and the send failure path in components/SendToInstanceSubmenu.tsx, now report only while the session is still in the slot list. That is the same check pin, mode, move and color already make. Send keeps its inline per-instance error either way.
Regression tests: test/sessionWriteFailures.test.tsx covers fork and reload for a session removed mid-request, and test/SendToInstanceSubmenu.test.tsx covers send, both still-listed and removed. Each test fails with its guard reverted. The related frontend tests (1,483 files) pass.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • Second app-level rejected-write surface beside agentSwitchNotice span=1e692b7d1a32

accepted-and-deferred to #14892: moving the agent, model and reasoning-effort switch reporters onto reportActionFailure and deleting agentSwitchNotice is the subtraction the review names, and it touches 18 call sites across App.tsx, ChatInput, ChatPane, ReasoningEffortDropdown and ChatPage that this PR does not otherwise change.
The issue lists every site on main, owns one open behavior question (the toast auto-clears after 6 s, the new notice waits for dismiss), and is assigned with a due date. This PR's own notice is the target that sibling unit moves onto.

@NicholasRBowers

Copy link
Copy Markdown
Contributor
  • No first-time reader has seen the controls (lane limitation) span=d878d4c5a8a1

kept as is, same as the earlier reply: the reviewer marks this as its own fork-lane limitation, not a gap in the PR.
The two evidence gaps this verdict named are now closed: the description attaches a frame of the no-subject heading and a frame of the bulk pin heading, each captured from the shipped notice with its heading and message asserted before the shot.

Copy link
Copy Markdown
Contributor

PR triage (automated, evidence-based) — REBASE + merge-order discussion

Classification: OVERLAPPING (not duplicate, not superseded). No breaking change or P0 bug found in the diff.

Rebase needed. The branch is 918 commits behind origin/main (merge base b5ca357), and a trial merge (git merge-tree) conflicts in 16 files: website/src/App.tsx, website/src/hooks/useSessionActions.ts, docs/feature-map/README.md, and 13 locale catalogs. One conflict changes what this PR does:

  • chore(frontend): remove Autopilot mode #15359 (merged, "remove Autopilot mode") deleted modeMutation / toggleMode from useSessionActions.ts. The mode adopter here (mode_change_failed reporting in modeMutation.onError) no longer has code to attach to. A rebase should drop that adopter, its mode_change_failed strings and its tests. The Goal line and feature-map row should also stop listing "mode".

Still needed on main. origin/main has no utils/actionFailure.ts or ActionFailureNotice. Pin's onError still calls finishPinMutation(..., false) with no report, and reload still uses alert(). So this PR's goal has not been delivered by anything merged.

Overlap to coordinate (merge discussion):

Recommendation: rebase onto current main (dropping the mode adopter), then continue review. Keep this PR open.

@iamwhatever iamwhatever left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Requesting changes on 63b58a1.

The store and sink look correct: one bounded module store, a sink in each always-mounted shell, and the leave guard on the hand-off. The only change to errorReport.ts exports the existing redactThenCap, so redaction is unchanged. All checks are green.

Before approval:

  1. Nothing answers the UX and First Principles CONCERNS on this head. The last disposition is for 939275d. Please reply to each item. For UX: the send screenshot predates the rebase. It still shows 'Switch to Autopilot' and an unquoted peer sentence, while SendToInstanceSubmenu.tsx#L199 now quotes it, so please re-capture it from this head. The duplicated peer sentence and the two 'Ask the agent' buttons on a failed send, and the pin/move/color messages that give no next step, need a fix or a reasoned reply.
  2. Two deferred items have no issue. The first is folding showActionError (turnActions.ts#L81) into the store; this is the First Principles 'Clears when'. The second is moving main's fork-failure messages onto reportActionFailure, which the description names as a follow-up. #14892 covers only agentSwitchNotice. Please do these now or open one issue per item and link them in the description.

— crew-pr-reviewer (r114)

Seven write actions dropped a rejected PATCH silently, so a failed pin, mode,
colour or move looked applied. Split from a larger sweep.

Rebased onto current main; conflict resolution kept main's removal of the
no-op chat-slots invalidateQueries (kirodotdev#10204) and carried only
reportRevertedPins. Corrected a comment that misattributed an onPick guard
to FolderMoveSubmenu.

A second rejection that lands before the first is dismissed now stacks on
top instead of overwriting it; dismissing the newer notice brings the
earlier one back (bounded at ten, oldest dropped), and the banner says how
many earlier failures are waiting. A refused reload leads with "Couldn’t
reload" rather than claiming an update. The neutral heading uses the curly
apostrophe its siblings use.

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

Copy link
Copy Markdown
Contributor

[operator: bolichen97] Maintainer ruling: #10910 and #10911 cover the same rejected/offline session-write problem and only one should land. Keeping #10911 (readiness passed, review addressed) and closing this one. If part of the rejected-write notice is still needed after #10911 merges, please open a small follow-up on top of it. Thank you.

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.

6 participants