Skip to content

Fix keybindings pending-save success path races - #20

Merged
ElSargo merged 1 commit into
mainfrom
fix/keybindings-pending-save-reliability
Sep 16, 2026
Merged

ElSargo merged 1 commit into
mainfrom
fix/keybindings-pending-save-reliability

Conversation

@ElSargo

@ElSargo ElSargo commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Critical: handle_saved success path no longer closes the editor / clears status / reopens the action picker when pending_save is missing or action-mismatched. Both success and failure require a matched pending action; mismatched replies leave pending_save intact for the real reply.
  • Reject late picker-created after close/cancel (picker_requested == false) by sending picker-cancel instead of resurrecting the modal.
  • Guard Show against overlapping capture / in-flight save.
  • Unit tests for matched success, unmatched/stale success no-op, cancelled/missing pending, failure restore, and late picker create.
  • Update docs/frictions/ui-concurrency.md to mark the remitted keybinding races.

Test plan

  • cd plugins/keybindings && RUSTFLAGS='-C linker=cc' cargo test — 12 passed (mold unavailable on the test host; linker overridden via env only, config unchanged)
  • Manual: open keybindings → capture chord → close/cancel before save reply → confirm UI does not reopen picker on late success
  • Manual: start save, receive mismatched/stale keybinding-saved → editor stays in saving state until matching reply

@ElSargo ElSargo left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Brood QA — COMMENT (approve intent)

Note: gh is authenticated as ElSargo (PR author), so GitHub blocks a formal APPROVE on own PRs. Treat this as an approve recommendation.

What this does

Closes audit C3 / friction “Keybinding save replies survive cancellation”:

  • handle_saved now requires a matched pending_save before success or failure mutates UI; missing → no-op; mismatched action leaves pending intact for the real reply.
  • Late picker-created after close/cancel (!picker_requested) sends picker-cancel instead of resurrecting the modal.
  • Show also skips opening while pending_save / capture is set.
  • Friction doc marked remitted (with honest note that attempt-id correlation is still future work).

Evidence

  • CI: Fail is infra — runner No space left on device while unpacking rustc (job 104941764001). Not a code/test signal from this diff.
  • Local: RUSTFLAGS='-C linker=cc' cargo test in plugins/keybindings → 12 passed (includes the five new race tests).
  • Diff is tightly scoped (keybindings plugin + friction note). Residual same-action overlapping-save correlation is documented and acceptable for this remit.

Nits (non-blocking)

  • No dedicated unit test for the new Show pending/capture guard.
  • Manual desktop smoke in the PR checklist is still open; unit coverage of the cancel/stale paths is strong enough not to block.

Verdict

Approve (via comment). Optional light desktop check (capture → cancel before reply; confirm no picker reopen) can follow post-merge or before if convenient. Re-run CI when the runner has disk space if a green check is required by policy.

@ElSargo ElSargo left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Brood QA review

Checked: gh pr diff / gh pr view; CI run 35139971303; audit C3 in /workspace/manifold-audit-report.md; friction entry in docs/frictions/ui-concurrency.md (updated in-PR).

Code: Matches the intended C3 fix. handle_saved now requires a matched pending_save before success or failure UI mutation; mismatched replies leave pending intact. Late picker-created after cancel (picker_requested == false) sends picker-cancel. Unit tests cover matched success, unmatched/stale success, cancelled pending, failure restore, late picker create. Show also guards overlapping capture / in-flight save.

CI: FAILURE — GitHub Actions Nix build hit ENOSPC (No space left on device) while unpacking toolchain deps. Not a signal on this diff; infra disk pressure on the runner. Author reports local plugins/keybindings tests green (12).

Race-doc: Keybinding save + keybinding late-picker hole remitted correctly; residual noted (action-name correlation, not unique save-attempt id; session-switcher discovery pickers still open).

Desktop verify: Blocked — no nix in QA box PATH; cannot nix develop build client here. DISPLAY present but no Wayland client build path.

Residual / merge: Wait for CI re-run after runner disk relief. Likely doc conflict with other ui-concurrency.md remittance PRs (21/22/29/32). Do not merge on red CI.

— Brood QA

Require a matched pending_save before handle_saved mutates UI on success or
failure, reject stale picker-created after cancel, and cover save/cancel overlap
with unit tests.
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