Skip to content

Run system file and browser opening asynchronously#475

Merged
DropSnorz merged 1 commit into
masterfrom
ci/async-xdg-open
May 20, 2026
Merged

Run system file and browser opening asynchronously#475
DropSnorz merged 1 commit into
masterfrom
ci/async-xdg-open

Conversation

@DropSnorz
Copy link
Copy Markdown
Owner

No description provided.

@DropSnorz DropSnorz self-assigned this May 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Review Change Stack

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8e8cce14-387d-4cbe-b0c3-916d7439f995

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

PlatformUtils refactors file and URL opening to execute asynchronously via Async.run, adding Desktop capability checks and platform-specific fallback logic. openFromDesktop guards against unsupported Desktop and logs warnings; openDefaultBrowser falls back to xdg-open with a 5-second timeout and explicit exception handling.

Changes

Async file and URL opening

Layer / File(s) Summary
Async file and URL opening with capability checks and fallbacks
owlplug-client/src/main/java/com/owlplug/core/utils/PlatformUtils.java
openFromDesktop(File) and openDefaultBrowser(String) now execute asynchronously via Async.run with added Desktop.isDesktopSupported() checks. openFromDesktop logs a warning and returns when Desktop is unsupported. openDefaultBrowser falls back to xdg-open with a 5-second timeout when Desktop browsing is unavailable, forcibly destroys the process on timeout, logs exit codes, and handles InterruptedException explicitly. TimeUnit import is added for time-bounded process waiting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: moving file and browser opening operations to run asynchronously instead of on the caller thread.
Description check ✅ Passed No pull request description was provided by the author; however, the title itself adequately conveys the change objective and relates to the changeset.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/async-xdg-open

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 and usage tips.

@DropSnorz DropSnorz added this to the 1.33.0 milestone May 20, 2026
@DropSnorz
Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
owlplug-client/src/main/java/com/owlplug/core/utils/PlatformUtils.java (1)

80-81: ⚡ Quick win

Restore interrupt flag after catching InterruptedException.

When an InterruptedException is caught, the thread's interrupt flag is cleared. Best practice is to restore it so the thread pool can respond to shutdown signals properly.

Proposed fix
       } catch (InterruptedException e) {
+        Thread.currentThread().interrupt();
         log.error("Thread interrupted while waiting for xdg-open to finish", e);
       }
🤖 Prompt for 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.

In `@owlplug-client/src/main/java/com/owlplug/core/utils/PlatformUtils.java`
around lines 80 - 81, The catch block in PlatformUtils that logs "Thread
interrupted while waiting for xdg-open to finish" should restore the thread's
interrupt status after logging; update the InterruptedException handler in the
method that calls xdg-open (within class PlatformUtils) to call
Thread.currentThread().interrupt() immediately after log.error(...) so the
interrupt flag is preserved for higher-level shutdown/cleanup logic.
🤖 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 `@owlplug-client/src/main/java/com/owlplug/core/utils/PlatformUtils.java`:
- Around line 48-53: In PlatformUtils.openFile(File file) the code checks
Desktop.isDesktopSupported() but not Desktop.isSupported(Action.OPEN), which can
lead to UnsupportedOperationException when calling
Desktop.getDesktop().open(file); update the method to first check
Desktop.isSupported(Desktop.Action.OPEN) (in addition to
Desktop.isDesktopSupported()) and log+return if not supported, or alternatively
catch UnsupportedOperationException around Desktop.getDesktop().open(file) and
log a warning including file.getAbsolutePath(); reference the PlatformUtils
class and the openFile method to locate and apply this change.

---

Nitpick comments:
In `@owlplug-client/src/main/java/com/owlplug/core/utils/PlatformUtils.java`:
- Around line 80-81: The catch block in PlatformUtils that logs "Thread
interrupted while waiting for xdg-open to finish" should restore the thread's
interrupt status after logging; update the InterruptedException handler in the
method that calls xdg-open (within class PlatformUtils) to call
Thread.currentThread().interrupt() immediately after log.error(...) so the
interrupt flag is preserved for higher-level shutdown/cleanup logic.
🪄 Autofix (Beta)

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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 29251224-68a1-47b8-af7f-eb8d79e7140c

📥 Commits

Reviewing files that changed from the base of the PR and between e834389 and c599ccd.

📒 Files selected for processing (1)
  • owlplug-client/src/main/java/com/owlplug/core/utils/PlatformUtils.java

Comment thread owlplug-client/src/main/java/com/owlplug/core/utils/PlatformUtils.java Outdated
@DropSnorz DropSnorz force-pushed the ci/async-xdg-open branch from c599ccd to 633505d Compare May 20, 2026 17:57
@DropSnorz DropSnorz merged commit 1096c44 into master May 20, 2026
18 checks passed
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