Skip to content

fix(app): find the Mac plugin under its old id and stop waiting after two minutes - #1832

Merged
devswha merged 3 commits into
mainfrom
fix/mac-app-old-plugin-id
Oct 24, 2026
Merged

devswha merged 3 commits into
mainfrom
fix/mac-app-old-plugin-id

Conversation

@devswha

@devswha devswha commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

Ovis for Mac stays on "Starting herdr…" forever after a successful install.

Cause. The latest release, v0.4.13, installs the herdr plugin under its old id, devswha.herdr-web-ui (install.sh keeps that id for 0.4.13 and older on purpose). The app only looks for devswha.ovis, so after install.sh finishes it polls herdr plugin list for two minutes, never finds the plugin, and then drops back to the Install screen, even though the server answers on 7317. The maintainer hit this on his MacBook Pro with the published, notarized Ovis.dmg, and it reproduces on the test MacBook Air (eamac).

Fix.

  • The app finds the plugin under either id and runs its actions (stop, start, uninstall) under the id it found.
  • waitUntilRunning ends in a clear failure instead of falling silently back to Install: "herdr does not list the Ovis plugin" or "The Ovis server did not start within two minutes", with the tail of ~/Library/Logs/Ovis/herdr-server.log, and the Try again / Copy the log / Get help buttons.

Checked on eamac (macOS 27.0.1), real home, herdr already running:

  • Published dmg: Safari download (quarantined), Gatekeeper shows only "Apple checked it for malicious software and none was detected", Install → install.sh succeeds (plugin devswha.herdr-web-ui 0.4.13, tailscale serve on 443) → the app sits on "herdr를 시작하는 중…" from 20:04:27 on.
  • This branch built on eamac, opened on the same state: "이 Mac에서 실행 중", the QR code and https://ea-macbookair.example.ts.net at once.
  • The timeout: a failing Restart (a separate bug, its own PR) now ends after two minutes in "Ovis 서버가 2분 안에 시작되지 않았습니다…" with the buttons, not a spinner.

The app has no Swift tests; swift build passes on eamac and bun run check fast passes.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto incremental 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

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
📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Ovis for Mac now recognizes older plugin installations and displays their status and QR code.
    • “Try again” repeats the step that failed, whether installation or restart.
    • Startup checks can take up to two minutes and provide a clearer error if the server does not start, including recent log details when available.

The Mac app detects current and legacy plugin IDs and uses the discovered ID for plugin commands. It adds command timeouts and waits up to 120 seconds for the server after restart. The retry action repeats the failed install or restart step.

Changes: Mac plugin detection and recovery

Layer / File(s) Summary
Plugin identity and discovery
app/mac/Sources/OvisMac/Run.swift, app/mac/Sources/OvisMac/Model.swift
The app checks the current plugin ID and then the legacy ID. It stores the discovered ID and root, then reads status from that root.
Plugin commands and server startup
app/mac/Sources/OvisMac/Model.swift, app/mac/Sources/OvisMac/Run.swift, changelog.d/mac-app-old-plugin-id.md
Restart and uninstall use the discovered plugin ID. Commands support timeouts. After restart, the app polls for up to 120 seconds and reports whether the plugin is missing or the server did not start.
Retry the failed step
app/mac/Sources/OvisMac/Model.swift, app/mac/Sources/OvisMac/OvisMacApp.swift
The retry method runs restart when retrying a restart failure and install otherwise. The failed-state button calls this method.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related PRs

  • devswha/ovis#1691: Changes installer plugin-ID selection, which is related to the Mac app’s current and legacy plugin-ID discovery.
Merge Risk: Minimal · up to 2ed5e

The Mac app now finds the plugin under either ID, shows a visible failure with log details when the server does not start, and retries the failed step. No concrete merge-blocking defect was established. Hardening the timeout to force-kill hung processes is optional follow-up.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 3 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly describes the two main changes: detecting the Mac plugin under its legacy ID and limiting startup waits to two minutes.
Description check Passed The description explains the problem, cause, resulting behavior, implementation, failure messages, validation scenarios, and check results. It includes the required Change and Validation content.
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.
Full details: Docstring Coverage

Explanation

Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 3 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge pass review-work for a31aa30: REVIEW FAILED on one small mismatch between the description and the code. The fix itself is right.

