Skip to content

fix(install): tell git's answers for the installed commit apart, run the launcher without git, and the last refusal gaps - #3929

Merged
devswha merged 3 commits into
mainfrom
fix/install-git-answers-told-apart
Nov 15, 2026
Merged

devswha merged 3 commits into
mainfrom
fix/install-git-answers-told-apart

Conversation

@devswha

@devswha devswha commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #3928 (merged as 3cb83b5). It covers the points both reviews of #3928's last head left (the Codex review's MEDIUM, its table of states, the second reviewer's LOWs and the merge pass's list). It does not change when the installer builds, stops or refuses, except for point 1 (git failing: refused) and point 7 (the launcher without git). Point 1 includes one state that worked before and is now refused until fixed: a folder git does not trust on every call (owned by another account). The refusal names the command that fixes it (the second commit, below).

What changes

  1. The installers and the launcher tell three answers of git apart, by one rule (Codex MEDIUM). For the plugin's folder, git is asked rev-parse --show-prefix, untranslated (LC_ALL=C):

    • it succeeds and prints nothing: the checkout's top level, and rev-parse HEAD is its commit;
    • it succeeds and prints a path: a folder inside another repository, with no commit of its own;
    • it fails saying not a git repository: no checkout, no commit;
    • anything else (git's own error, a lock, a repository git does not trust, no git on PATH, or HEAD failing at the top level): git failed, and nothing is decided on it.

    Every reader of the installed commit applies it:

    reader what it decides git failed: before git failed: after
    install.ps1 ($installedCommit, now with $gitFailed) whether a finished build counts as this commit's; the ref check; the rerun line commit read as empty: any stamp starting with the version accepted (another commit's build started for that run) only a stamp that names no commit decides nothing (none: an older launcher's) counts; any other is refused, saying git's words, nothing stopped or changed; the rerun line says git failed
    install.sh ref_not_moved the line said on a rerun with OVIS_REF no commit, nothing said says git could not read the commit, with git's first line
    scripts/plugin-launch.ts checkoutCommit (was headCommit) the stamp .ovis/server/source-build version alone stamped (which install.ps1 then took as built) stamp left started, one line on stderr; still exits 0, as when HEAD moves

    Refusal, not retry, in install.ps1: what fails once (another git holding the repository, security software holding a file) clears at no time a retry could know, and what fails every time (a folder another account owns: git's "dubious ownership", a broken repository) a retry would only hide. The refusal changes nothing and quotes git, and the next run decides by the commit again. The launcher leaves started (no retry) for the same reason.

    Other readers of a checkout's commit keep their rule, and each already fails closed:

    • scripts/plugin-runtime.ts activePluginScript, server/managed.ts releaseSupervisor, install.sh's release lookup in the ovis launcher (install.sh:324): compare HEAD with the source_revision that server/updater.ts wrote from its own git rev-parse HEAD. A git failure there picks the checkout's own files, never a saved release. They form one writer–reader pair at the same depth and never read the stamp (as fix(install): install.ps1's refusals name a recovery that works, and the launcher stamps the commit its build started from #3928 said).
    • scripts/server-manifest.ts sourceTrees: tree ids of ./server and ./shared, not a commit; point 7.
    • install.ps1's rev-parse --disambiguate and git ls-remote: run only once the commit is known.
  2. An unverifiable live record that IS Ovis gets a way out (both refusals that name one: the kept binary's failed stop, and the record check). They now say how to tell what the process is (Get-CimInstance Win32_Process -Filter 'ProcessId=N' | Select-Object Name, CommandLine), and: if it is Ovis, Stop-Process -Id N; if not, delete that file. The herdr stop action cannot help there: it stops only a server it verifies. A record whose pid another process has taken since (another creation time) keeps "delete that file".

  3. Kept binary of this version failing its check, with a hand-started Ovis recorded. Before, the refusal named only the hand-started server ("Stop it … It runs as process N"), which the repair's stop does not touch, and the cause (the binary) showed on the next run. Now the binary comes first (remove <checkout>\.ovis\server\bin), then the hand-started server (its folder, its process, Stop-Process).

  4. The changelog fragment's 120-column line is wrapped, and one sentence added for point 1. A second fragment, plugin-launch-without-git.md, covers point 7.

  5. The stopped line install.ps1 reads is pinned (dori's LOW). scripts/plugin-stop-identity.test.ts, which ci.yml also runs on Windows:

    • on the Windows stop path (the one install.ps1 reads), every platform: the stdout line is stopped Ovis (pid N);
    • a real server stopped through scripts/plugin.ts stop and through server/main.ts plugin stop (the compiled binary's entry): a stdout line starts stopped ; a stop with no server says no such line.
    • A comment at both lines in scripts/plugin.ts names install.ps1 as their reader.
  6. A live record under the legacy id only (both reviewers read it from runningStateDir): pinned in the Windows test. The repair's stop, told plugins\devswha.ovis, falls back to plugins\devswha.herdr-web-ui and stops the server; then the build runs. It holds: no finding. The test's stand-in stop now falls back as runningStateDir does, and takes a dead pid as no server. scripts/plugin.test.ts already pins the real fallback ("stops the server an install started under its old id…").

  7. The launcher runs without git on PATH. sourceTrees exists for one decision: whether this checkout's server/ and shared/ are the sources the release's binary was built from (installServer compares them with the signed manifest, and only when it installs). Without git, that cannot be shown. So it is now a reason (git is not on PATH, so the binaries cannot be tied to their sources), not a thrown ENOENT, and is handled as a folder that is no checkout already is: the release's binary is not taken, and the checkout runs from source, saying why. A binary already installed and verified, the source path's commands, --help: none needs git. A build without git stays started (point 1).

Second commit: the merge pass's round on fdc464a

a. A folder git distrusts every time (fatal: detected dubious ownership: the plugin folder belongs to another account, after an install from an elevated prompt, on a network drive or under WSL). This is a working install that #3928 accepted: its launcher read no commit there, stamped <version>, and install.ps1 took it. With the first commit, every rerun with a branch or commit OVIS_REF is refused. The refusal stays (fail-closed), but install.ps1 now recognises git's answer and says the command: git config --global --add safe.directory '<the folder as git names it>'. Once that runs, the next run reads the commit and rebuilds once. The launcher in that folder leaves started, and (third commit) says the command on a line of its own. herdr's next plain start still runs that build as it is: a start reads only the marker.
b. Both ids installed (Codex MEDIUM). The old id's server is stopped for the move before the current checkout is read, so a refusal after that stop (git failed or distrusts, nested or no checkout, the ref check, GitHub out of reach) no longer says "nothing was stopped or changed". It says the old id's server was stopped for the move and that herdr plugin action invoke devswha.herdr-web-ui.start-windows starts it again. The order stays: moving the checks before that stop would change when the installer stops, which these refusals do not need.
c. A record whose pid another process took (another creation time): the advice is "delete that file" whatever that process is. The creation time already shows the record does not name it.
d. Each record's advice says only what is known (one Get-RecordAdvice):

  • The failed binary stop blames only herdr's records, the ones that stop reads. A record of an Ovis started by hand is said after the binary's cause, verified or not, never as one "the stop could not verify".
  • The unverified advice for a record in ~\.local\state says the process's command line names the checkout it runs from, which may be another than this one.

LC_ALL, answered in the VM: Git for Windows 2.56.0.windows.4 (the one install.ps1 asks for) ships no translations: 0 git.mo files under its install. On the VM's Korean (ko-KR) Windows, rev-parse --show-prefix in a folder that is no repository says fatal: not a git repository (or any of the parent directories): .git in English with no variable, with LANG=de_DE.UTF-8, with LANGUAGE=de, and with LC_ALL=C. A git that does translate and ignored LC_ALL=C would make a nested or non-git folder read as "git failed". That fails closed (refused with git's words) and only on an OVIS_REF rerun that needs a build.

Third commit: the merge pass's round on 3877355

  1. The safe.directory command is one correct PowerShell literal (MEDIUM, both reviewers). Real git prints the folder in its suggested command quoted for a POSIX shell ('…/John Doe/…', and '\'' for an apostrophe). install.ps1 captured those quotes and quoted again: ''C:/Users/John Doe/…'', which trusts nothing.
    • install.ps1 now takes the folder from git's own first line (fatal: detected dubious ownership in repository at '<folder>', where git writes it raw). It prints the command as one PowerShell single-quoted literal (' doubled), with Get-TrustCommand, as the refusal's last line, alone, to copy.
    • The launcher does the same for its platform's shell (PowerShell on Windows, POSIX elsewhere), on a stderr line of its own.
    • The git stand-in now prints what Git for Windows prints, quoting included.
    • Windows PowerShell also turned git's empty stderr line into the words "System.Management.Automation.RemoteException" in "git said: …". Each line is now its exception's message, and empty lines are dropped.
  2. git's ownership answer is told by git's own first line, `^fatal: detected dubious ownership in repository at '(.*)'Follow-up to fix(install): install.ps1's refusals name a recovery that works, and the launcher stamps the commit its build started from #3928 (merged as 3cb83b5). It covers the points both reviews of fix(install): install.ps1's refusals name a recovery that works, and the launcher stamps the commit its build started from #3928's last head left (the Codex review's MEDIUM, its table of states, the second reviewer's LOWs and the merge pass's list). It does not change when the installer builds, stops or refuses, except for point 1 (git failing: refused) and point 7 (the launcher without git). Point 1 includes one state that worked before and is now refused until fixed: a folder git does not trust on every call (owned by another account). The refusal names the command that fixes it (the second commit, below).

What changes

  1. The installers and the launcher tell three answers of git apart, by one rule (Codex MEDIUM). For the plugin's folder, git is asked rev-parse --show-prefix, untranslated (LC_ALL=C):

    • it succeeds and prints nothing: the checkout's top level, and rev-parse HEAD is its commit;
    • it succeeds and prints a path: a folder inside another repository, with no commit of its own;
    • it fails saying not a git repository: no checkout, no commit;
    • anything else (git's own error, a lock, a repository git does not trust, no git on PATH, or HEAD failing at the top level): git failed, and nothing is decided on it.

    Every reader of the installed commit applies it:

    reader what it decides git failed: before git failed: after
    install.ps1 ($installedCommit, now with $gitFailed) whether a finished build counts as this commit's; the ref check; the rerun line commit read as empty: any stamp starting with the version accepted (another commit's build started for that run) only a stamp that names no commit decides nothing (none: an older launcher's) counts; any other is refused, saying git's words, nothing stopped or changed; the rerun line says git failed
    install.sh ref_not_moved the line said on a rerun with OVIS_REF no commit, nothing said says git could not read the commit, with git's first line
    scripts/plugin-launch.ts checkoutCommit (was headCommit) the stamp .ovis/server/source-build version alone stamped (which install.ps1 then took as built) stamp left started, one line on stderr; still exits 0, as when HEAD moves

    Refusal, not retry, in install.ps1: what fails once (another git holding the repository, security software holding a file) clears at no time a retry could know, and what fails every time (a folder another account owns: git's "dubious ownership", a broken repository) a retry would only hide. The refusal changes nothing and quotes git, and the next run decides by the commit again. The launcher leaves started (no retry) for the same reason.

    Other readers of a checkout's commit keep their rule, and each already fails closed:

    • scripts/plugin-runtime.ts activePluginScript, server/managed.ts releaseSupervisor, install.sh's release lookup in the ovis launcher (install.sh:324): compare HEAD with the source_revision that server/updater.ts wrote from its own git rev-parse HEAD. A git failure there picks the checkout's own files, never a saved release. They form one writer–reader pair at the same depth and never read the stamp (as fix(install): install.ps1's refusals name a recovery that works, and the launcher stamps the commit its build started from #3928 said).
    • scripts/server-manifest.ts sourceTrees: tree ids of ./server and ./shared, not a commit; point 7.
    • install.ps1's rev-parse --disambiguate and git ls-remote: run only once the commit is known.
  2. An unverifiable live record that IS Ovis gets a way out (both refusals that name one: the kept binary's failed stop, and the record check). They now say how to tell what the process is (Get-CimInstance Win32_Process -Filter 'ProcessId=N' | Select-Object Name, CommandLine), and: if it is Ovis, Stop-Process -Id N; if not, delete that file. The herdr stop action cannot help there: it stops only a server it verifies. A record whose pid another process has taken since (another creation time) keeps "delete that file".

  3. Kept binary of this version failing its check, with a hand-started Ovis recorded. Before, the refusal named only the hand-started server ("Stop it … It runs as process N"), which the repair's stop does not touch, and the cause (the binary) showed on the next run. Now the binary comes first (remove <checkout>\.ovis\server\bin), then the hand-started server (its folder, its process, Stop-Process).

  4. The changelog fragment's 120-column line is wrapped, and one sentence added for point 1. A second fragment, plugin-launch-without-git.md, covers point 7.

  5. The stopped line install.ps1 reads is pinned (dori's LOW). scripts/plugin-stop-identity.test.ts, which ci.yml also runs on Windows:

    • on the Windows stop path (the one install.ps1 reads), every platform: the stdout line is stopped Ovis (pid N);
    • a real server stopped through scripts/plugin.ts stop and through server/main.ts plugin stop (the compiled binary's entry): a stdout line starts stopped ; a stop with no server says no such line.
    • A comment at both lines in scripts/plugin.ts names install.ps1 as their reader.
  6. A live record under the legacy id only (both reviewers read it from runningStateDir): pinned in the Windows test. The repair's stop, told plugins\devswha.ovis, falls back to plugins\devswha.herdr-web-ui and stops the server; then the build runs. It holds: no finding. The test's stand-in stop now falls back as runningStateDir does, and takes a dead pid as no server. scripts/plugin.test.ts already pins the real fallback ("stops the server an install started under its old id…").

  7. The launcher runs without git on PATH. sourceTrees exists for one decision: whether this checkout's server/ and shared/ are the sources the release's binary was built from (installServer compares them with the signed manifest, and only when it installs). Without git, that cannot be shown. So it is now a reason (git is not on PATH, so the binaries cannot be tied to their sources), not a thrown ENOENT, and is handled as a folder that is no checkout already is: the release's binary is not taken, and the checkout runs from source, saying why. A binary already installed and verified, the source path's commands, --help: none needs git. A build without git stays started (point 1).

Second commit: the merge pass's round on fdc464a

a. A folder git distrusts every time (fatal: detected dubious ownership: the plugin folder belongs to another account, after an install from an elevated prompt, on a network drive or under WSL). This is a working install that #3928 accepted: its launcher read no commit there, stamped <version>, and install.ps1 took it. With the first commit, every rerun with a branch or commit OVIS_REF is refused. The refusal stays (fail-closed), but install.ps1 now recognises git's answer and says the command: git config --global --add safe.directory '<the folder as git names it>'. Once that runs, the next run reads the commit and rebuilds once. The launcher in that folder leaves started, and (third commit) says the command on a line of its own. herdr's next plain start still runs that build as it is: a start reads only the marker.
b. Both ids installed (Codex MEDIUM). The old id's server is stopped for the move before the current checkout is read, so a refusal after that stop (git failed or distrusts, nested or no checkout, the ref check, GitHub out of reach) no longer says "nothing was stopped or changed". It says the old id's server was stopped for the move and that herdr plugin action invoke devswha.herdr-web-ui.start-windows starts it again. The order stays: moving the checks before that stop would change when the installer stops, which these refusals do not need.
c. A record whose pid another process took (another creation time): the advice is "delete that file" whatever that process is. The creation time already shows the record does not name it.
d. Each record's advice says only what is known (one Get-RecordAdvice):

  • The failed binary stop blames only herdr's records, the ones that stop reads. A record of an Ovis started by hand is said after the binary's cause, verified or not, never as one "the stop could not verify".
  • The unverified advice for a record in ~\.local\state says the process's command line names the checkout it runs from, which may be another than this one.

LC_ALL, answered in the VM: Git for Windows 2.56.0.windows.4 (the one install.ps1 asks for) ships no translations: 0 git.mo files under its install. On the VM's Korean (ko-KR) Windows, rev-parse --show-prefix in a folder that is no repository says fatal: not a git repository (or any of the parent directories): .git in English with no variable, with LANG=de_DE.UTF-8, with LANGUAGE=de, and with LC_ALL=C. A git that does translate and ignored LC_ALL=C would make a nested or non-git folder read as "git failed". That fails closed (refused with git's words) and only on an OVIS_REF rerun that needs a build.

, in install.ps1 and the launcher (install.sh matches no ownership). A missing folder named "dubious ownership" (fatal: cannot change to …) is a plain git failure.
3. A reused record: "whose creation time differs from the one recorded for the server", not "started after".
4. The old id's server stopped for the move is now said, with herdr plugin action invoke devswha.herdr-web-ui.start-windows, by the refusals after this checkout's own stop too: a failed binary stop, a recorded running server, a failed build. It is said only where that stop printed stopped.

Real Git for Windows, end to end, in the VM (git 2.56.0.windows.4, elevated desktop session, Windows PowerShell 5.1). The plugin folder is …\John O'Brien\plugin, a git checkout with a working install (marker and <version> stamp, packages and client present), owned by NT AUTHORITY\SYSTEM (icacls /setowner). install.ps1 is this commit's; herdr and bun are stand-ins; git is real, with its global config in a scratch file (GIT_CONFIG_GLOBAL). Git's lines, as the installer asks (LC_ALL=C git -C <folder> rev-parse --show-prefix):

fatal: detected dubious ownership in repository at 'C:/Users/devswha/AppData/Local/Temp/ovis-win-trust-c6a8c8/John O'Brien/plugin'
'C:/Users/devswha/AppData/Local/Temp/ovis-win-trust-c6a8c8/John O'Brien/plugin' is owned by:
	NT AUTHORITY/SYSTEM (S-1-5-18)
but the current user is:
	WINVM/devswha (S-1-5-21-1984017245-3788309751-3046433628-1000)
To add an exception for this directory, call:

	git config --global --add safe.directory 'C:/Users/devswha/AppData/Local/Temp/ovis-win-trust-c6a8c8/John O'\''Brien/plugin'
  • Run 1 with OVIS_REF=<its commit>: refused, ending with:
    git config --global --add safe.directory 'C:/Users/devswha/AppData/Local/Temp/ovis-win-trust-c6a8c8/John O''Brien/plugin'
    
  • That line pasted into the same PowerShell: exit 0; the global config holds directory = C:/…/John O'Brien/plugin. (Git's own suggested line, O'\''Brien, would not trust it in PowerShell.)
  • Run 2: not refused; "the installed branch was not built from its own sources; building it"; stamp 1.2.3 <commit>. Run 3: not refused; "the installed plugin is at commit 15e6909847fe; OVIS_REF does not move an installed plugin".
  • The real launcher's checkoutCommit (real bun) in that folder, trust removed again: trust = git config --global --add safe.directory 'C:/Users/devswha/AppData/Local/Temp/ovis-win-trust-c6a8c8/John O''Brien/plugin'. Run as printed, it makes the next checkoutCommit read the commit.

States touched

state before after
top-level checkout, git fails this once, finished build stamped with another commit accepted; the old build started for that run refused, quoting git, nothing stopped or changed; the next run rebuilds
the same, build started (or packages/client missing) refused as "no git checkout, or not one's top level", with the in-place build as recovery refused, quoting git, nothing stopped or changed
the same, finished build with no stamp (older launcher) kept, no commit said kept, says git could not read the commit
install.sh rerun with OVIS_REF, git fails "OVIS_REF does not move …" the same, after git's first line
launcher build, git fails before or after it stamp <version> stamp started, line on stderr
launcher, no git on PATH every command fails (ENOENT in sourceTrees) runs; from source where the release's binary would need git; build stays started
unverifiable live record (no server.owner), the process is Ovis "if it is not Ovis, delete that file": no way out when it is how to tell, and Stop-Process -Id N if it is Ovis
kept binary of this version fails its check, release out of reach, hand-started Ovis recorded names the hand-started process only the binary folder first, then the hand-started server
live record under the legacy id only, packages that load the stop stopped, then built (by reading) the same, now a test case
folder git distrusts every time, finished build stamped <version> (a working install) accepted refused on every branch/commit OVIS_REF rerun, ending with git config --global --add safe.directory '<folder>', one PowerShell literal (third commit; a path with a space was mis-quoted before it); once run, the next run rebuilds once. A plain or release-tag install is not affected
the same, launcher build stamp <version> stamp started; on stderr git's first line and, on a line of its own, the command quoted for the platform's shell; herdr's next start runs the build as it is
both ids installed, the old id's server stopped for the move, then a failed binary stop, a recorded running server or a failed build the old server left stopped, unsaid said, with its start command (third commit)
both ids installed, the old id's server stopped for the move, then a refusal for the current checkout "nothing was stopped or changed" says the old id's server was stopped, and the command that starts it again
kept binary's stop failed, record whose pid another process took "if that process is not Ovis, delete that file" its creation time differs from the recorded one: delete that file, whatever the process is

Faults that remain

Validation

Third commit (03707fa), over 3877355:

  • scripts/windows-install.test.ps1 in the Windows VM as ci.yml runs it (Windows PowerShell 5.1, -File, CI=true, desktop session), run before the push: unpadded (PATH 335) every section PASS, exit 0, 55 s; PATH padded to 2703 every section PASS, exit 0, 54 s.
  • Counting copy of this commit's test file:
    • install.ps1 at 3877355: 4 new assertions fail (129 pass, 4 fail), then the file stops where it reads Get-TrustCommand, which that install.ps1 lacks. The 4: the three distrust cases (the command does not parse in PowerShell to the folder: ''C:/…/herdr plugin with spaces N''), and "a failed build, the old id installed too and its server stopped for the move" (not said).
    • At this commit: 232 pass / 3 fail, the gh-ordering negative control as before.
  • New in the test file:
    • each distrust case parses the refusal's last line with PowerShell's parser and requires exactly git config --global --add safe.directory <the folder>;
    • Get-TrustCommand, from the installer's own text, gives one argument equal to the folder for C:/Users/John Doe/…, C:/Users/John O'Brien/plugin and C:/it's/a ''quoted'' one;
    • a failed build with the old id's server stopped says its start.
  • TS: plugin-launch.test.ts (new: a folder named John Doe's plugin git distrusts, by real git with GIT_TEST_ASSUME_DIFFERENT_OWNER=1: the launcher leaves started and prints the command on its own stderr line; that command run in sh as printed makes git read the commit; a missing folder named "no such dubious ownership folder" is a plain failure, with no command), plugin-stop-identity.test.ts, changelog-fold.test.ts: 36 pass, 0 fail.
  • The real-git run above.
  • bun run check fast through heavy-run on this commit, untouched while it ran: exit 0, slot 10, 520 s, unit 17587 pass, 0 fail, 54 skip.

Second commit (3877355):

Second commit (3877355), over fdc464a:

  • scripts/windows-install.test.ps1 in the Windows VM as ci.yml runs it (Windows PowerShell 5.1, -File, CI=true, desktop session): unpadded (PATH 335) every section PASS, exit 0, 53 s; PATH padded to 2703 every section PASS, exit 0, 52 s.
  • Counting copy of this commit's test file: install.ps1 at fdc464a 220 pass / 5 fail, at this commit 222 / 3 (the 3 are the gh-ordering negative control, as before). At fdc464a these new cases fail:
    • "a finished build stamped with the version alone, in a folder git does not trust" (no safe.directory command);
    • "the same, the old id installed too and its server stopped for the move" (said "nothing was stopped or changed").
    • Points c and d change wording only. Their cases ("a kept release binary of this version whose stop cannot verify a record another process's pid holds", "the same, an Ovis started by hand recorded as running too", the two "being Ovis" cases) follow the advice and assert the next run builds.
  • The git stand-in now answers a distrusted folder as git does on every call (three lines, the last naming safe.directory and the folder), and a broken repository (fatal: bad object HEAD) for the generic refusal.
  • LC_ALL: the VM run above (lc-probe: Git for Windows 2.56.0.windows.4, 0 git.mo, ko-KR, English under every variable).
  • TS: plugin-launch.test.ts, plugin-stop-identity.test.ts, changelog-fold.test.ts: 35 pass, 0 fail (unchanged files, rerun).
  • bun run check fast through heavy-run on this commit: exit 0, slot 11, 517 s, unit 17586 pass, 0 fail, 54 skip.

First commit (fdc464a):

On fdc464a, over origin/main 3cb83b5 (main had not moved at push).

  • scripts/windows-install.test.ps1 in the Windows VM: Windows PowerShell 5.1, in the VM's desktop session (Invoke-InSession), CI=true, powershell -NoProfile -ExecutionPolicy Bypass -File scripts/windows-install.test.ps1 as ci.yml runs it, on this commit's tree:

    • unpadded (PATH 335 characters): every section PASS, exit 0, 53 s;
    • PATH padded to 2703 characters: every section PASS, exit 0, 52 s.
  • Counts, the whole file, from a scratch copy whose Assert counts and goes on, with this commit's test file:

    install.ps1 pass fail
    3cb83b5 (main) 207 10
    fdc464a (this PR) 214 3

    The 3 failures in both rows are the gh-ordering negative control, which needs Assert to throw (an artifact of the counting copy; the real file passes that section). At main, these new cases fail:

    • point 1: "a finished build of another commit, git failing at the checkout this once" (main kept it: the Codex MEDIUM); "a build cut off, git failing …" (main gave the nested-folder refusal, not git's words); "a finished build of an older launcher (no stamp), git failing …" (nothing said);
    • point 2: "the same, the server recorded without its creation time", "the same, the process it names being Ovis", "a kept release binary of this version whose stop cannot verify a record without its creation time, the process being Ovis": no way to stop it when it is Ovis. The two "being Ovis" cases record a process the test starts, and following the refusal (Stop-Process on it) lets the next run build;
    • point 3: "the same, an Ovis started by hand recorded as running too": main did not name the binary folder.
    • Point 6, "a live server recorded under the old id only, with packages that load the stop", passes at main too: it pins what the reviewers read, no finding.
  • TS tests (Linux, HERDR_TEST_MODE=unit, TMPDIR under ~/.cache): plugin-launch.test.ts, plugin-stop-identity.test.ts, server-manifest.test.ts, changelog-fold.test.ts: 62 pass, 0 fail; install-star.test.ts: 47 pass, 0 fail. Run against main's product files in a scratch copy (with a two-line adapter exporting checkoutCommit from main's headCommit, only so the file links):

    • "leaves the build unfinished, saying git's words, where git fails at a checkout's top level" and "runs without git on PATH …" fail at main (main stamped the version alone; main threw ENOENT). Two older tests also fail there, but only on the new answer's shape;
    • install.sh "says what git said where it fails at the checkout's top level" fails at main; "says nothing of git for a plugin folder git says is no repository" passes at both (a guard against a false "git failed");
    • the stop pin passes at main (it is a pin). With stopped Ovis changed to Stopped Ovis at both lines of scripts/plugin.ts, both pinning tests fail.
    • git failing is made real, not stood in for: GIT_TEST_ASSUME_DIFFERENT_OWNER=1 with an empty global config makes real git answer "detected dubious ownership" at the top level.
  • sh -n and dash -n install.sh: OK.

  • bun run check fast through heavy-run (slot 10, 536 s): exit 0, unit 17586 pass, 0 fail, 54 skip.

  • The VM's pr-check.ps1 at each head: in a PR comment.

Not run: macOS; bun run check full; a real Ovis whose record has no server.owner stopped by hand in the VM (a test process stands for it); real git refusing a folder in the VM (the Windows test's git stand-in answers "dubious ownership"; the launcher and install.sh run real git on Linux); the launcher without git on Windows; shellcheck and PSScriptAnalyzer.

…the launcher without git, and the last refusal gaps
@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Improved plugin launching when Git is unavailable, while preventing builds from being marked complete when the checkout cannot be verified.
    • Installers now distinguish Git read errors from missing or nested checkouts and stop before changing files when they encounter an unexpected Git failure.
    • Windows recovery guidance now distinguishes verified Ovis processes from processes that cannot be verified, with clearer instructions for stopping or removing stale records.
  • Tests
    • Expanded coverage for Git errors, source-based launches, and safe Windows process recovery.

The launcher and installers now distinguish checkout commits from Git failures. Build stamps remain unfinished when commit verification fails or changes during a build. Windows recovery guidance and tests now cover unverified process records, legacy records, and stop output.

Changes: Checkout verification and recovery

Layer / File(s) Summary
Launcher checkout verification and build stamps
scripts/plugin-launch.ts, scripts/plugin-launch.test.ts, scripts/server-manifest.ts, changelog.d/plugin-launch-without-git.md
The launcher distinguishes commits, absent or nested checkouts, and Git failures. It completes a build stamp only when checkout results match before and after the build. Tests cover missing Git and commit lookup failures.
Installer checkout detection and build recovery
install.ps1, install.sh, scripts/install-star.test.ts, scripts/windows-install.test.ps1, changelog.d/windows-branch-install-from-source.md
The installers report Git errors when they cannot read an installed checkout’s commit. Windows build-stamp and shell installer tests cover checkout detection and recovery behavior.
Windows process recovery and stop identity
install.ps1, scripts/plugin.ts, scripts/plugin-stop-identity.test.ts, scripts/windows-install.test.ps1
The Windows installer gives process inspection and conditional stop-or-delete instructions for unverified records. Tests cover process identity, legacy records, and stop output from source and release-binary entry points.

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

Change: Bug fix

Possibly related issues

  • devswha/ovis#2213: The PR changes installer handling of the stopped output and adds guidance for unverifiable live Ovis processes; the issue also covers other Windows update workflow items.
  • devswha/ovis#2184: The PR adds recovery guidance for unverifiable process records and tests the legacy running-state ID; the issue also describes other lifecycle identity concerns.

Possibly related PRs

  • devswha/ovis#3800: Both changes address source-versus-release-binary selection in scripts/plugin-launch.ts.
  • devswha/ovis#3928: Both changes address launcher build stamps and top-level checkout detection in install.ps1.
  • devswha/ovis#3923: That PR defines the source-build stamp that this PR updates when commit verification fails.
Merge Risk: Minimal · up to fdc46

The change makes the installers and launcher handle Git failures more safely and improves recovery guidance. No merge-blocking risk was identified in the supplied material.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names three changes: separating Git's answers for the installed commit, running the launcher without Git, and closing the last refusal gaps. The changeset covers all three. The title lists s…
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.
Description check Passed The description follows the repository template in substance. It has a Change section that explains the problem and the resulting behavior in detail, and a Validation section that lists the checks run…
Full details: Title check

Explanation

The title names three changes: separating Git's answers for the installed commit, running the launcher without Git, and closing the last refusal gaps. The changeset covers all three. The title lists several items and is somewhat long, but it matches the main changes and is specific enough for a reviewer scanning history.

Full details: Description check

Explanation

The description follows the repository template in substance. It has a Change section that explains the problem and the resulting behavior in detail, and a Validation section that lists the checks run (Windows VM test runs, TypeScript test counts, sh -n and dash -n, bun run check fast) and the checks not run (macOS, bun run check full, ShellCheck, PSScriptAnalyzer). The template asks for a linked issue for features, but this is a follow-up fix to #3928, not a feature. The description is long and dense, and it repeats the Change and Validation blocks (the second commit's text appears twice). It also has a broken fragment: a truncated paragraph that restarts the description. Those problems hurt readability but do not leave any required section missing.

Finishing Touches

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 3cb83b5 and fdc464a.

Files selected for processing: 11

  • changelog.d/plugin-launch-without-git.md
  • changelog.d/windows-branch-install-from-source.md
  • install.ps1
  • install.sh
  • scripts/install-star.test.ts
  • scripts/plugin-launch.test.ts
  • scripts/plugin-launch.ts
  • scripts/plugin-stop-identity.test.ts
  • scripts/plugin.ts
  • scripts/server-manifest.ts
  • scripts/windows-install.test.ps1

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

@devswha

devswha commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Windows VM pr-check.ps1 -Pr 3929 (Windows 11 VM, desktop session via Invoke-InSession, fresh clone):

HEAD fdc464a91a7d9df8d0ba5f711da1a9a535601404 in C:\Users\devswha\AppData\Local\Temp\ovis-pr3929-bb044689
STEP-PASS windows-install.test.ps1 (exit 0, 53s)
STEP-PASS preflight.ps1 (exit 0, 0s)
STEP-PASS bun install --frozen-lockfile (exit 0, 16s)
STEP-PASS bun run build (exit 0, 21s)
STEP-PASS bun test (windows set) (exit 0, 76s)
STEP-PASS playwright chromium (exit 0, 0s)
STEP-PASS windows-terminal-browser-qa.ts (exit 0, 10s)
CLONE-REMOVED True C:\Users\devswha\AppData\Local\Temp\ovis-pr3929-bb044689
PR-CHECK PASS

…pped server, and word each record's advice for what is known
@devswha

devswha commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Windows VM pr-check.ps1 -Pr 3929 at the second commit (Windows 11 VM, desktop session via Invoke-InSession, fresh clone):

HEAD 3877355793ccf57c679d869857a3b7fa66067dff in C:\Users\devswha\AppData\Local\Temp\ovis-pr3929-abab71a1
STEP-PASS windows-install.test.ps1 (exit 0, 53s)
STEP-PASS preflight.ps1 (exit 0, 0s)
STEP-PASS bun install --frozen-lockfile (exit 0, 15s)
STEP-PASS bun run build (exit 0, 22s)
STEP-PASS bun test (windows set) (exit 0, 77s)
STEP-PASS playwright chromium (exit 0, 0s)
STEP-PASS windows-terminal-browser-qa.ts (exit 0, 9s)
CLONE-REMOVED True C:\Users\devswha\AppData\Local\Temp\ovis-pr3929-abab71a1
PR-CHECK PASS

…, git's own ownership line, and the old id's stop said by every refusal
@devswha

devswha commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Windows VM pr-check.ps1 -Pr 3929 at the third commit (Windows 11 VM, desktop session via Invoke-InSession, fresh clone):

HEAD 03707fa742ac16fb5ce9128520052d2f5b3214f4 in C:\Users\devswha\AppData\Local\Temp\ovis-pr3929-585efa6e
STEP-PASS windows-install.test.ps1 (exit 0, 55s)
STEP-PASS preflight.ps1 (exit 0, 0s)
STEP-PASS bun install --frozen-lockfile (exit 0, 16s)
STEP-PASS bun run build (exit 0, 21s)
STEP-PASS bun test (windows set) (exit 0, 77s)
STEP-PASS playwright chromium (exit 0, 0s)
STEP-PASS windows-terminal-browser-qa.ts (exit 0, 10s)
CLONE-REMOVED True C:\Users\devswha\AppData\Local\Temp\ovis-pr3929-585efa6e
PR-CHECK PASS

@devswha
devswha merged commit f6ad182 into main Nov 15, 2026
14 of 15 checks passed
@devswha
devswha deleted the fix/install-git-answers-told-apart branch November 15, 2026 23:20
@devswha

devswha commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Merge pass

Merged head 03707fa742ac as f6ad18252484 on GitHub's checks, with no unresolved review threads.

Reviewer Verdict Note
claude CLEAR
codex CLEAR

Merge pass note for #3929 at 03707fa (installer follow-up to #3928: git's answers for the installed commit told apart, the launcher without git, the last refusal gaps).

Two reviewers, three rounds, each with a table of build states against server states and what git answers.
What changes for users: every reader of the installed commit now tells a checkout's top level, a folder inside another repository and "not a repository" apart from a real git failure. On a real failure install.ps1 refuses a rerun with a branch or commit OVIS_REF and quotes git; before, a momentary failure accepted another commit's stamp for one run. When git distrusts the folder ("dubious ownership"), the refusal prints the git config --global --add safe.directory command for that folder, correctly quoted for a path with a space or an apostrophe. The launcher no longer crashes without git on PATH. Plain and release-tag installs never reach these refusals; a working source install whose commit git can read is accepted without a stop or a rebuild.

Evidence: reviewers ran the TypeScript tests (plugin-launch 18 pass, incl. a case with real git) and the quoting with real git on Linux for a space, an apostrophe and both; the Windows test file and a real Git for Windows run in a VM are the author's; GitHub's two Windows checks ran on the head.

Known and accepted: a checkout that git distrusts every time went from accepted to refused on such reruns (fail-closed, with the command to fix it); a live server with no record can still be built under (no released version leaves that); a build during which the commit moved is left "started" and still used by the next plain start; with no git, no cached binary and the release out of reach, the launcher cannot start an already-built source checkout (unchanged from main, the author's follow-up).

devswha added a commit that referenced this pull request Nov 16, 2026
…ad only git's stdout, and start a checkout git cannot tie without asking the release (#3937)

Follow-up to #3929 (merged as f6ad182). Five points from dori's review
of #3929's last head and the merge pass, none urgent. It does not change
when install.ps1 or install.sh builds, stops or refuses. The launcher
changes in one state: where git ties no sources to the release (no git
on PATH, no checkout, changes not committed), it no longer asks the
release. A start then runs the checkout's own build only once that build
finished, and remembers nothing; an unfinished build is not started, and
the launcher says how to build it (point 5; the second commit).

## What changes

1. **install.ps1, a rerun with `OVIS_REF` over a checkout that needs no
build, in a folder git distrusts** (dori LOW 1). The line printed
carried git's whole stderr, including git's suggested command quoted for
a POSIX shell (`'…O'\''Brien…'`), which trusts nothing when pasted into
PowerShell. It now says git's first line, then `Ovis: to trust the
folder, run:` and `Get-TrustCommand`'s line alone, as the refusals
already do.
2. **The launcher's trust command on Windows** (dori LOW 2). herdr shows
the launcher's stderr, and a user may paste it into PowerShell or into
cmd.exe, which keeps single quotes. A label alone still leaves cmd.exe
users without a command that works, so both forms are given, each on its
own line and introduced by its shell's name:
   ```
Ovis: git does not trust this folder (another account owns it); to trust
it, run in PowerShell:
   git config --global --add safe.directory 'C:/…/John O''Brien/plugin'
   Ovis: or in cmd.exe:
   git config --global --add safe.directory "C:/…/John O'Brien/plugin"
   ```
There is no cmd.exe form for a folder whose path has a `%` (cmd.exe
expands `%name%` there) or a `!` (`cmd /v:on` expands `!name!` inside
double quotes; second commit). POSIX output is unchanged.
3. **install.sh `ref_not_moved` keeps git's stdout and stderr apart**
(dori LOW 3). With `2>&1`, a warning git printed while it succeeded
(about a config file it cannot read, for example) was read as the
`--show-prefix` answer, so the folder counted as nested and no commit
was said, or it ended up in the "at commit" text. Now only stdout is the
prefix and the commit; stderr goes to a `mktemp` file, read for its
first line and for `not a git repository`. If no temp file can be made,
nothing is said of git, as when herdr names no plugin root.
4. **"moved to another commit"** (dori LOW 4) is said only when both of
git's answers name a commit. Otherwise the launcher says that git's
answer changed, and from what to what: `git's answer for the checkout
changed while it was built (no git checkout before, a folder inside
another repository after), so the build is not marked finished`. The
stamp stays `started`, as before.
5. **The launcher starts an already built checkout without git while the
release is out of reach** (the fault #3929 left, named twice by the
merge pass). See the decision and the table below.
6. (second commit) **A folder git distrusts is said as such** in the
reason the release's binary is not taken (`sourceTrees`): `git does not
trust this folder (another account owns it)`, not `not a git checkout`.
Any other git failure is said with git's first line.

## Point 5: when starting is safe

What the launcher needs git for here: `sourceTrees` exists for one
decision, whether this checkout's `server/` and `shared/` are the
sources of the release's binary (`installServer` compares them with the
signed manifest). If `sourceTrees` returns a reason instead of trees (no
git, no checkout, changes not committed), the binary is never taken,
whatever the release holds:
- a manifest that checks out leads to `NoBinaryRelease` on the sources;
- a 404 leads to `NoBinaryRelease`.

So the download could only add a failure; it could never change the
choice. `installLocked` downloaded first and looked at the reason after.
It now throws `NoBinaryRelease` on the reason before the release is
asked, after the verified-install checks, so a binary already installed
and verified still runs, as before.

What a start for that reason may run (second commit, after both
merge-pass reviews of e1a4d23):
- At e1a4d23 it picked source and wrote the from-source marker without
looking at the build. A tree with packages and no client started a
server answering "the browser client has not been built yet" (at
f6ad182 nothing ran there); a `started` stamp did not stop it; and the
marker made the choice stick after git and the network came back.
- Now a command other than `install` runs the checkout's own build for
this reason only when that build finished: `node_modules` and
`dist/index.html` present, and the stamp, if any, not `started`.
Otherwise it starts nothing, exits 1, and says what is missing and how
to build it: `OVIS_FROM_SOURCE=1 bun
'<checkout>/scripts/plugin-launch.ts' install`, or
`$env:OVIS_FROM_SOURCE = '1'; bun '<checkout>\scripts\plugin-launch.ts'
install` on Windows.
- The marker is not written for this reason: it may not hold at the next
start (git back, a commit made). That start asks the release as usual.
- The stamp is untouched; only a build writes it. A build without git
still leaves `started` (#3929).
- install.ps1 (it needs git) and install.sh decide as before. herdr's
next build step (`install`) builds from source for this reason as
before, and only that writes the marker.

### States (launcher)

"Untied" means git ties no sources to the release: no git on PATH, git
distrusting or failing on the folder, no checkout, or changes not
committed in `server/`/`shared/`. Every row has no verified cached
binary and no from-source marker unless it says so.

| state | f6ad182 | e1a4d23 | this head |
|---|---|---|---|
| untied, release out of reach (or a 5xx, or a manifest failing its
check), `start`, finished build (packages, client, stamp not `started`)
| exit 1, nothing runs | runs it; marker written; release not asked |
runs it; **no marker**; release not asked |
| the same, build without its client (`dist/index.html` missing) | exit
1, nothing runs | runs it (a server answering "the browser client has
not been built yet"); marker written | **exit 1, nothing runs**: says
`no dist/index.html` and the command that builds it; no marker |
| the same, without its packages (`node_modules` missing) | exit 1,
nothing runs | runs it (fails on its imports); marker written | **exit
1, nothing runs**, says `no node_modules` and how to build; no marker |
| the same, stamp `started` (a build that failed or was cut off) | exit
1, nothing runs | runs it; marker written | **exit 1, nothing runs**,
says its last build did not finish and how to build; no marker |
| untied, release reachable with a manifest or a 404, `start` | release
asked; runs from source (any build); marker written | runs from source
(any build) without asking; marker written | finished build: runs it, no
marker; otherwise exit 1 with how to build |
| a later `start` after git and the release are back (after any row
above) | asks the release | goes straight to the sources (the marker)
without asking | **asks the release**, as usual |
| untied, `install` (herdr's build step), release out of reach | exit 1,
marker and stamp removed | builds from source, marker written, stamp
`started` without git | the same as e1a4d23 |
| untied, marker of this version | runs from source | the same | the
same (never reaches this branch) |
| any, verified binary of this version installed | runs the binary | the
same | the same |
| git ties the sources, release out of reach | exit 1 | exit 1 | exit 1
|
| the reason said for a folder git distrusts | `not a git checkout`
(only when the release answered) | `not a git checkout`, on every start
| `git does not trust this folder (another account owns it)` |

Tests by row (plugin-launch.test.ts unless named). The new launcher
cases run the real launcher in a checkout of the test's own, with its
real source path: its `scripts/plugin.ts` stands for the server and
notes the command it got. They do not stub the source function.
- row 1: "starts a finished build without git, the release out of reach,
without asking it, and remembers nothing", plus "starts a finished build
without asking the release where not a git checkout / where server/ or
shared/ has changes that are not committed";
- rows 2-4: "starts nothing without git for a checkout without its
client / without its packages / whose last build did not finish, saying
it needs a build and how";
- row 5: the same cases, since the release is not asked (`asked: []`);
- row 6: "takes the usual way again once git ties the sources and the
release answers: the start without git left nothing behind" (a file://
release with no compiled server: the release is asked, `ships no
compiled server`);
- row 7: "builds from source at the build step without asking the
release where git ties no sources to it";
- row 8: the no-git test's `status`, run on the marker;
- row 9: server-install's "takes the binary only for the sources it was
built from" (a verified binary, no git, offline release: `{ installed:
false }`, release not asked);
- row 10: "still asks the release where git ties the sources, and fails
when it is out of reach";
- row 11: the distrust test now also requires `sourceTrees(folder)` to
say git does not trust it.

All nine new or changed launcher cases fail with e1a4d23's
`scripts/plugin-launch.ts` and `scripts/server-manifest.ts`, and pass at
this head. To link, that run added a wrapper exporting `gitFailed(err,
platform)` around e1a4d23's own `gitFailed`. The rule kept in the
launcher's header still holds: a manifest that fails a check, a server
error or a network failure is never a reason to build from source. Here
the reason is the sources, and the release is not asked.

## Every place that prints git's stderr (point 1's search)

| place | what it prints | can it carry git's POSIX-quoted
`safe.directory` command? |
|---|---|---|
| install.ps1 distrust refusal (`$distrusted`, before the build) | git's
first line + `Get-TrustCommand` | no (#3929) |
| install.ps1 generic git refusal (`git said: $gitFailed`) | all of
git's stderr lines, joined | only when git's ownership line is not its
first line (a warning before it): then the folder is not recognised as
distrusted. See "faults that remain" |
| install.ps1 rerun line, no build needed (`$at`) | **was** all of git's
stderr; now git's first line + `Get-TrustCommand` when distrusted, all
lines otherwise | no longer (point 1); the generic branch is as in the
row above |
| install.ps1 `rev-parse --disambiguate`, `git ls-remote` (ref check),
`Get-LatestRef`'s `ls-remote` | not captured; git writes to the console
itself | no: the first runs only after git read the commit in that
folder; `ls-remote` with a URL gives no ownership advice even from a
distrusted working directory (checked: real git with
`GIT_TEST_ASSUME_DIFFERENT_OWNER=1` lists the tags) |
| install.sh `ref_not_moved` | git's first stderr line | no: the first
line names the folder; the command is git's last line |
| install.sh `git clone` / `git checkout` (herdr-core install),
`latest_release` | console / `2>/dev/null` | no: the clone is this run's
own new folder; `ls-remote` as above |
| install.sh `ovis` launcher's `rev-parse HEAD` (`install.sh:324`) |
`stderr: "ignore"` | no |
| plugin-launch.ts `checkoutCommit` failure line | git's first line when
distrusted (+ the trust lines), all of stderr otherwise | as
install.ps1's generic refusal: only when a warning comes before git's
ownership line |
| server-manifest.ts `sourceTrees` | `stderr: "ignore"` | no |

## Faults that remain

- **A warning before git's ownership line** (a config warning, say)
hides the distrust: install.ps1's and the launcher's match reads git's
first line only. The generic refusal then quotes all of git's lines, its
POSIX command among them. It fails closed (refused or `started`), but
the trust command is not given. Not seen with Git for Windows 2.56 in
the VM.
- **A checkout with the from-source marker of its version** still runs
whatever build it has (at f6ad182 too); only the untied, unmarked start
checks the build (second commit).
- The PowerShell form pasted into cmd.exe fails with git's `wrong number
of arguments` when the path has a space (seen in the VM). Without a
space it would record the quotes, which is why the cmd.exe form is
printed.

## Validation

**Second commit (988eec8)**, over e1a4d23 (pushed after GitHub's whole
run on e1a4d23 had ended):
- Windows VM, the real test file as GitHub runs it, at 988eec8: PATH
unpadded (335) every section PASS, exit 0, 53 s; **PATH padded to 2726**
every section PASS, exit 0, 52 s.
- Windows VM, `bun test scripts/plugin-launch.test.ts
scripts/server-install.test.ts`: 30 pass, 24 skip, 0 fail. This includes
the new checkout cases, run on Windows with no git on PATH.
- Linux: `plugin-launch.test.ts`, `server-install.test.ts`,
`server-manifest.test.ts`, `changelog-fold.test.ts`: 93 pass, 0 fail.
- Forced: with e1a4d23's `scripts/plugin-launch.ts` and
`scripts/server-manifest.ts` (plus the `gitFailed` wrapper), 9 fail / 20
pass. The 9 are the new or changed cases listed under the table, the `!`
case and the distrust reason included.
- `bun run check fast` through heavy-run on 988eec8: exit 0, slot 12,
503 s, unit 17599 pass, 0 fail, 54 skip; the tree untouched while it
ran.

**First commit (e1a4d23)**, over origin/main a761ccd:

- **Windows VM, the real test file as GitHub runs it** (`$env:CI='true';
powershell -NoProfile -ExecutionPolicy Bypass -File
scripts/windows-install.test.ps1`, Windows PowerShell 5.1, the VM's
desktop session, a clone of this commit):
  - PATH unpadded (335 characters): every section PASS, exit 0, 58 s;
  - **PATH padded to 2726**: every section PASS, exit 0, 58 s.
- **Counting copy** (its `Assert` counts and goes on), this commit's
test file:
- with main's install.ps1: the new assertion fails ("a finished build of
an older launcher (no stamp), git failing at the checkout: git's own
lines after its first must not be said"). The file then stops where it
parses the trust line, because main prints none on its own line.
- at this commit: **237 pass / 3 fail**. The 3 are the gh-ordering
negative control, as in #3929.
- The test file's case "a finished build of an older launcher (no
stamp), git failing at the checkout" now requires a line that
PowerShell's parser reads as `git config --global --add safe.directory
<the folder>`, and none of git's lines after its first. The case loop
captures each line whole (`Out-String -Width 4096`); Out-String had
wrapped a line at the console's width in the VM.
- **Real Git for Windows, end to end** (git 2.56.0.windows.4, elevated
desktop session; plugin folders `…\John Doe\plugin` and `…\John
O'Brien\plugin`, git checkouts owned by `NT AUTHORITY\SYSTEM` through
`icacls /setowner`; global config a scratch file; herdr and bun
stand-ins for install.ps1, real bun for the launcher). Each command was
typed into a fresh shell as printed, through its input:
- git's own line for the apostrophe folder: `git config --global --add
safe.directory 'C:/…/John O'\''Brien/plugin'`. Pasted into PowerShell
5.1, it **trusts nothing** (global config empty; git still refuses).
- install.ps1 `-Ref <commit>` over a working install with no stamp:
kept, nothing built, and it printed:
    ```
Ovis: git does not trust the installed plugin's folder: it belongs to
another account (git said: fatal: detected dubious ownership in
repository at 'C:/…/John O'Brien/plugin'); OVIS_REF does not move an
installed plugin (INSTALL.md, Update)
    Ovis: to trust the folder, run:
    git config --global --add safe.directory 'C:/…/John O''Brien/plugin'
    ```
Pasted into PowerShell 5.1: the global config holds `C:/…/John
O'Brien/plugin`, and git reads the commit. The same for `John Doe`.
- The launcher (`main(["install"])` in that folder): `CODE 0 STAMP
started`, and the four lines above. The PowerShell line pasted into
PowerShell 5.1 and the cmd.exe line pasted into cmd.exe (exit 0) each
make git read the commit, for both folders. For contrast, the PowerShell
line pasted into cmd.exe gives `error: wrong number of arguments, should
be 2`, exit 129, and trusts nothing.
- **Windows VM, `bun test scripts/plugin-launch.test.ts
scripts/server-install.test.ts`**: 25 pass, 24 skip (server-install
skips itself on Windows), 0 fail. This includes the distrust test's new
cmd.exe half (real git with `GIT_TEST_ASSUME_DIFFERENT_OWNER=1`, `John
Doe's plugin`), and the no-git launcher test, which #3929 had not run on
Windows.
- **Linux, TS tests** (`HERDR_TEST_MODE=unit`, `TMPDIR` under
`~/.cache`): `plugin-launch.test.ts`, `server-install.test.ts`,
`changelog-fold.test.ts`: 61 pass, 0 fail. `install-star.test.ts`: 48
pass, 0 fail; its git cases also pass with `sh` as dash and as busybox
ash.
- **Forced before/after**: with main's `install.sh`,
`scripts/plugin-launch.ts` and `scripts/server-install.ts` put back in
this tree, these new or changed tests fail:
- point 4: "says the checkout moved to another commit only where both of
git's answers name one";
- point 5: "runs without git on PATH" (its new offline start), the three
"starts from source without asking the release, also one out of reach,
where …", "builds from source at the build step without asking the
release …", and server-install's "takes the binary only for the sources
it was built from" (the release was asked);
- point 3: install-star's "reads only git's stdout as the prefix and the
commit, also where git warns on stderr while it answers". Main said no
commit, because the warning was read as a prefix.
- "still asks the release where git ties the sources, and fails when it
is out of reach" passes at both: a guard that the change does not reach
that state.
- `sh -n` and `dash -n install.sh`: OK.
- `bun run check fast` through heavy-run on this head: exit 0, slot 12,
503 s, unit 17594 pass, 0 fail, 54 skip; the tree untouched while it
ran.
- The VM's `pr-check.ps1` at each head: in a PR comment.

**Not run:** macOS; `bun run check full`; a translating git; a warning
before git's ownership line (see faults); shellcheck and
PSScriptAnalyzer.
devswha added a commit that referenced this pull request Nov 16, 2026
…se is out of reach, and prints its build command quoted for any path (#3950)

Follow-up to #3940 (merge a81ec59) and #3944 (fccc9c4), in
`install.ps1` and `scripts/windows-install.test.ps1`, plus a changelog
fragment. Nothing in `scripts/plugin*.ts`.

## 1. The repair with the release out of reach: what it did, and the fix
Since #3940 the launcher's `stop` reaches the checkout's own
`scripts/plugin.ts` when no checked binary can be had, also when the
release cannot be reached. install.ps1's repair (a branch rerun with
`OVIS_REF` whose checkout is not built from its own sources) sends its
stop through the launcher whenever a release binary is kept in
`.ovis\server\bin`. So in one state the repair now stops a running
server where it used to refuse. That state: the kept binary is one the
launcher does not run without the release (another version's, or this
version's failing its check), the release cannot be reached, and the
packages load the stop.

Run in the Windows VM with the test file's stand-ins (herdr, bun, the
release) and real git, at main (fccc9c4):
- **(a) Step by step.** The launcher's `stop` goes to the sources and
stops the server, and its record is removed. install.ps1 has already
removed the from-source marker before the stop. It then runs
`OVIS_FROM_SOURCE=1 bun <launcher> install`. That build writes the stamp
`started` and the marker, then runs `bun install`.
- **(b) The build fails offline.** The user is told: `bun failed (exit
1) building the installed branch, and Ovis is stopped. Fix the error
above, then run this again with OVIS_REF=feat/windows-install to build
it and start Ovis.` The marker is taken back, and the stamp stays
`started`. Nothing that is printed starts Ovis again while the release
is out of reach:
- Herdr's start runs the launcher without a marker, which asks the
release. Run for real in the VM, it gives `Ovis: could not install the
server of v0.5.4: Unable to connect. Is the computer able to access the
url?`, exit 1, and nothing is started.
- With a kept binary of this version that fails its check, the message
even adds `Until then, herdr plugin action invoke
devswha.ovis.start-windows starts the release's binary this checkout ran
before.` That start fails in the same way.
- Once the release is back, a branch's start meets the `started` stamp
and is refused until the rebuild succeeds.
- **(c) The old build.** Its files are not removed: real `bun install`
with the registry out of reach exits 1 and leaves `node_modules` as it
was (`is-number unchanged: True`), and `vite` runs only after `bun
install` succeeds. But it is no longer usable through herdr. The marker
that sent herdr's start to it is gone, and the stamp says `started`.

So a user is left with a stopped Ovis and no working way back until the
release can be reached. Before #3940 the launcher's stop exited 1 in
this state, and the repair refused with nothing stopped.

**The fix: do not stop in that state. The rule: the repair asks the
release first whenever the launcher's stop or herdr's later start would
have to ask it, that is, whenever the checkout keeps no release binary
the launcher runs without the release.** Concretely, before the repair
touches anything (the marker included), unless a kept binary passes
\`$keptRuns\`, it asks the release for \`v<version>/ovis-server.json\`
with \`Save-ReleaseFile\`. \`$keptRuns\` passes for a binary of this
version whose executable has the SHA-256 its manifest names, with its
client. If the request throws (out of reach, or failing), the repair
refuses before anything is stopped or changed, for example: \`The
release of version 1.2.3 could not be reached (could not download
https://127.0.0.1:1/v1.2.3/ovis-server.json (...)), and this checkout
keeps no release binary: Ovis would be stopped for the build, and if the
build failed too, herdr could not start it again until the release can
be reached. So the branch was not built, and nothing was stopped or
changed by this run. Run this again once the release can be reached.\`
With a kept binary that does not pass, the reason names that binary's
folder instead. When the old id's server was stopped for the move, the
refusal says so, with its start (\`$unchanged\`, as the other refusals
since #3929). A 404 (a branch's version has no release) is no reason to
refuse: the stop and the start go to the sources, as before #3940.

What the rule does not tell apart: sources git cannot tie to a release
(changes in \`server/\` or \`shared/\` not committed), whose stop and
start do not ask the release, are refused offline too. That is on the
safe side, since nothing is stopped there either. A kept binary whose
hash passes but whose signature no longer verifies is taken as one the
launcher runs, because install.ps1 does not check that signature (see
the start hint below).

Why this and not restarting the old build after a failed one: restarting
means starting a server from install.ps1 outside herdr's start, over a
build the launcher has already marked \`started\`. Not stopping keeps
the server, its marker and its stamp exactly as they were, which is what
the user had before #3940.

**The start hint after a failed build no longer promises.** install.ps1
checks the kept binary's version, SHA-256 and client, but not its
manifest's signature, which the launcher also checks. The launcher has
no dry check that says whether it would run the kept binary without the
release, and this PR does not invent one. So where \`$keptRuns\` passes,
the hint now reads: \`Until then, herdr plugin action invoke
devswha.ovis.start-windows may start the release's binary this checkout
keeps, if the launcher still accepts it (its signature, which this
installer does not check, included).\` It is no longer \`starts the
release's binary this checkout ran before\`. On main the hint was given
for any kept binary of this version with an executable and a client, a
failing hash included.

### States touched
Run in the VM with the test file's stand-ins, at main (869ec34), at the
first head 2835843 and at this head. Each row has a recorded running
server, packages that load the stop, the marker of this version and a
finished stamp of an earlier commit. The build fails unless the row says
it succeeds.

| state (repair) | before #3940 | main | 2835843 | this head |
|---|---|---|---|---|
| **no kept binary, release out of reach, build failing** | stop to the
sources, build, fails: Ovis stopped (the same as main) | launcher
\`stop,install 1\`; server record gone, marker gone, stamp \`started\`:
\`bun failed (exit 1) building the installed branch, and Ovis is
stopped. Fix the error above, then run this again with
OVIS_REF=feat/windows-install to build it and start Ovis.\` herdr's
start cannot start it offline | the same as main | **refused before the
stop**; launcher not called; server record, marker and stamp \`1.2.3
<commit>\` as they were |
| **no kept binary, release out of reach, build succeeding** | stop,
build, start | \`stop,install 1\`; built, herdr's start invoked (\`herdr
start: True\`) | the same as main | **refused before the stop**, as
above (the installer cannot know the build would succeed offline) |
| **the same with the old id installed (its server stopped for the
move), build failing** | stop, build, fails | \`stop,install 1\`,
"...and Ovis is stopped... The server of the old id was stopped for the
move as well: herdr plugin action invoke
devswha.herdr-web-ui.start-windows starts it again." | the same as main
| refused before this checkout's stop; the message ends "So the branch
was not built, and nothing of the installed plugin was changed by this
run, but the server of the old id was stopped for the move: herdr plugin
action invoke devswha.herdr-web-ui.start-windows starts it again." |
| kept binary of another version, release out of reach | refused (stop
exit 1), nothing stopped | stops, builds; a failed build leaves Ovis
stopped, unstartable offline | refused before the stop | refused before
the stop |
| kept binary of this version failing its hash, release out of reach |
refused, nothing stopped | the same as above, plus a start hint that
does not work | refused before the stop | refused before the stop |
| either of these, or no kept binary, release out of reach, packages
that do not load the stop | stop fails or cannot run; refused ("remove
that folder"), or built where nothing ran | the same | refused before
the stop (kept binary only) | refused before the stop; the marker is
kept |
| kept binary that passes \`$keptRuns\`, release out of reach, failed
build | stop through the binary, build | the same, with "starts the
release's binary" | the same | the same, with "may start ..., if the
launcher still accepts it" |
| release in reach (a 404 included), any kept binary or none | stop,
build | the same | the same | the same; the release is asked once first
|
| any state refused before the repair (another ref, git failing or
distrusting, no commit, GitHub out of reach for a branch) | unchanged |
unchanged | unchanged | unchanged (the probe comes after those refusals)
|

## 2. Quoting in printed commands
The rebuild command after a build during which the version moved put the
launcher's path in single quotes without doubling an apostrophe. Pasted
for `C:\Users\John O'Brien\...` into Windows PowerShell 5.1 (VM), main's
line `$env:OVIS_FROM_SOURCE = '1'; bun 'C:\...\John O'Brien\herdr
plugin\scripts\plugin-launch.ts' install` ran nothing: the string never
closes. This PR's line, `... bun 'C:\...\John O''Brien\herdr
plugin\scripts\plugin-launch.ts' install`, pasted the same way, ran
`C:\...\John O'Brien\herdr plugin\scripts\plugin-launch.ts install with
OVIS_FROM_SOURCE=1`. That run used a stand-in launcher that prints its
argv and environment.

`Get-BuildCommand` quotes it as `Get-TrustCommand` does. A new case
parses its line with PowerShell's parser for paths with a space, with an
apostrophe, and with two apostrophes. It requires `OVIS_FROM_SOURCE` set
to `1` and `bun <path> install`, with the path as one argument.

Every other command install.ps1 prints:
| command | verdict |
|---|---|
| build command in the "git could not read the commit" refusal (`bun
'$launcherScript' install`) | same fault: fixed (`Get-BuildCommand`) |
| `Get-CimInstance Win32_Process \| Where-Object CommandLine -like
'*<root>*'` after a failed build | same fault: apostrophes now doubled,
and since the second head the path is passed through
`[WildcardPattern]::Escape` first, so brackets in a folder name are not
taken as a wildcard (a case runs the repair from `[x] it's a plugin`: at
2835843 the printed pattern `'*...\[x] it''s a plugin*'` does not match
that folder; at this head it does, and does not match `x it's a plugin`)
|
| `git config --global --add safe.directory '<folder>'` | already right
(`Get-TrustCommand`) |
| `Get-CimInstance Win32_Process -Filter 'ProcessId=<id>'`,
`Stop-Process -Id <id>` | a number, no path: fine |
| `herdr plugin action invoke <id>.start-windows` / `stop-windows`,
`herdr plugin log list` | no path: fine |
| `$env:OVIS_FROM_SOURCE = '1'; herdr plugin install devswha/ovis --ref
<ref> --yes` | not a path; a ref is printed bare (git refs have no
spaces). Left |
| `ssh -L <port>:127.0.0.1:<port> <this-pc>` | no path: fine |

## 3. The message as steps
The message for a build during which the checkout's version moved now
ends `To build it, stop Ovis, build it, then start it:` followed by
three lines, one command each. The commands are the stop action, the
build command and the start action, as the trust command is printed on a
line of its own. The test reads the three lines and parses the middle
one.

## Validation
This head was run in the Windows VM: Windows 11, Windows PowerShell 5.1,
a fresh clone of main 869ec34 under \`%TEMP%\` with this head's files
copied in, in the desktop session with \`CI=true\` and
\`HERDR_TEST_MODE=unit\` as the job runs it. The command was
\`powershell -NoProfile -ExecutionPolicy Bypass -File
scripts/windows-install.test.ps1\`:
- unpadded (PATH 335 characters): every PASS line, exit 0 (69 s);
- PATH padded to 2700 characters: every PASS line, exit 0 (70 s).

Counting copy (Assert counts instead of throwing):
| install.ps1 | test file | pass | fail |
|---|---|---|---|
| 2835843 | its own | 247 | 3 |
| 2835843 | this head's | 248 | 7 |
| this head | this head's | 252 | 3 |

In every run, the 3 are the gh ordering negative control's intended
failures, which throw in the real file and are caught there.

At 2835843 with this head's test, the 4 others fail: the three
no-kept-binary rows above, and the bracket hint. At main with this
head's test, those fail too, together with the first head's cases, and
the run ends at the missing \`Get-BuildCommand\`.

Also from the first head, still true: real \`bun install\` with the
registry out of reach exits 1 and leaves \`node_modules\` as it was; the
real launcher's \`start\` in the state main leaves exits 1 with nothing
started; the printed build command pasted into Windows PowerShell 5.1
runs for a path with an apostrophe, where main's line runs nothing.

\`bun run check fast\` (through heavy-run.sh) on this tree (main
869ec34 + this PR): exit 0, `unit: 17643 pass, 0 fail, 54 skip in 973
files`, typecheck, build, workflow syntax and generated files ok. (Main
has moved to e5c6a8e since; its two commits touch none of these
files.).

Not run:
- a real Ovis server stopped or started by the repair (forbidden on this
PC; the stand-ins cover it);
- the real launcher's \`stop\`, which this PR does not change;
- macOS and Linux, where nothing changes.
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