Skip to content

fix(onboarding): let a failed Privacy save close the chapter without a choice - #37519

Merged
KiroCrewCaptain merged 2 commits into
mainfrom
fix/privacy-chapter-failed-save-exit
Nov 15, 2026
Merged

KiroCrewCaptain merged 2 commits into
mainfrom
fix/privacy-chapter-failed-save-exit

Conversation

@tim-finnigan

@tim-finnigan tim-finnigan commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: When the first-run Privacy chapter cannot save a choice, the person can close it instead of being stuck on it.

The Privacy chapter's only exits are Keep on and Turn off, and both are config writes. When they keep failing, the chapter shows "Your choice could not be saved" or "Turn off could not be finished" and the only way off the screen is Ask the agent, which opens a chat. #37516 is the case that hit it: a relay teammate whose writes the host refuses as non-owner.

Why it matters

A modal over the whole dashboard with no working exit leaves a person unable to use the product until they hand an error to the agent. #37517 stops the relay case from opening the chapter at all; this covers any other caller whose save keeps failing.

Not a goal

What changed (motivation → approach → change)

The chapter already has one way out that records nothing: onAskAgent hides it and leaves privacyAcked false, so it comes back next load. This adds the same hide as onClose, offered only after a save or unconfirmed failure (a failed Keep on, or a Turn off that failed before its read-back). It shows as a Close icon button in the chapter's eyebrow row (the shell's existing headerAction slot), labelled with the existing app.close string, and the chapter's keydown handler sends Escape to it while it is offered. A pinned Turn off still leaves Keep on, which saves, so it offers no Close. firstRun.tsx wires onClose to the same setShowPrivacy(false) as Ask the agent. A capture script for the screenshots below follows the repo's capture-*.mjs pattern.

Backwards compatibility

Compatible: onClose is optional; without it, and before any failed save, the chapter behaves exactly as on main.

Removes nothing: it adds an exit after a failure and keeps every existing one.

Tests

  • PrivacyChapter.test.tsx "a way out once a save failed": no Close and a dead Escape while a choice can still be saved; after a failed Keep on, Close calls onClose and records nothing more; after a refused Turn off, Escape does the same; a pinned Turn off offers no Close.
  • firstRun.dismiss.test.tsx "closing Privacy after a failed save": in the real first-run host, Close hides the chapter without markOnboarded, and a fresh mount derives it again.

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

Reverting PrivacyChapter.tsx and firstRun.tsx makes three of the new cases fail (checked by hand); the two "no Close" cases pass either way by design. Locally: the 10 test files that reference the Privacy chapter or first run, plus App.test.tsx, pass (242 tests); tsc --noEmit, eslint on the changed files, check-i18n-keys and check-i18n-strings are clean. No new string, so no locale changes.

Manual verification

Not run in a browser by hand; the capture below drives the real SPA through the failed save and Close.

Screenshots / video

Real SPA, every /api call answered from fixtures, the theme write refused with 403 as the owner gate refuses a teammate (website/scripts/capture-privacy-chapter-failed-save.mjs, which asserts each frame before writing it).

Keep on was refused: the error shows and the new Close sits in the eyebrow row (there was no Close before the click).

Privacy chapter after a failed save, with Close

After Close: the chapter is hidden and the dashboard is reachable

Dashboard after closing the Privacy chapter

Related Issues

Part of #37516

Sibling sweep

Swept: git grep -n "onAskAgent|Escape is NOT wired|cannot be dismissed" -- website/src/components
Siblings: none -- the Privacy chapter is the only first-run chapter with no skip; Import and Customize already pass onSkipAll

Pattern harvest

Rule candidate: review-prompt
Pattern: a mandatory modal whose only exits are writes needs a no-record exit once a write has failed

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

…a choice

The first-run Privacy chapter had no exit but forward, and forward is a
config write. When that write keeps failing (a caller the gateway refuses,
as a relay teammate is) the only way off the screen was Ask the agent.

Once Keep on or Turn off fails to save, the chapter offers Close in the
eyebrow row, and Escape does the same. Both hide it the way Ask the agent
does: no choice is recorded, so it opens again at the next load. Before a
failure, and when Turn off is held by a pin (Keep on still saves), nothing
changes. The button reuses the existing app.close label, so no new string.

Refs #37516
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of c833e9019320689a9a126d33b795b82d3f0f1cec — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. The Close only appears after a write fails and records nothing, so it does not make the mandatory chapter skippable.

Notes

  • The commit's title says test(onboarding) but the patch changes behaviour in PrivacyChapter.tsx and firstRun.tsx. Make the commit fix(...) to match the PR title.

[DESIGN-REVIEWED] c833e90

Description read