Blocker: the missing-plugin failure doesn't show the log tail the description promises.

  • The description and changelog say both new failures come with the tail of ~/Library/Logs/Ovis/herdr-server.log, but Model.swift:197-204 attaches it in only one of them. When herdr doesn't list the plugin, fail() gets no detail. Only the "did not start within two minutes" branch reads the log. So when no plugin is listed, the existing startup diagnostics are neither shown nor copied.
  • Either pass the available log tail to both branches, or reword the description and changelog so the tail is promised only when the plugin is listed but the server didn't start. Either way is a small change.

Checked and passing:

  • eamac build: swift build passes at a31aa30 on macOS 27.0.1 with Swift 6.4, in a fresh /tmp clone that was deleted afterwards.
  • Plugin lookup: findPlugin tries devswha.ovis first, then devswha.herdr-web-ui, and stop, start and uninstall run under the id it found. A plugin under the new id behaves as before.
  • waitUntilRunning: it has a 120 s deadline and refreshes inside itself on success, so dropping the extra refresh() after it in install and restart is safe. On failure it ends in fail() with the Try again / Copy the log / Get help buttons, not the Install screen. Both the English and Korean strings are present.
  • Traced cases: only the old id, both ids, neither id, herdr stopped, the plugin appearing late, the log file missing, and restart or uninstall under the old id.

Not verified here: the full install-to-QR flow from the published dmg. That rests on the author's eamac run.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Pushed 2ed5ef9 for the merge pass review and the agent reviews:

  • Merge pass blocker (log tail on only one failure): both failures now attach the last ten lines of ~/Library/Logs/Ovis/herdr-server.log (Model.swift, waitUntilRunning).
  • Codex (MEDIUM): the deadline could not interrupt a hung check. run() takes a timeout and terminates a program still running after it; herdr plugin list, plugin.ts status and herdr status server now get 10 s. Checked on eamac with a fake bun whose status never returns: the window showed "Not running" after 10 s at launch, and after Start the failure message came at about 2 min 20 s instead of a spinner forever.
  • omo-native-code-reviewer (APPROVE, MEDIUM): Try again after a failed Restart reran the whole installer. It now repeats the step that failed (retry()). Checked on eamac: after the two-minute failure, Try again went to "Restarting…", not "Downloading the installer…".
  • Reviewer LOWs not taken: the extra checks after success and after the deadline cost one or two quick CLI calls.

swift build (arm64 and x86_64) passes on eamac at this commit. bun run check fast passed on Linux at a31aa30; this commit touches only app/mac/ Swift and the changelog fragment (scripts/changelog-fold.test.ts 12/12).

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

bun run check fast passes at 2ed5ef9 on Linux (typecheck, build, unit tests).

@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.

🔇 Additional comments: 2
app/mac/Sources/OvisMac/Model.swift-87-87: 1

87-87: Major · Stability & Availability · Quick win

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Bound both plugin actions before the startup wait.

If either stop or start hangs, restart() remains inside run() and never reaches waitUntilRunning(). The screen stays on “Restarting…” without reaching the new failure state or Try again button. Give both actions a suitable timeout and handle a timed-out result.

Also applies to: 91-91

app/mac/Sources/OvisMac/Run.swift-120-123: 1

120-123: Major · Stability & Availability · Heavy lift

⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Make the timeout finish when a process ignores SIGTERM.

If a timed herdr or bun check ignores SIGTERM, process.terminate() does not end it. The termination handler then cannot resume run(), so the app can remain on a checking or restarting screen indefinitely. Add a bounded grace period and force termination if the process remains running. Apple documents that terminate() sends SIGTERM and may not stop a process that ignores it. (developer.apple.com)


Review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 055e820 and 2ed5ef9.

Files selected for processing: 4
  • app/mac/Sources/OvisMac/Model.swift
  • app/mac/Sources/OvisMac/OvisMacApp.swift
  • app/mac/Sources/OvisMac/Run.swift
  • changelog.d/mac-app-old-plugin-id.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Pushed 91db4c4 for CodeRabbit's two additional comments:

  • Bound both plugin actions (Model.swift:87, 91): the stop and start invocations in restart() now run with a 30 s timeout; a timed-out one ends with a non-zero status, so the screen shows "Could not stop/start the Ovis server" with Try again instead of "Restarting…" for good.
  • A process that ignores SIGTERM (Run.swift:120-123): run() now sends SIGKILL 5 s after terminate() if the program is still running. Checked on eamac with a fake bun that traps TERM and loops: the launch-time status check ended at about 15 s and the window showed "Not running".

