Fix the review findings in the native GPUI app
Summary
Context: PR #8219 landed the native GPUI app on main. A read-only GPT review then split the code into seven areas and reported about 87 distinct defects, 28 of them high severity:
- crashes and lost edits;
- the app lock failing open;
- shares left live after a note is deleted;
- audio kept against the retention setting;
- editors failing to open after about 64 notes in a session;
- folder sharing that leaked other folders' notes.
Intention: Fix every finding that holds up, so the native app is safe to keep testing on every platform, and record what remains.
Direction: Each finding was re-verified against the code and the shipping app before it was fixed, at its root cause, usually with one regression test. Commits are grouped by area: shell and runtime, editor, workspace views, chat and dictation, cloud and sharing, meetings and local settings.
- Not a bug: scheduled start reports "started" before capture confirms, exactly as shipping does.
- Deferred:
- Folder default-access rules and Slack recaps need backend-dependent ports, so their entry points are hidden rather than half-wired.
- Choosing the summary language from a transcript's dominant language needs a new dependency.
- The storage-move pause still lacks a write barrier inside the runtime; the remaining unaudited writers are listed in the shell commit.
- Found during the fixes:
- The screens harness clicked the app's real chat voice input and opened the Mac's microphone. It now removes that service before its stand-in.
- Notes created natively had no workspace or owner, so CloudSync never uploaded them; they now join the synced library like shipping's
insert_session.
Bot review rounds: Devin Review and CodeRabbit on this PR raised about 30 more findings over four rounds, mostly races and edge cases in the earlier fixes. The real ones are fixed, each with a regression test that fails without its fix, unless noted otherwise:
- Locks and editing:
- A failed lock watch no longer opens locked notes.
- Transcript reverts made during a save persist.
- A deletion holds every note in it read-only, counted per note (
NoteHolds) so overlapping deletions don't release each other.
- Quit and runtime:
- Automation runs that finish during quit are recorded, through a drain-safe
Services::submit. - Quit awaits every save it started, including template saves already in flight.
- Dropping the last
RuntimeHandleshuts the runtime down.
- Automation runs that finish during quit are recorded, through a drain-safe
- Files and recordings:
- Folder moves read their rules before touching files.
- Unreadable recovery audio keeps its marker.
- Stop cleans up a failed finish.
- Meeting audio is released only once every channel has finalized it.
- Sharing and cloud:
- Conflicted shares can still open the web copy and narrow access.
- Publishing retries a failed snapshot, then the latest draft.
- Cloud API read failures retry.
- A deleted note's share is revoked by session even without this device's publication journal (best effort).
- A sent recap isn't reported as failed when only the refresh after it fails.
- Editor:
- Code-block pastes are prepared off the UI thread and rejected if the document changed meanwhile.
- After a date change, the title stays in step with renames from other windows.
Deferred follow-ups, not in this PR:
- Sharing: revoking a deleted note's share that was published into a workspace other than its routed one. This needs a server-side lookup across workspaces; shipping has the same limit.
- Tests that need setup this PR doesn't have:
- the batch-only Soniqo model (needs a downloaded native model);
- the Cloud API read-retry observer (needs the loop extracted).
- Minor data races CodeRabbit rated a heavy lift:
- waiting for an in-flight or summary-triggered title save before deleting;
- the template flush sharing an in-flight save when the queue is full;
- a streaming brief can write into a held memo.
- Broader runtime work:
- moving other service jobs (webhooks, summaries, chat) to
Services::submit; - the watch-then-read retry gaps in scheduled auto-start and contacts;
- a runtime write barrier for storage moves;
- the
apply_stored_preferencesstartup race.
- moving other service jobs (webhooks, summaries, chat) to
CI fixes in this PR:
- Chat history with equal timestamps keeps insertion order. A fast reply could load before its question, which failed in CI.
- GPUI CI saves its cargo cache only from main.
The shipping-app half of the folder leak is #8228. Windows and Linux platform fixes come separately from the Devin sessions (#8222–#8226).
Demo
N/A: behaviour fixes covered by headless tests; the screens harness captures were reviewed where UI changed.
Verification
Each area was gated on macOS before its commits, from git archive exports: cargo fmt --check, cargo test --locked --workspace, cargo clippy --locked --workspace --all-targets --no-deps -- -D warnings and cargo build --locked. Where a test can run against the old code, it was confirmed to fail there and pass with the fix.
The final branch (75 commits on 9c1cbe2870) was gated from a fresh export:
- macOS:
cargo fmt --checkpasses.cargo test --locked --workspacepasses: library 534, 2 ignored; accessibility 15; runtime 10, 15 and 10; dictation capture 1.- Clippy with
-D warningsandcargo build --lockedboth pass. - The screens harness finishes with no panics: 299 captures, with the microphone guard in place.
- Linux, Ubuntu 24.04 container (arm64): clippy passes, and every suite passes (library 533, accessibility 15).
- Hangs and flakes fixed:
- Tests no longer block the GPUI thread on runtime shutdown. Under load that deadlocked a delete test; a stack sample showed it parked with the runtime idle.
- Flaky reads now wait for the runtime's results.
Not verified:
- Live backend endpoints, such as recap email, device sealing, shared-note paging and forced renewal, were tested against local mock servers only.
- No real windows were opened, and real audio hardware was not used.
- Windows was not built here.
Summary by cubic
Fixes the native GPUI app's review findings: about 87 distinct defects from a read-only GPT review, 28 of them high severity, covering crashes and lost edits, the app lock failing open, shares left live after deletion, audio kept against retention settings, editors failing after ~64 opened notes, and folder sharing leaking other folders' notes.
Fixed by area
- Runtime and shell: shutdown participants pruned so editors keep opening past 64 per session; the lock waits for the runtime and keeps locked notes hidden when its watch errors instead of falling back to off; native events like Quit handled before services are ready; quits wait for every save they started, drain without leaving edits unable to save, and automation runs finishing mid-quit still record; dropping the last runtime handle shuts it down, so a waiting service can't keep the profile locked.
- Editor: pastes into code blocks keep every copied block, with oversized ones normalized off the main thread and landed only in the document they started from; joins take code's schema; restore and templates replace whole documents; pasted tasks get new ids; transcript edits survive failed saves and window switches; a segment reverted while another edit saves lands after it; the note title follows the stored title after a date change reload, so another window's rename isn't overwritten by the stale input, and discarding a draft shows that rename.
- Chat and dictation: replies stream into their own buffers with their own cancellation; attachment drafts survive chat switches; timestamp-tied history keeps local send order; recordings owned per attempt so closing a window releases the microphone; dictation rechecks its run before inserting; model links open only web and mail targets.
- Cloud and sharing: new notes join the synced library so CloudSync uploads them; deleted notes' shared links are revoked, even when another device published the share; shared-note cache reconciles every 60 seconds so revoked access stops opening; workspace members can share their own notes; workspace key provisioning skips uninitialized members; a newer revision no longer gets overwritten by an in-flight upload and failed revision reads retry; a web-edit conflict still lets the web copy open and grants narrow, and a failed share publish retries with newer edits; a sent recap reports success even when the follow-up read-back fails.
- Meetings: "Don't save" audio is released once transcribed instead of surviving forever; retention sweeps apply one-day-to-one-month policies; the main transcription language stays first among additional ones; visible calendar ranges are synced; automatic stop is withdrawn when disabled; interrupted audio keeps its marker until transcribable, a failed Stop frees its note, and chunk release waits for every channel.
- Settings, folders and onboarding: profile and provider edits flush before closing; the template flush reports saves already in flight and a failed save never reverts a newer edit; folder rename and delete read their rules before the filesystem moves; a deletion holds every note in the batch read-only until it ends, clean notes and later-opened editors included; onboarding lists discovered calendars to enable; denied permissions open System Settings; contact edits survive CRM enrichment.
Deferred
Folder default-access rules and Slack recaps need backend ports, so their entry points are hidden. Choosing summary language from a dominant transcript language needs a new dependency. The storage-move pause still lacks a write barrier inside the runtime.