Skip to content

fix(pages): ask in-app before artifact, channel and Knowledge actions - #30515

Merged
KiroCrewCaptain merged 1 commit into
kirodotdev:mainfrom
abirkel:fix/native-dialog-m04-library
Nov 18, 2026
Merged

KiroCrewCaptain merged 1 commit into
kirodotdev:mainfrom
abirkel:fix/native-dialog-m04-library

Conversation

@abirkel

@abirkel abirkel commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Reverting an artifact version, removing an artifact, closing a channel, and deleting or removing Knowledge items and sources ask for confirmation inside the app window instead of in an OS dialog.

These six actions (artifact revert, artifact removal, channel close, Knowledge item delete, Knowledge source removal and Knowledge bulk delete) call the browser-native confirm(). #15854 added the lint gate against new native dialogs and exempted these files, with the other existing callers, in a shrink-only allowlist. On Windows, a native confirm() from the renderer leaves the window ignoring the keyboard until it is re-activated (#15976).

Why it matters

These prompts are among the remaining native calls that can reach the Windows keyboard problem in #15976. Replacing them shrinks that set.

Not a goal

  • Migrating any other allowlisted file. Each remaining one has its own PR in this series.
  • The artifact editor's async leave guard, which belongs to a later PR.
  • Changing the confirmation wording, the button labels or navigation.
  • Making the shared dialog wrap very long unbroken words in the question. That is a separate change to ConfirmDialog.tsx with its own PR in this series.

What changed (motivation → approach → change)

Each page now asks through the in-app useConfirm dialog. The native question becomes the dialog body unchanged, and the title is a short existing action label, because Modal truncates a title to one line and would hide the warning. The Knowledge sources list keeps its two wordings, one for Live sources and one for ingested sources.

The old dialog blocked the page, so nothing could change while it was open. The in-app one does not, so each action captures what it needs first: the artifact slug and versions, the channel id, the item id, the source id, or the selected item ids. Each action also ignores a second press while its question is open, and the Artifacts and Sources removals ignore a second press on a row whose delete is still in flight. Three continuations needed more than that, because they can finish after the user has moved on:

  • ArtifactDetailPage.tsx: the revert captures the edit generation when the question opens and checks it before every page-state update. Navigating to another artifact while the request is pending does not change that artifact's saving, error or version state, and an open question, such as the revert, is withdrawn when the route moves to another artifact, because the revert body does not name the artifact. A late answer is dropped as well. Switching artifacts also resets the saving state in useArtifactDetailPageDocument.ts, so a revert abandoned mid-request does not leave the next artifact marked as saving. The revert invalidates the same three cache keys, for the artifact it reverted. Its confirm button uses the non-danger style, because a revert keeps the current state in version history.
  • ChannelPage.tsx: closing a channel clears the selection and leaves the narrow detail view unless the user has selected another channel that still exists. If the user opened another channel while the question or the request was pending, that channel stays open. If another client closed the selected channel first and the page was showing a fallback, closing that fallback returns to the list.
  • knowledge/DetailView.tsx: a successful delete returns to the list only while the deleted item is still the one displayed. If the user opened a different item, or the view unmounted, the newer selection stays. The optimistic list update now removes the deleted item's own row rather than the displayed item's.

knowledge/index.tsx: the page's Escape shortcut skips while a confirmation is open, so Escape cancels the question without also clearing the selection.

ArtifactsPage.tsx: the remove-artifact question has a blank line between the question and its consequence, which the shared string body would collapse, so the page splits it at the blank line into two paragraphs.

Every owner renders its dialog in each of its loading, error and content returns. website/eslint.config.js: the six paths leave the allowlist, and the two comment lines that counted the modules lose the number, matching the same edit #30305 makes.

Backwards compatibility

Compatible: the actions, labels and locale keys are unchanged, with no new keys. Only the dialog that asks is different.

Reader: website/eslint.config.js:native-dialog allowlist -- release -- the six removed paths no longer call a native dialog, so lint passes on them under the 'error' gate
Reader: website/src/test/channelNarrow.test.ts:returns to the list when the channel is closed -- release -- replaced by ChannelPageCoverage.test.tsx "returns to the narrow channel list after confirming the selected channel close"

Tests

