Skip to content

Warn on slow profile saves instead of failing them - #26447

Merged
AmethystLiang merged 6 commits into
mainfrom
profile-saving-followup-design-astra
Oct 8, 2026
Merged

AmethystLiang merged 6 commits into
mainfrom
profile-saving-followup-design-astra

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 17 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1407 $\color{#cf222e}{\Huge{\mathbf{−}}}$​494 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​913
Prod 27 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​274 $\color{#cf222e}{\Huge{\mathbf{−}}}$​233 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​41

Problem

Orca saves profile data through a background writer. If a save took longer than 30 seconds, Orca treated it as failed, showed an error, and refused new saves until restart. A slow disk or a sleeping laptop could therefore block later changes even though the write was still in progress.

Solution

A slow save now shows a warning notice instead of failing. Orca keeps waiting for the save, clears the notice when it finishes, and reports a failure only for a real writer error or exit. Pane alias and migration data also save on their own, so small updates no longer rewrite the whole profile.

What Changed

  • Removed the 30 second request deadline and grace logic (profile-state-writer-deadline.ts). A one-shot slow warning replaces it (profile-state-writer-slow-warning.ts).
  • Close waits for the worker to actually exit instead of terminating it after a timer.
  • The main process publishes save-delay status to the renderer. The renderer shows a non-dismissible warning toast that is restored after reload.
  • Pane alias and migration listeners save only their own sections.
  • Quit no longer releases the writer admission while a final flush is still pending.

Why

A timer cannot tell a stuck writer from a slow one, so failing on the timer produced false data-loss reports. Warning and waiting keeps the save path honest, and the user still sees that saving is delayed. Alternatives not taken: raising the timeout (still fails eventually) and retrying the write (risks duplicate writes with an unknown outcome).

Linked Issue

No issue linked.

Visual Proof

TODO: attach before and after screenshots or a video of the save-delay notice. The e2e spec tests/e2e/profile-state-save-delay.spec.ts captures a screenshot of the notice.

Testing

Automated tests added or updated: writer slow-warning and close tests, alias and migration selective-save tests, renderer notice tests (unit and Sonner), startup save-delay and quit tests, and an Electron e2e spec. Local runs are not confirmed yet.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

Platforms actually tested: TODO

AI Disclosure

TODO

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance. TODO: confirm each.

This is a partial fix. It removes the false failure for slow saves, but a save that never completes now warns indefinitely instead of failing. No issue is linked, so nothing is closed automatically.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ea4cd360-4821-4115-bc65-5e2eaaaaced8
📥 Commits

Reviewing files that changed from the base of the PR and between a2b3d02 and 2e3a479.

📒 Files selected for processing (15)
  • src/main/persistence/profile-state/profile-state-writer-close.test.ts
  • src/main/persistence/profile-state/profile-state-writer-deadline.test.ts
  • src/main/persistence/profile-state/profile-state-writer-deadline.ts
  • src/main/persistence/profile-state/profile-state-writer-electron-fixture.ts
  • src/renderer/src/app-shell/use-app-shell-services.ts
  • src/renderer/src/app-shell/use-profile-state-save-delay-notice.sonner.test.tsx
  • src/renderer/src/app-shell/use-profile-state-save-delay-notice.test.tsx
  • src/renderer/src/app-shell/use-profile-state-save-delay-notice.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • tests/e2e/profile-state-save-delay.spec.ts
💤 Files with no reviewable changes (2)
  • src/main/persistence/profile-state/profile-state-writer-deadline.test.ts
  • src/main/persistence/profile-state/profile-state-writer-deadline.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/i18n/locales/fr.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/es.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The profile-state writer now treats slow requests and worker-exit waits as warnings rather than request deadlines. Main-process and renderer APIs report delayed-save status, and the app shell displays a localized warning. Persistence listeners now select pane-alias and migration domains for scoped saves. Tests cover writer stalls, shutdown waits, delay notices, and selective persistence.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 2e3a4

Slow saves now warn while the write continues, and the warning clears when the save completes or fails. No actionable merge-blocking risk was identified.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, solution, mechanism, and automated testing, but required information is incomplete. No issue is linked, visual proof remains TODO, platform testing is unspecified… Link the applicable issue after Fixes #. Attach before-and-after visual proof, or write N/A with a reason if there is no visual change. Complete the AI Disclosure section, specify tested platforms, confirm cross-platform and compatibili…
Docstring Coverage ⚠️ Warning Docstring coverage is 28.95% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 38 functions across 36 files. (6 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: slow profile saves now produce warnings instead of failures.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, solution, mechanism, and automated testing, but required information is incomplete. No issue is linked, visual proof remains TODO, platform testing is unspecified, AI disclosure is incomplete, and required checklist items and validation results are not confirmed.

Resolution

Link the applicable issue after Fixes #. Attach before-and-after visual proof, or write N/A with a reason if there is no visual change. Complete the AI Disclosure section, specify tested platforms, confirm cross-platform and compatibility review, and report the status of lint, typecheck, test, and build checks. Check the applicable checklist items after verification.

Full details: Docstring Coverage

Explanation

Docstring coverage is 28.95% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 38 functions across 36 files. (6 skipped: 6 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@AmethystLiang
AmethystLiang force-pushed the profile-saving-followup-design-astra branch from 8a0ebca to a2b3d02 Compare October 8, 2026 06:11
Profile-state writes used to fault after 30 seconds. A stalled main loop or a slow disk could then drop the writer and show a "could not confirm your save" dialog, even when the write was still in progress. Slow requests now record a diagnostic breadcrumb and keep waiting for the worker's reply. Close waits for the worker to actually exit, and a termination request alone no longer counts as proof.

Pane-alias and migration-listener changes now save only their own sections, not a full state rebuild. Quit teardown also keeps the profile admission held until the final flush finishes, so a pending write is no longer released early at the deadline.
Slow profile-state writes used to leave only a diagnostic log entry, so users had no way to tell that recent changes were not yet confirmed saved. The writer now reports when a save write passes the slow-warning threshold and reports recovery when the reply arrives. Writes are never failed or retried because of the delay.

- Main keeps the current delayed/healthy status and publishes changes to the renderer, so a reopened window gets the correct state.
- The renderer shows one persistent warning toast while a save is delayed and dismisses it on recovery.
- Observer errors are logged and do not interrupt saving.
- The web build reports saving as healthy because it does not use the desktop profile writer.
The save-delay warning used one fixed toast ID. Sonner applies a dismissal
a frame late, so a dismissal could remove a warning that had just been
shown again with the same ID. The hook now tracks the ID of each delayed-save
warning it shows and dismisses only that toast. A new delay gets a fresh ID.

Add Sonner-level tests for remount, StrictMode cleanup, and recover-then-
delay races. Harden the e2e spec with a paused clock and a retry around
main-process evaluate.
Revision checks and JSON exports run on the same profile-state worker as
saves, so a slow one holds up later writes just like a slow write does.
The save-delay warning only tracked write-* commands, so those stalls
went unreported. Every command except initialize and close now raises
the warning.

Tests cover the export-latest path and assert the delay signal fires
once with true before clearing.
The delayed-save warning said recent changes were not yet confirmed saved, which overstated the risk while Orca was still retrying. The real condition is a slow profile-state write, so the toast now names profile storage and says later saves may wait until that operation finishes. The copy is updated in every locale, and the unit and e2e tests that assert it are updated to match.
@AmethystLiang
AmethystLiang force-pushed the profile-saving-followup-design-astra branch from a2b3d02 to 2e3a479 Compare October 8, 2026 07:44
@AmethystLiang
AmethystLiang merged commit d997ef0 into main Oct 8, 2026
55 checks passed
brennanb2025 added a commit that referenced this pull request Oct 8, 2026
#26447 pushed src/main/ipc/app.ts one line over the 300-line limit, so main's
oxlint is red and merges from main fail the commit hook. Move the keyboard
input-source probe and its bounded command runner, unchanged, into
macos-keyboard-input-source.ts beside the other macOS keyboard probes.
Fanzzzd added a commit to Fanzzzd/orca that referenced this pull request Oct 9, 2026
Picks up upstream's profile-state writer fixes (stablyai#25318, stablyai#26444, stablyai#26447).
Brings the offscreen-page file drop, iroh SAFETY/device-grant cleanups and
extension e2e typing in line with their current PR branches.

Claude-Session: https://claude.ai/code/session_01DvNJ16LEPYmdEkpQWtDL7n
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.

1 participant