Skip to content

fix(dashboard): retire a gone spawn approval everywhere - #20987

Merged
chenmingwei23 merged 2 commits into
mainfrom
replace/13881
Oct 17, 2026
Merged

chenmingwei23 merged 2 commits into
mainfrom
replace/13881

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Withdraw a stale or terminal spawn-approval decision on every dashboard surface without falsely declaring that the sub-agent never ran.

A terminal refusal for a spawn approval (404 not found or expired) closes the decision, but it does not prove that no process launched: another browser can approve the same id first. On main only the activity panel's refusal text was fixed (#13813). The composer banner, progress bar, sidebar counts, command center, Reload gate and tip suppression still either keep a pending zombie or read the chat as idle while a sub-agent may be running.

Why it matters

Approval actionability and process liveness are different authorities. Every surface must agree during the cross-tab race and after the spawn manager answers; otherwise users see dead Approve/Reject buttons or a chat that looks idle mid-run.

Not a goal

What changed (motivation → approach → change)

This replaces #13881 by @leonlaiyc (with @bolichen97), re-homed onto current main. Both original commits and their authorship are kept.

  • A terminal approval refusal immediately withdraws decision controls everywhere; a reconnect that finds an approval gone without a known outcome records the same verdict (markSubagentApprovalGone).
  • Liveness stays conservatively active until GET /api/spawn answers (reconcileGoneSubagent → reconcileSubagentApprovalGone). The record is matched by run id, so nested, cron- and channel-born runs work. A still-awaiting_approval row stays unresolved; a launched row becomes running/tool; a finished row adopts its outcome; an absent row retires the card.
  • Concurrent gone-card reconciliations share one in-flight inventory GET. The reducer checks slot, run id and approval id before applying, so a late answer cannot overwrite a fresh approval or spawn frame.
  • Gone/retired are phase-scoped: a real spawn or tool frame clears the retired marker, so retired → tool → stopped reads as an ordinary stopped run.
  • Composer busy state, sidebar counts, tip suppression, Reload blocking, progress rendering, launch summaries and command-center actionability share the same predicates (isActiveSubagent, isSpawnApprovalGone, isSpawnApprovalRetired, selectSlotSubagentsActive). A retired card shows no run usage, is not tallied as stopped, and "Dismiss done" clears it locally without a DELETE.
  • The activity card reads "Checking whether it started…" while unresolved and "No record" when retired (an absent row can also be a finished run the gateway no longer keeps).
  • The refused request is reported once, on the surface that sent it; other surfaces show only neutral liveness status. A failed liveness read gets its own notice and is retried by the existing 30 s poll.
  • The progress bar's 30 s poll keeps main's silent catch from fix(chat): route error states through ErrorNotice (batch chat-2) #8743 unchanged. The liveness check for a gone (404) approval is its own handler on the same read: it runs only while a gone card waits, raises "Couldn't check whether it started. Retrying…" when the read is refused, and clears it when one answers.

Re-homing onto main (the fork was ~1226 commits behind):

  • website/src/pages/ChatPage.tsx: main moved the active-slot state, including tip suppression, into website/src/pages/chat/page/activeSlotState.ts. The PR's switch of tip suppression to selectSlotSubagentsActive now lives there.
  • website/src/store/chatSlice.ts and chatSlice.publicSurface.test.ts: union of main's new exports and this PR's.
  • Locale files: main's pluralised retry_failed_error kept; the two new liveness keys added after it.
  • docs/system-specs/modules/subagent.md: main's tool-call timeline paragraph kept; this PR's paragraph follows it.
  • The fork committed its screenshots under temp-screenshots/; this PR attaches freshly captured frames instead and commits none.

Backwards compatibility

Compatible: the added gone/retired markers are optional fields; existing live/terminal states keep their behaviour, and fresh approval/spawn events supersede the scoped gone verdict.

Removes nothing: the change adds state and predicates; no key, route, record or public export is removed or renamed.

Tests

  • SubagentProgressBar.parkedApproval: "stays silent when the failed poll had no gone approval to settle (fix(chat): route error states through ErrorNotice (batch chat-2) #8743)" pins the generic poll's silence; the gone-card liveness tests pin the reported path.
  • 567 passed across 12 Vitest files: subagentActivity, chatSlice.ownership, chatSlice.publicSurface, ChatSliceCoverage, chatSlice.activity, ActivityViewerCoverage, ChatInput.approval, SessionActionsMenu.errorHandoff, SubagentProgressBar.parkedApproval, SubagentRunCard, UseWebSocketCoverage, commandCenterModel.
  • They pin: retire → tool → stopped never reads as retired; run-id matching for nested/cron-born runs; reconnect withdrawal; canonical terminal outcomes; still-awaiting inventory; stale-response protection; non-terminal retries; liveness error/retry paths; one inventory GET for simultaneous gone cards; Reload release only after authoritative settlement.
  • tsc -p tsconfig.app.json clean; ESLint on touched files clean; src/i18n suite 1018 passed; i18n:check, lint:i18n and check_feature_map.py pass against origin/main.

Manual verification

website/scripts/capture-spawn-approval-gone.mjs mounts the real ChatInput, SubagentProgressBar and ActivityViewer on one store (website/capture/spawn-approval-gone.tsx) and asserts each frame's state before the shot. Re-run on this branch's head: all 14 frames (7 scenarios × dark/light) passed their assertions, including the refusal sentence on exactly one surface and a retired card reading "No record".

Screenshots / video

Dark

dark: controls withdrawn, liveness reconciling; refusal only on the composer that sent it

dark: authoritative absence retired; the card reads "No record"

dark: composer refusal, then a failed liveness read gets its own notice

dark: the chip's 30s re-read fails too: the progress bar reports its own failed read

dark: gone refusal on the activity card, then a failed spawn-inventory read

dark: non-terminal 500 keeps Approve/Reject under the error notice

dark: three-agent banner after one gone refusal

Light

light: controls withdrawn, liveness reconciling

light: authoritative absence retired; "No record"

light: composer refusal, then a failed liveness read

light: chip re-read fails too

light: activity-card refusal, then a failed inventory read

light: non-terminal 500 keeps Approve/Reject

light: three-agent banner after one gone refusal

Related Issues

Fixes #20985
Replaces #13881 — original work by @leonlaiyc, with @bolichen97. Follow-up to #13813 / #11180.

Pattern harvest

Not generalizable: the defect is one specific conflation (a decision refusal read as process termination) across this one sub-agent state model; the fix is a shared predicate set, not a pattern a lint rule can catch.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • 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

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

Separate approval actionability from process liveness. Withdraw a gone
decision immediately, then settle its unique run id from authoritative
inventory without making unresolved work appear idle.

Share the state across composer, activity, counts and Reload. Preserve
retryable failures and report liveness failures, prevent retired markers
from returning after launch, and cover reconnect and cross-surface races.

Co-authored-by: Bolin Chen <bolichen@amazon.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 15, 2026
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — 🟡 CONCERNS

Design-level review of 1a7bf1e3704c112f05cc562ddaf1d62291488c13 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

The phantom-card sweep for every card stops checking parent, but the description says this PR "only acts on a gone (404) approval".

Watch

  • An unannounced change to the generic sweep. The hunk -filter((a) => !a.done && a.parent === \dashboard:${slot}`)→+filter((a) => !a.done)changes the 30 s sweep for every active card, not just gone ones. Before, a live run whoseparentwas not this tab's key was marked failed. Now it stays live, and "Dismiss done" no longer cancels it. That is probably the right fix (the in-code comment explains why), but it is a behaviour change on its own. It contradicts the## Not a goalclaim, and no test listed under## Testsis said to pin it.Clears when: the sweep change is listed in "What changed" with a test that pins a nested, cron- or channel-born live run surviving the sweep, or it moves to its own PR.`

Suggestions

  • SubagentProgressBar now builds its own copy of the inventory lookup and the reconcileSubagentApprovalGone dispatch that reconcileGoneSubagent already owns. Have the poll call that one thunk so there is a single path for matching inventory rows and settling cards.

[DESIGN-REVIEWED] 1a7bf1e

Description read

[DESCRIPTION-READ] cabb6a92c97777090eff58cc016378caed30f32248bec622f24708e81d4bb3da

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of 1a7bf1e3704c112f05cc562ddaf1d62291488c13 — 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 activity card adds its own 30 s GET /api/spawn timer, though the description says the failed read "is retried by the existing 30 s poll".

Not justified as shipped

  • Item 6 — duplicate of SubagentProgressBar.tsx reconcile interval: the description says "A failed liveness read … is retried by the existing 30 s poll". The diff adds a second poller in ActivityViewer.tsx: setInterval(() => checkLiveness(approvalId), 30_000) ("This card keeps that retry going on the same cadence"). The two pollers differ on the case where the Subagents tab is open, so the description is wrong about which mechanism retries.
    Subtraction: delete the livenessOpen setInterval effect in SubagentPane and rely on the progress bar's poll.
    Clears when: the interval is removed, or the PR shows the progress bar is unmounted while the Subagents tab is open and a gone card would otherwise stay stuck as "Checking whether it started…".
  • Item 8 — undeclared: a non-terminal (500) spawn-decision failure in the composer now shows "decision not recorded". Before, the composer silently re-enabled the buttons. This is outside the "gone (404)" scope the description draws.

What this change ships

Inventory (9 items) — 7 justified

Intent: when a spawn approval is gone, remove its Approve/Reject buttons everywhere without claiming the sub-agent never ran — a FIX (#20985).

  1. A gone spawn approval loses its Approve/Reject buttons in the composer, panel and command center — justified
  2. After a refusal or a reconnect, the dashboard asks the spawn inventory and moves the card to running, finished or retired — justified
  3. The progress bar shows a new "checking whether it started" count and row label — justified
  4. The busy composer, sidebar counts, tip suppression and Reload gate stay on until that check answers — justified
  5. The activity card reads "Checking whether it started…" or "No record" — justified
  6. A failed liveness read shows a notice on the composer, the progress bar and the card, and the card re-reads every 30 s — duplicate of SubagentProgressBar reconcile poll
  7. The phantom-card sweep matches live runs by id instead of parent — justified
  8. A non-terminal composer decision failure now shows an error notice — undeclared
  9. A retired card shows no usage, is not counted as stopped, and "Dismiss done" clears it without a DELETE — justified

[FIRST-PRINCIPLES-REVIEWED] 1a7bf1e

Description read

[DESCRIPTION-READ] 111fe4678145c705a84374cb498cf743278a876f3d589c297b5ad084e0428bf2

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🟡 CONCERNS

UX-level review of 1a7bf1e3704c112f05cc562ddaf1d62291488c13 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

The gone-approval refusal names no task, so beside live approvals it reads as being about them. "No record" and repeated liveness notices leave the reader unsure what happened.

Watch

  • The expired banner points at nothing. The composer shows "This approval has expired or was already decided — the agent is no longer waiting on it." without naming the task. In shot-07 it sits right under "Approve all / Reject all" for two live approvals. The blind reader said: "no idea which approval it means… confusing." This happens whenever several sub-agents are pending and one of them is gone, and it can lead a user to reject or ignore approvals that are still valid. Fix: name the task in the composer notice, e.g. "Approval for "Check the changelog links" expired or was already decided."
  • "No record" doesn't say what to do next. The reader said "No record" "doesn't tell me whether the task finished, failed or never ran", and they would not touch its checkbox. The uncertainty is deliberate, but the label gives no next step. Fix: add one line, e.g. "No record — it may have finished or never started. Check the chat for its result."
  • One failure looks like several. The liveness failure renders in the composer, the progress chip and the activity card, each with its own "Ask the agent". The reader asked: "can't tell whether it is one problem or several" and "can't tell the two links apart" (shot-05). The notice also says "Retrying…", so the system is already handling it, and "Ask the agent" gives the user nothing extra to do. Fix: show it on one surface, and drop askAgent from the liveness_check_failed notices.
  • The light-theme shots don't show the light theme. shot-08 to shot-14 have a grey layer over the composer and the chip that the dark shots don't have. The reader concluded the controls were disabled: "I'd only use the right-hand ones." If that layer comes from the capture harness, re-capture so light theme can actually be judged; if it's real, it's a defect.

Suggestions

  • In the subagent-unresolved-count chip, the CircleDashed counter explains itself only in a title tooltip. Add visible text such as "1 checking". The reader was "only guessing" what "◌ 1" meant.

[UX-REVIEWED] 1a7bf1e

Description read

[DESCRIPTION-READ] a0bf346ee177bcdfb480e378c95069551bf6e6eedecf67f3d84f7a2022fa029b

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 1a7bf1e3704c112f05cc562ddaf1d62291488c13 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 1a7bf1e

Verdict parsed from the review's SHA-scoped output markers for commit 1a7bf1e3704c112f05cc562ddaf1d62291488c13.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 1a7bf1e3704c112f05cc562ddaf1d62291488c13: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ human override accepted

Human judgment by @iamwhatever overrides the GPT 6.1 finding for 1a7bf1e3704c112f05cc562ddaf1d62291488c13; the recorded reason is authoritative for this commit.

[GPT-OVERRIDE] 1a7bf1e

This comment is updated in place on each push.

The model was not re-run because an authorized human decision supersedes it.

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

@iamwhatever
iamwhatever force-pushed the replace/13881 branch 2 times, most recently from 9447986 to 442900f Compare October 16, 2026 00:15
The progress bar's liveness-failed flag was cleared only by its own
30s poll succeeding. A spawn frame or the activity card's re-read can
settle the last gone approval first, so the flag outlived the cards it
described and the next refusal showed "Couldn't check whether it
started" before any read for that card had failed. Reset it whenever
the unresolved count reaches zero.

Restore the fake clock in the liveness re-read test through
onTestFinished instead of a finally. That section awaits waitFor, and
a test that times out never reaches its finally, so every later test
in the file would run on the fake clock.

Per maintainer review: the refused request now reports itself once,
on the surface that sent it (the composer or the pressed card), not
also on the progress bar and the other card. A retired card reads
"No record" instead of "Never started": an absent inventory row can
also be a run the gateway no longer retains. On the composer the failed
liveness read after a refusal gets a notice of its own: it used to
overwrite the shared approval notice a microtask after the refusal was
shown, which left no surface reporting the refusal at all.

Match the progress bar's phantom sweep against live rows by run id, as
the gone-approval branch already does. Its dashboard-parent filter
marked a cron-born or nested run failed on the poll after it was
settled to running, and "Dismiss done" would then cancel it.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Leon <leon.lai.yc@gmail.com>
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Disposition for the GPT 6.1 finding on SubagentProgressBar.tsx (errors-use-error-notice, raised on 5a557ba): the generic poll catch is main's own, kept byte-for-byte from #8743, which made it deliberately silent; as of 1a7bf1e this PR no longer changes it. The only new behaviour, the gone (404) approval liveness check, is a separate handler on the same read and reports through ErrorNotice.

@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 Oct 16, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt 1a7bf1e: The flagged silent catch is main's own poll catch from #8743, kept byte-for-byte and not changed by this PR. #8743 made it silent on purpose: the poll only removes phantom cards and the user asked for nothing. First Principles blocked the earlier version that reported it, as reversing #8743. The PR's new gone-approval path does report via ErrorNotice.

@iamwhatever
iamwhatever marked this pull request as ready for review October 16, 2026 16:18
@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 16, 2026 16:18
@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the gpt AI finding as false positive, not applicable, or explicitly accepted for 1a7bf1e3704c112f05cc562ddaf1d62291488c13.

The flagged silent catch is main's own poll catch from #8743, kept byte-for-byte and not changed by this PR. #8743 made it silent on purpose: the poll only removes phantom cards and the user asked for nothing. First Principles blocked the earlier version that reported it, as reversing #8743. The PR's new gone-approval path does report via ErrorNotice.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 16, 2026

@mbriones98 mbriones98 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.

Checks green and readiness passed at 1a7bf1e; no behavior change.

@chenmingwei23
chenmingwei23 merged commit d381883 into main Oct 17, 2026
108 of 109 checks passed
@chenmingwei23
chenmingwei23 deleted the replace/13881 branch October 17, 2026 00:31
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dashboard: a gone spawn approval is not retired on every surface (follow-up to #13813)

5 participants