Each action has tests that Cancel does nothing, that approval acts on the target captured when the question opened, and that the full question renders in the dialog body. The artifact revert also covers navigating to another artifact while the request is pending, for a success and a failure, and the open revert question is withdrawn when the route moves. The revert question also stays open while the page shows its loading, error and not-found states. A leave-guard test checks that the discard dialog still renders in the load-error return, and the guard's own logic is unchanged. Closing a channel covers the narrow layout returning to the channel list, including after another client closed the selected channel, and the source-regex test for that in channelNarrow.test.ts is removed because the code no longer has that literal shape. Duplicate presses are covered by ignores duplicate removal presses while the mutation is pending, and the Knowledge page has Escape on the bulk-delete confirmation cancels it and keeps the selection. Knowledge delete covers the displayed item changing and the view unmounting before the delete finishes. The Artifacts page covers a scope change while the question is open. Knowledge bulk delete keeps a refused item in the list, and deletes the ids captured when the question opened even if another row is checked before the answer. The converted tests use the shared website/src/test/confirmAction.ts.

Proof: not provable -- frontend test (prove.py runs Python only).

Seven tests in the related run fail in this environment because Vite cannot load a worker from the symlinked node_modules, in ArtifactDetailPage.test.tsx (edit mode keeps Save and Cancel in the row and offers Snapshot from More, Back button confirms before discarding unsaved edits (round 12), Cmd+S triggers handleSave when dirty in edit mode, Cancel button confirms before discarding while dirty, Live dropdown change with dirty buffer prompts before discarding, does not refetch content while the editor is open) and ArtifactDetailPage.anchoredComments.test.tsx (does not offer anchored add while editing), all with Denied ID .../@pierre/diffs/dist/worker/worker-portable.js?worker&url. The same seven fail by name and error on an unmodified checkout of the base commit run the same way, so they are not caused by this change.

Manual verification

The real page components were rendered with stubbed API responses in headless Chromium, and each confirmation was opened by clicking the real control (screenshots below). A live desktop build was not run.

Screenshots / video

Artifact revert:

Artifact revert

The other dialogs

Artifacts remove

Channel close

Knowledge delete item

Knowledge remove source, ingested

Knowledge remove source, live

Knowledge bulk delete

Related Issues

Part of #15976. Also relates to #15662, which #15854 closed after adding the shrink-only native-dialog allowlist that this PR shrinks.

Sibling sweep