swift build (arm64 and x86_64) passes on eamac and bun run check fast passes at this commit.

@devswha

devswha commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

Merge-pass review-work report. Overall: PASSED.

Lane Verdict Confidence
Manual QA (rows 1-4, 1r, 3r; artifacts kept) PASS at 91db4c4 -
Gate round 1 (a31aa30) REJECT: the missing-plugin failure had no log tail HIGH
Gate round 2 (2ed5ef9, fresh reviewer) APPROVE MEDIUM
Gate round 3 (91db4c4: SIGKILL 5 s after SIGTERM, 30 s on the restart actions) APPROVE MEDIUM

Build: swift build passes on eamac (macOS 27.0.1, Swift 6.4) at a31aa30, 2ed5ef9 and 91db4c4. Each build used a fresh /tmp clone, deleted afterwards.

Behaviour checked:

  • Plugin id: findPlugin tries devswha.ovis first, then devswha.herdr-web-ui. Stop, start and uninstall run under the id it found, and a plugin under the new id behaves as before.
  • Waiting for the server: waitUntilRunning has a 120 s deadline and refreshes on success. Both failures now carry the server-log tail, which was round 1's finding.
  • Try again repeats a failed Restart (including a failed stop/start action) and otherwise reinstalls. Uninstall never reaches the failure screen.
  • Process handling: each run() gets its own Process, and the timeout timer can't resume the continuation twice.

Follow-ups (MINOR):

  • A check still running 5 s after SIGTERM now gets SIGKILL. The isRunning check and kill(pid) aren't atomic, so a reused pid is theoretically possible; none was reproduced (Run.swift:127).
  • The 30 s limits bound the herdr CLI calls, not the plugin's own stop or start, which herdr runs in its server. A timed-out call shows the usual bilingual failure with Try again.
  • A healthy herdr plugin list that takes more than 10 s would read as "not installed".

Not verified here: the native install-to-QR flow, timeout and retry. The author reports running them on eamac.

All required checks are green, and no review thread is open.

CodeRabbit did not review this PR (rate-limited or skipped). The reviews above stand in for it.

@devswha
devswha merged commit 6a2f274 into main Oct 24, 2026
9 checks passed
@devswha
devswha deleted the fix/mac-app-old-plugin-id branch October 24, 2026 13:59
devswha added a commit that referenced this pull request Oct 24, 2026
…emove (#1877)

Restart in Ovis for Mac stops the Ovis server and leaves it stopped.

**Cause.** `restart()` ran `herdr plugin action invoke <id>.stop` and
then `<id>.start`. That command only queues the action, so the start ran
while the old server was still up and failed with "the server stopped
(exit 1) before it answered /api/health", and then the stop finished.
Reproduced on the test MacBook Air (eamac) with the app from #1832:
herdr's plugin log showed the start failing before the stop finished,
and `/api/access` stayed unanswered. Start, from "Not running", goes
through the same path.

**Fix.**
- Restart and Start run `bun <plugin root>/scripts/plugin.ts stop` and
then `start`, waiting for each (60 s each, with `LC_CTYPE=UTF-8` as the
login item gives herdr), instead of queueing herdr actions.
- Remove waits for the same stop before `herdr plugin uninstall` removes
the plugin's files.

**Checked on eamac (macOS 27.0.1), real home, plugin under the old id,
herdr running:**
- Restart: the server pid changed (46160 → 69037), `/api/access`
answered 200 within 3 s, and the window stayed on "Running on this Mac"
with the QR code.
- Start from "Not running": running with the QR code in under 7 s.
- Remove (then confirm): the server stopped, the plugin and `tailscale
serve` were removed, the login item was deleted, and herdr kept running.
Install afterwards brought it back, with the QR code in 21 s.

Reviewed by omo-native-code-reviewer (APPROVE; its LOW points on the
locale and the comment are applied, and the same race in Remove is fixed
here). The app has no Swift tests; `swift build` (arm64 and x86_64)
passes on eamac and `bun run check fast` passes.

Co-authored-by: mp <mp@local>
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