Fix lsof path resolution and support server_port fallback#134
Conversation
…iscovery - Scans standard paths (/usr/sbin/lsof, /usr/bin/lsof, /bin/lsof, /sbin/lsof) first and falls back to plain 'lsof' to resolve Ubuntu-specific path issues. - Appends the configured server_port (preferredPort) to the scanned ports array in discoverOpencodeServer, ensuring the port is checked even if lsof fails to detect it due to user permission or context restrictions. Co-authored-by: athal7 <467872+athal7@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
📝 WalkthroughWalkthroughPort discovery now resolves ChangesPort discovery resilience
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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 `@service/actions.js`:
- Around line 196-202: Update the lsof candidate selection loop to validate each
path with executable permissions, using accessSync and X_OK alongside existsSync
or an equivalent executable check. Only assign and break on a runnable
candidate; otherwise continue through lsofPaths so the existing default lsof
PATH fallback remains available.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c8b5f5ec-fb38-429b-8477-5bf721b6020f
📒 Files selected for processing (2)
service/actions.jstest/unit/actions.test.js
| let lsofBin = 'lsof'; | ||
| for (const p of lsofPaths) { | ||
| if (existsSync(p)) { | ||
| lsofBin = p; | ||
| break; | ||
| } | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Check that the selected lsof path is executable.
existsSync() can pick a directory or non-executable file, and execSync() will then fail without trying the remaining candidates or the PATH fallback. Use accessSync(path, X_OK) or keep iterating until one candidate can actually run.
🤖 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 `@service/actions.js` around lines 196 - 202, Update the lsof candidate
selection loop to validate each path with executable permissions, using
accessSync and X_OK alongside existsSync or an equivalent executable check. Only
assign and break on a runnable candidate; otherwise continue through lsofPaths
so the existing default lsof PATH fallback remains available.
|
@jules can you address the outstanding review comment from CodeRabbit above — the executable-check issue at service/actions.js:202 (use accessSync with X_OK instead of existsSync)? |
…iscovery - Scans standard paths (/usr/sbin/lsof, /usr/bin/lsof, /bin/lsof, /sbin/lsof) first and falls back to plain 'lsof' to resolve Ubuntu-specific path issues. - Appends the configured server_port (preferredPort) to the scanned ports array in discoverOpencodeServer, ensuring the port is checked even if lsof fails to detect it due to user permission or context restrictions. Co-authored-by: athal7 <467872+athal7@users.noreply.github.com>
Dynamically resolves the lsof path on linux and supports fallback to preferredPort when lsof checks cannot find the running opencode server.
Fixes #117
PR created automatically by Jules for task 3601355634390134876 started by @athal7
Summary by CodeRabbit
Bug Fixes
Tests