The search also matches comments and in-app confirm({...}) calls in other files, none of which is a native dialog.
Swept: git grep -nE "(window\.)?\bconfirm\(" origin/main -- website/src/pages ':!*test*' | grep -v "await confirm" and the same search for alert\( and prompt\(
Sibling: website/src/pages/members/MembersPage.tsx -- tracked in #15976 -- allowlisted native confirm, migrated in a later PR of this series.
Sibling: website/src/pages/members/NewCrewmateDialog.tsx -- tracked in #15976 -- allowlisted native confirm, migrated in a later PR of this series.
Sibling: website/src/pages/overview/AgentTemplatesTab.tsx -- tracked in #15976 -- allowlisted native confirm, migrated in a later PR of this series.
Sibling: website/src/pages/overview/KiroCrewCfgTab.tsx -- tracked in #15976 -- allowlisted native confirm, migrated in a later PR of this series.
Sibling: website/src/pages/overview/MemoryTab.tsx -- tracked in #15976 -- allowlisted native confirm, migrated in a later PR of this series.
Sibling: website/src/pages/overview/PortabilityTab.tsx -- tracked in #15976 -- allowlisted native confirm, migrated in a later PR of this series.
Sibling: website/src/pages/overview/PromptsTab.tsx -- tracked in #15976 -- allowlisted native confirm, migrated in a later PR of this series.
Sibling: website/src/pages/overview/SkillsTab.tsx -- tracked in #15976 -- allowlisted native confirm, migrated in a later PR of this series.
Sibling: website/src/pages/overview/SteeringTab.tsx -- tracked in #15976 -- allowlisted native confirm, migrated in a later PR of this series.
Sibling: website/src/pages/ProjectsPage.tsx -- tracked in #15976 -- allowlisted native alert and prompt, migrated in a later PR of this series.
Sibling: website/src/pages/overview/AgentCfgTab.tsx -- tracked in #15976 -- allowlisted native alert, migrated in a later PR of this series.
Sibling: website/eslint.config.js -- tracked in #15976 -- the allowlist names every remaining native caller, including alert and prompt callers.

Pattern harvest

Rule candidate: lint
Pattern: renderer calls to native confirm, alert and prompt, already refused outside the allowlist by no-restricted-globals and no-restricted-properties in website/eslint.config.js (#15854). This PR shrinks that allowlist.

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

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

@abirkel
abirkel requested review from a team and KiroCrewCaptain as code owners November 5, 2026 15:38
@abirkel
abirkel requested a review from buluoray November 5, 2026 15:38
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of b2a88e43f82b377e1a6f65c7353cbcd5801e5fca 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 six native confirm() calls move to the existing useConfirm seam. The one removed pin, the channelNarrow source regex, is replaced by a behavioural test of the same return-to-list behaviour, and seven screenshots are attached.

Notes

  • The page captures its target, adds a generation/ref guard and drops a second press while the question is open. That pattern now repeats across six handlers and the series' sibling PRs. If more callers need it, the duplicate-press and withdraw-on-route-change logic belongs in useConfirm rather than copied into each page.

[DESIGN-REVIEWED] b2a88e4

Description read

[DESCRIPTION-READ] fa5d7f30931889e32a966753e299bb1312cf29f01507f7cc5a6746679bee2b9a

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — ✅ PASS

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

UX-Verdict: PASS

Nothing blocks. The screenshots show all seven dialog states (revert, artifact removal, channel close, Knowledge item delete, both source-removal wordings, bulk delete). No blind reader has read them, because this is the fork lane; pushing the branch to this repository runs that read.

Notes

  • In the bulk-delete dialog, both the title and the button say a bare "Delete" (pages.knowledge.index.delete), and only the body gives the count. Change the button to "Delete 2 items" so the count appears on the button that does the deleting.
  • The Knowledge item dialog uses "Delete" for both the title and the button, so the title doesn't say what is being deleted. Use a title that names the object, such as "Delete item", in a follow-up, since this PR keeps the wording unchanged.

[UX-REVIEWED] b2a88e4

Description read

[DESCRIPTION-READ] 942038b25700d94cb4b28cec88a5d03dfe820098cd6fba35ea66e15c79436133

That sha256 names everything this verdict read: the PR description, plus the 10 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

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

Review details

No findings.
[GPT-REVIEWED] b2a88e4

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] b2a88e4

@github-actions

github-actions Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

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

Premise-level review of b2a88e43f82b377e1a6f65c7353cbcd5801e5fca 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 to check.

What this change ships

Inventory (9 items) — 9 justified

Intent: stop six artifact, channel and Knowledge actions from opening an OS dialog that leaves the Windows window ignoring the keyboard (#15976). This is a FIX.

  1. The six confirmations (artifact revert, artifact removal, channel close, Knowledge item delete, source removal, bulk delete) now open inside the app instead of in an OS dialog — justified
  2. The revert's confirm button is no longer styled as dangerous — justified
  3. Moving to another artifact withdraws its open revert question, and a revert still in flight stops changing the page — justified
  4. Moving to another artifact clears a leftover "saving" state — justified
  5. A channel opened while a close was pending stays open; otherwise the narrow view goes back to the list — justified
  6. A finished Knowledge delete returns to the list only if the deleted item is still on screen, and only its own cached row is removed — justified
  7. A second press is ignored while a question is open or the same row's delete is still running — justified
  8. Escape cancels the Knowledge bulk-delete question without also clearing the selection — justified
  9. The six files leave the native-dialog lint allowlist, and a source-regex test is replaced by a behaviour test (declared in a Reader: line) — justified

[FIRST-PRINCIPLES-REVIEWED] b2a88e4

Description read

[DESCRIPTION-READ] 689b50e77849a5479c699b14620fed1df8a6786fa2e3c743b5f932e783f99795

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.

@abirkel
abirkel force-pushed the fix/native-dialog-m04-library branch from f95b343 to 7de35c4 Compare November 10, 2026 00:59
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 10, 2026
@abirkel
abirkel force-pushed the fix/native-dialog-m04-library branch from 7de35c4 to fc1efad Compare November 10, 2026 02:18
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 10, 2026
@abirkel
abirkel force-pushed the fix/native-dialog-m04-library branch from fc1efad to b211f63 Compare November 11, 2026 00:58
@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 Nov 11, 2026
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 12, 2026
@KiroCrewCaptain

KiroCrewCaptain commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider raised 1 possible problem and estimates a 60% chance that this change introduces a defect; a person should check it.

I'm requesting changes. The PR replaces six native confirm() calls with the in-app useConfirm dialog, and most of the stale-state handling for the non-blocking dialog holds up. The exception is the new channel-close guard, where I confirmed the GPT lane's finding in the code. It decides whether to leave the narrow detail view by comparing the stale activeId with the closed channel. Suppose another client closes the selected channel, the user is moved to a fallback they never picked, and they then close that fallback when it is the last channel. closeDetail() is skipped, and the narrow layout is left with the list hidden and no Back control. On main the handler always called closeDetail(), so this is a regression on a concrete path. The fix is small: also return to the list when the selected id no longer names a live channel, with a test for that path. Frontend tests were still pending at review time.

Things to check (possible problems the decider raised; at this confidence many turn out to be fine):

  • Path: on the narrow layout, open channel A. Another client closes A, so channel_closed removes it while activeId stays A, and the page shows fallback B, which the user never picked. The user closes B, and B is the last channel. selectedIdRef.current is still A, so A !== B and closeDetail() i (website/src/pages/ChannelPage.tsx, medium)

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

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Nov 12, 2026
@abirkel
abirkel force-pushed the fix/native-dialog-m04-library branch from a81ba02 to 773581a Compare November 15, 2026 05:39
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention 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 merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 15, 2026
@abirkel
abirkel force-pushed the fix/native-dialog-m04-library branch from 773581a to 152051e Compare November 17, 2026 06:15
@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 Nov 17, 2026
Six actions asked through the browser-native confirm(): reverting an
artifact version, removing an artifact from the library, closing a
channel, deleting a Knowledge item, removing a Knowledge source and
bulk-deleting Knowledge items. In the desktop app that is an OS dialog,
and on Windows the window can stop taking keyboard input after it closes
until it is re-activated (kirodotdev#15976).

Each page now asks through the in-app useConfirm dialog. The title is a
short action label and the unchanged question is the dialog body,
because Modal truncates a title to one line. Each action captures its
target before it waits and acts only on a true answer: the artifact slug
and versions, the channel id, the item id, the source id and the
selected item ids. Each action ignores a second press while its question
is open, and the Artifacts and Sources removals ignore a second press on
a row whose delete is still in flight. The Live and ingested Knowledge
sources keep their distinct wording, and the remove-artifact question
keeps its two paragraphs.

The in-app dialog does not block the page, so a continuation can finish
after the user has moved on. The artifact revert guards its page-state
updates with the edit generation read when the question is answered, so
it cannot change another artifact's saving, error or version state. It
invalidates the same three cache keys, for the artifact it reverted.
Switching artifacts withdraws an open question, such as the revert,
because the revert body does not name its artifact, and clears the
saving flag, so a revert abandoned mid-request does not leave the next
artifact marked as saving. Closing a channel clears the selection and
leaves the narrow detail view unless the user has selected another
channel that still exists. A Knowledge item delete returns to the list only while that item
is still the one displayed, and not after its view unmounted, and its
optimistic update removes the deleted item's own row rather than the
displayed item's. The Knowledge page's Escape shortcut skips while a
confirmation is open.

Remove the six files from the native-dialog allowlist.

Part of kirodotdev#15976
@abirkel
abirkel force-pushed the fix/native-dialog-m04-library branch from 152051e to b2a88e4 Compare November 18, 2026 02:01
@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 Nov 18, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 18, 2026 04:16

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving. On this head the review checked the following:

  • All six changed sites, one by one. Each captures its target (slug, channel id, item id, bulk id list) before it awaits the in-app question, then acts only on what the question named.
  • The late-response guards: the edit generation in revert, currentItemIdRef in DetailView, and the selected-and-still-exists check in ChannelPage.
  • confirmDialog renders in every early-return branch.
  • The eslint native-dialog allowlist only shrinks, by exactly these six files.
  • Each race the body names has a test that holds the request on a deferred promise. These tests contain no sleeps or wall clocks.

Done well: the source-regex test in channelNarrow.test.ts is replaced by real narrow-layout behaviour tests, so the tests now check what the user sees, not the text of the code.

Security: these are destructive-action confirmations in the dashboard UI, not the agent tool-approval gate. Every confirmation is kept. Only the surface that asks changes, from the native confirm() to the in-app dialog. No auth, sandbox or trust-boundary code is touched. The slug shown in the dialog goes through React text escaping, with no innerHTML.

Optional:

  • ChannelPage.tsx ~1205: add a narrow-layout test where the user opens another channel while a slow close is pending, and assert that the detail pane stays open. All four narrow tests today cover only the return-to-list branch.
  • ChannelPage.tsx ~1206: pin the close target in pendingClearRef, as the clear questions next to it do. Then a channel that closes remotely also withdraws its own close question. Today a confirm after a remote close is a harmless no-op.
  • Body only: #30305 already removed the count from the eslint comment lines, and #30516 and #30734 already migrated the five Sibling sweep files listed as "migrated in a later PR". A body edit would fix both.

@KiroCrewCaptain
KiroCrewCaptain merged commit 1dfc80a into kirodotdev:main Nov 18, 2026
93 of 96 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants