Skip to content

fix(ui): retry lifecycle lock cleanup - #562

Open
GhostXia wants to merge 3 commits into
mainfrom
fix/issue-478-cleanup-retry
Open

fix(ui): retry lifecycle lock cleanup#562
GhostXia wants to merge 3 commits into
mainfrom
fix/issue-478-cleanup-retry

Conversation

@GhostXia

@GhostXia GhostXia commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implement bounded retries when lifecycle cleanup encounters transient WouldBlock lock contention.
  • Add a deterministic cross-process regression test for contention recovery.
  • Preserve owner checks and inode-safe cleanup behavior.

Root cause

remove_lock_if_owned returned immediately on WouldBlock, so a short-lived shutdown race could leave the current instance's lock record uncleared.

Validation

  • TAURI_CONFIG='{"bundle":{"externalBin":[]}}' cargo test -p airp-ui lifecycle::tests:: --locked — 18 passed
  • cargo fmt --all -- --check
  • git diff --check
  • Terra independent audit passed

Related to #478.

Summary by CodeRabbit

  • Bug Fixes
    • Improved lifecycle cleanup reliability when temporary lock contention occurs.
    • Cleanup now retries briefly before reporting failure, while preserving existing error handling.
    • Added coverage to verify records are removed after contention clears.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@GhostXia, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 36 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 24533c91-1716-4615-b946-40ee859fd15c

📥 Commits

Reviewing files that changed from the base of the PR and between 052f03d and fab6634.

📒 Files selected for processing (1)
  • docs/audits/2026-08-12-PR-562-lifecycle-cleanup-reaudit.md

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f9884b4c-e95c-4d8b-9c9c-fcaec5283297

📥 Commits

Reviewing files that changed from the base of the PR and between 35ea2c7 and 052f03d.

📒 Files selected for processing (1)
  • ui/src-tauri/src/lifecycle.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • ui/src-tauri/src/lifecycle.rs

📝 Walkthrough

Walkthrough

Lifecycle lock cleanup now retries temporary lock contention up to five times with 10 ms delays. A subprocess test verifies cleanup succeeds after the lock becomes available.

Changes

Lifecycle lock cleanup

Layer / File(s) Summary
Retrying lock cleanup
ui/src-tauri/src/lifecycle.rs
remove_lock_if_owned delegates to a bounded retry implementation. The helper handles WouldBlock, missing paths, and other lock acquisition errors.
Contention cleanup test
ui/src-tauri/src/lifecycle.rs
A subprocess test verifies that cleanup observes contention, retries after lock release, exits successfully, and removes the owned record.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: retrying lifecycle lock cleanup.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-478-cleanup-retry

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.

@GhostXia
GhostXia marked this pull request as ready for review August 12, 2026 00:59

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ui/src-tauri/src/lifecycle.rs`:
- Around line 617-625: Update the callback passed to
remove_lock_if_owned_with_retry to write the release signal and wait for child
termination there, storing the resulting exit status for reuse. After the helper
returns, assert the stored status instead of waiting on child again, while
preserving the saw_contention assertion.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 437bc051-33da-462a-8de7-66cf89bd1308

📥 Commits

Reviewing files that changed from the base of the PR and between 7a90d88 and 35ea2c7.

📒 Files selected for processing (1)
  • ui/src-tauri/src/lifecycle.rs

Comment thread ui/src-tauri/src/lifecycle.rs Outdated
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