[DESCRIPTION-READ] b58d8e62623567468f0e244bc8ec9484051f16a03779c1c6c545325844ad9548

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

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of c833e9019320689a9a126d33b795b82d3f0f1cec — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks: the blind reader read the new X as "closes the window". They only hesitated over what closing does to their choice.

Notes

  • The blind reader said of the X: "Does closing mean the recording stays on? … I'd hesitate". Once Close is offered, add a clause to the save-failure line, e.g. "Close to decide later; nothing changes until you choose."

[UX-REVIEWED] c833e90

Description read

[DESCRIPTION-READ] 159fd10cc93d40e43e379f16c9a86bf42e79374018cc23ec96d2388f6753ff8f

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of c833e9019320689a9a126d33b795b82d3f0f1cec — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks: the fix adds one exit that records nothing, shown only after a save fails, and it is backed by #37516 and by tests that fail on the base.

Notes

  • Item 3 — one consumer, generalized: onClose is a second hide callback. Its only caller, firstRun.tsx, wires it to the same setShowPrivacy(false) as onAskAgent ("Same, from Close or Escape once a save failed"). Subtraction: delete the onClose prop and let the chapter call onAskAgent's hide for Close. One prop then carries "hide without recording".

What this change ships

Inventory (4 items) — 3 justified

Intent: let a person stuck on the first-run Privacy chapter after a save fails get off it without recording a choice. This is a FIX.

The patch file also carries about 80 unrelated files because the PR's base is stale (MCP body fields, the Electron companion, i18n). The merge commit against the base (932e28e2..445be853) changes 5 files, so this inventory covers those 5.

  1. After a failed Keep on, or a Turn off that fails before its read-back, a Close icon appears in the chapter's eyebrow row and hides the chapter — justified
  2. Escape closes the chapter while that Close is offered, and does nothing before a failure — justified
  3. A new optional onClose prop on PrivacyChapter, wired in first run — one consumer, generalized: same handler as onAskAgent
  4. A screenshot capture script, capture-privacy-chapter-failed-save.mjs — justified

[FIRST-PRINCIPLES-REVIEWED] c833e90

Description read

[DESCRIPTION-READ] 9588ec5c8b09dd959879ad3f197cba531941f37415a21c2ab82ceda2c46b909e

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

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of c833e9019320689a9a126d33b795b82d3f0f1cec and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] c833e90

False positive or not applicable? A repository writer can comment:
/ai-review override gpt c833e9019320689a9a126d33b795b82d3f0f1cec false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] c833e90

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable c833e9019320689a9a126d33b795b82d3f0f1cec false-positive: <reason, 20 to 500 characters>

@tim-finnigan
tim-finnigan marked this pull request as ready for review November 15, 2026 20:56
@tim-finnigan
tim-finnigan requested review from a team and KiroCrewCaptain as code owners November 15, 2026 20:56
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 15, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: Approve

Why: the decider estimates an 8% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes.

Adds a Close button (and Escape) to the first-run Privacy chapter, offered only after a failed save ('save' or 'unconfirmed' failure). It hides the chapter the same way Ask the agent does: privacyAcked stays false, markOnboarded is not called and the chapter comes back at the next load. There is still no Close before a failure, and none when Turn off is held by a pin. firstRun.tsx is the only caller, and the shell's headerAction slot renders in both host and standalone modes. The unit tests and the first-run host test cover the new behaviour, and CI and every review lane are green. No regressions or trust-boundary problems found.

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 c833e90193 · 255 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 15, 2026 22:25

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

Approved. On this head the review checked that Close and Escape appear only after a save or unconfirmed failure, and that a pinned Turn off still gets no Close. It also checked that Escape goes through a ref and skips IME composition, and that Close reuses the existing hide path in firstRun.tsx. That path writes no ack and does not call markOnboarded, so the chapter comes back at the next load and collection is never turned on without consent. Each new test fails when its branch is reverted, and the tests use no sleeps.

Done well: the integration test remounts the real first-run host to prove that Close records nothing.

Optional:

  • docs/system-specs/modules/metrics.md still says the Privacy chapter "offers no skip and no Escape" and that a failed write keeps it open. A follow-up could say that Close and Escape are offered once a save fails.
  • #37463 landed on main after this branch. It adds the offer-form failure kinds onPartial, onLanded and keepUnconfirmed, and the Close condition does not cover them. Writing the condition as failure && failure.kind !== 'pinned' would cover those kinds and any future ones.
  • Keeping onClose separate from onAskAgent is fine as it is. It lets a caller offer one exit without the other.

@KiroCrewCaptain
KiroCrewCaptain merged commit 5b9d204 into main Nov 15, 2026
110 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/privacy-chapter-failed-save-exit branch November 15, 2026 22:26
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 15, 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.

2 participants