Skip to content

fix(install): the installer survives an ordinary current machine — no Docker, no storage key, no wmic - #3739

Merged
joelteply merged 1 commit into
canaryfrom
fix/installer-survives-an-ordinary-fresh-machine
Sep 5, 2026
Merged

joelteply merged 1 commit into
canaryfrom
fix/installer-survives-an-ordinary-fresh-machine

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Three defects on the fresh-install path (install.sh → lib/install-common.sh). All three fire on an ordinary machine that a stranger would install onto; none fires on the boxes the three of us have been running all night, which is why they survived.

Not a #3736 regression

tools/scripts/install.sh line 26 has carried set -eo pipefail since d9cd959 (2026-07-05) and sources this library into that shell. So sites 1 and 2 have been live for two months, and #3738's revert of pipefail from the set -e scripts does not reach them — install-common.sh is a sourced library that sets no -e of its own, and its caller supplies it.

That also makes install.sh the useful counter-example for the ratchet: pipefail is not the hazard, an unaudited site is.

The three

# Site Trigger on a fresh machine Measured
1 mod_cold_storage config.env exists but has no CONTINUUM_STORAGE_PATH line — grep exits 1 exit 1
2 mod_docker_wsl Docker Desktop not installed for the Windows user — ls exits 2 exit 2
3 ic_detect_hardware RAM arm wmic removed in Windows 11 24H2 → IC_RAM_MIB=0 on a 64 GB box 0 vs 64914 MiB

1 and 2 share one shape: a pipeline whose empty result the very next line was already written to handle. In #2 that next line is a module_fail that names the exact cause ("Is Docker Desktop installed for the Windows user?") — so the installer died one line before it could explain itself. Guarded with || true plus a comment naming the already-handled empty case, per the burn-down rule: read a piped substitution with its next line, then either guard it with a stated reason or let it fail honestly.

3 is a different class — not a crash, a confident wrong number. The replaced comment called wmic "the most portable across Windows versions (Win10 + Win11)", which was true when written and is backwards now. wmic stays first (still present and fast on Win10 and pre-24H2 Win11); PowerShell CIM is the fallback. A non-numeric reading now warns instead of silently becoming 0, because "we could not look" is a different fact from "this machine has no RAM" and IC_RAM_MIB has one representation for both.

Verification

Windows 11 26200 / Git Bash, old vs new line through the same harness:

cold-storage   old exit 1   ->  new exit 0
docker         old exit 2   ->  new exit 0
RAM arm        old IC_RAM_MIB=0  ->  new IC_RAM_MIB=64914  (63 GB)
bash -n        OK

Six further candidates I flagged in the same file did not survive inspection and are not in this diff — the wmic/nvidia-smi/vulkaninfo probes all sit behind command -v X and an X … >/dev/null success check, so the command exists and has already succeeded before the substitution runs. I read those lines before I read their guards.

Caveat on validation

This checkout has no .git/hooks/pre-commit installed, so the shared hook did not run on this commit. Not bypassed with --no-verify — it simply is not wired here, which I am reporting separately. Treat CI, not my local commit, as the gate.

Follow-up to #3736 / #3738; independent of both.

@joelteply

Copy link
Copy Markdown
Contributor Author

M5-core review: NO OBJECTION. The diff changes three sites, each with a || true and a reason written at the site: the cold-storage key grep (absent key is the normal first-run state), the Docker Desktop settings lookup (absent Docker is normal), and the Windows RAM arm (wmic gone in 24H2 → CIM fallback, with a representation for 'could not measure' distinct from zero — that last part is the absence-read-as-a-value fix, not just a guard). The macOS arm (sysctl hw.memsize) is untouched, so this box adds no receipt beyond that; the old-vs-new harness numbers on the 26200/Git Bash box are the measurement, and IntelMac ran the other arms' failure shapes. Merge on green.

@joelteply
joelteply enabled auto-merge (squash) September 5, 2026 07:01
Three defects on the FRESH-INSTALL path (install.sh -> lib/install-common.sh).
None is a #3736 regression: install.sh has run `set -eo pipefail` on line 26
since d9cd959 (2026-07-05) and sources this library into that shell, so the
first two have been live for two months and reverting pipefail from the -e
scripts does not reach them.

1+2. TWO PIPELINES ABORT THE INSTALL, both the same shape — a pipeline whose
EMPTY result the very next line was already written to handle:

  mod_cold_storage   grep exits 1 when config.env has no CONTINUUM_STORAGE_PATH
                     line, the ordinary state of a config.env an earlier install
                     step wrote. Next line is `[ -n "$existing" ]`. Measured: 1.

  mod_docker_wsl     ls exits 2 with no Docker Desktop installed for the Windows
                     user. Next line is `[ -z "$settings" ]` guarding a
                     module_fail that names that exact cause — so the script died
                     one line before it could explain itself. Measured: exit 2.

Guarded with `|| true` plus a comment naming the already-handled empty case, per
the burn-down rule: read a piped substitution WITH ITS NEXT LINE, then either
guard it with a stated reason or let it fail honestly.

3. RAM DETECTION REPORTS ZERO ON WINDOWS 11 24H2+. The arm gates on
`command -v wmic`, and WMIC WAS REMOVED IN 24H2 — on 26200 it is absent, so the
else-branch set IC_RAM_MIB=0 on a machine with 64914 MiB and every RAM-based
tier decision downstream was made on that zero. The replaced comment called wmic
"the most portable across Windows versions", true when written and backwards
now. wmic stays first (still present and fast on Win10 and pre-24H2 Win11);
PowerShell CIM is the fallback. A non-numeric reading now WARNS rather than
silently becoming 0, because "we could not look" is a different fact from "this
machine has no RAM" and IC_RAM_MIB has one representation for both.

Verified on Windows 11 26200 / Git Bash, old vs new through the same harness:
cold-storage old exit 1 / new exit 0; docker old exit 2 / new exit 0; RAM arm
old IC_RAM_MIB=0 / new IC_RAM_MIB=64914.

NOT verified by the shared precommit hook: this checkout has no
.git/hooks/pre-commit installed, so the hook did not run on this commit. Flagged
separately; not bypassed with --no-verify.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
@joelteply
joelteply force-pushed the fix/installer-survives-an-ordinary-fresh-machine branch from 37492f2 to 622fef7 Compare September 5, 2026 07:08
@joelteply
joelteply merged commit 6c0a5d1 into canary Sep 5, 2026
7 checks passed
@joelteply
joelteply deleted the fix/installer-survives-an-ordinary-fresh-machine branch September 5, 2026 07:20
joelteply added a commit that referenced this pull request Sep 5, 2026
… three

The Windows leg failed on its own mutation step, and the failure was correct.

My first cut patched the two expression shapes I could see from a Mac —
macOS's `IC_RAM_MIB=$(( $(sysctl …) ))` and Linux's `IC_RAM_MIB=$(awk …)`.
Windows's arm is a `case` over a captured variable since #3739, so neither
pattern matched, nothing was mutated, the assertions passed unchanged, and the
step reported exactly what had happened:

    host-detect-assert did NOT fail with RAM forced to 0 — the gate is dead.

That is the mutation step catching a hole in the mutation step. It is also the
same defect the whole PR is about, committed by me while writing the PR: I
wrote a check against the platforms I could see and shipped it to three.

Now patches by LINE rather than by expression — every `IC_RAM_MIB=` assignment
becomes 0 regardless of the shape the platform's arm happens to use — and
prints the count of mutated lines so a future no-op is visible in the log
instead of inferred from a passing gate. Verified locally: 4 lines mutated,
assert exits 1, restore exits 0.

WHAT THE WINDOWS LEG ALREADY PROVED, and it is the point of the matrix: its
ASSERTIONS all passed. `IC_PLATFORM=windows` on MINGW64_NT-10.0-26100, RAM a
positive integer, gpu_kind `none`. So #3739's Get-CimInstance fallback works on
a real 24H2-era runner — measured on a platform none of us can run, by the leg
that exists for that reason, on its first execution.

Card b2e4a0bb.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Sep 5, 2026
Second failure of the same kind, and the lesson is the PR's own thesis pointed
at me twice.

The mutation step must prove this gate can fail. My first cut patched the two
RAM-assignment shapes I could see from a Mac; Windows uses a `case` over a
captured variable since #3739, so nothing was mutated and the step reported the
gate dead. I fixed that with a line-wise regex — which patched four lines and
STILL left Windows reporting 16378 MiB, because replacing a whole line inside a
`case` arm does not do what replacing an assignment does.

Twice I wrote a platform-shaped mutation from the one platform I have, and both
times the thing that caught it was the mutation step refusing to pass. That is
the same defect this PR exists to prevent — a check written against the
platforms its author can see — committed inside the check itself.

So the defect is now injected where every platform CONVERGES: a
`HOST_DETECT_MUTATE_RAM` hook in the assert script, applied after
`ic_detect_hardware` returns and before the assertions run. Shape-independent,
cannot silently miss an arm, and it lives in CI scaffolding rather than in a
sed over production source — install-common.sh is no longer touched by the
test at all.

Verified locally, both directions:
    MUTATION: forcing IC_RAM_MIB=0 (was 32768)
    FAIL ram — IC_RAM_MIB=0 — a host with no readable RAM figure will be
               mis-tiered, silently
    mutated exit=1   clean exit=0

Card b2e4a0bb.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Sep 5, 2026
ce8b9074's gap on #3748, and it lands on a claim I had already made without
checking.

I said the green Windows leg "confirms #3739's Get-CimInstance fallback works
on a real 24H2-era runner". That is only true IF `wmic` was absent. `wmic` was
removed in Windows 11 24H2, but a runner that still has it takes the LEGACY arm
— the leg would pass, prove the old path, and say nothing about the fix. A
passing RAM check reports the answer, never how it was obtained, and I filled
in the how from what I wanted it to mean.

The leg now prints the precondition, so the log answers the question instead of
the reader assuming:

    wmic PRESENT — the RAM figure came from the legacy wmic arm; this run does
                   NOT exercise the Get-CimInstance fallback (#3739)
    wmic ABSENT (removed in Win11 24H2) — the RAM figure came from the
                   Get-CimInstance fallback (#3739)

with the equivalent one-liner for the macOS sysctl and Linux /proc/meminfo arms,
so every platform's log says which code actually ran.

ON THE SECOND GAP (unconditional restore): already closed by the previous
commit rather than by this one. The mutation moved from patching
install-common.sh to a HOST_DETECT_MUTATE_RAM hook in the assert script, so the
workflow no longer copies, edits or restores production source at all — there
is nothing left to restore conditionally or otherwise. Verified: no `cp` of a
backup remains in the workflow.

Card b2e4a0bb.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply added a commit that referenced this pull request Sep 5, 2026
…he one (#3748)

* ci(install): assert host detection on all three platforms, not just the one

`carl-install-smoke` is our only install check and it is `runs-on:
ubuntu-latest` with no matrix. So the install path is verified on exactly one
platform — and in one night every detect_host bug found on the other two was
invisible to it:

  - Windows 11 24H2 REMOVED `wmic`, so the RAM arm fell through to its else
    branch and recorded IC_RAM_MIB=0 on a machine with 64914 MiB. Every
    downstream tier decision then ran on that zero, silently (#3739).
  - The Intel-Mac arm builds llama-server CPU-only because a Metal build hangs
    that hardware uninterruptibly — and nothing recorded that as the host's
    serving PLAN, so the backend receipt refused a healthy node and advised
    reinstalling with Metal, which would have hung it again (#3729 → #3740).
  - The Linux/WSL RAM arm still turns an unreadable /proc/meminfo into 0 with no
    warning: the same defect as the Windows one, on the platform CI DOES run,
    unnoticed because nothing asserted the value.

Each was a detect_host fact being WRONG rather than missing, on a platform its
author could not run. Three operators, three boxes, and the shared CI checking
the tier none of them installs on.

NOT A MATRIX ON carl-install-smoke: that job is Docker-based and ~30 minutes.
`install-common.sh` is sourceable and `ic_detect_hardware` is a pure probe of
the machine it runs on, so a per-platform leg needs no Docker, no images and no
registry auth — seconds, not half an hour. The Docker smoke stays the Linux
end-to-end check; this is the cross-platform truth check.

Assertions are about SHAPE, not hardware. A CI runner is none of our boxes and
a test expecting an M5 or a 5090 fails for the wrong reason. What must hold
everywhere is that the detector produced a DETERMINATE answer rather than a
silent placeholder: platform recognised, RAM a positive integer, arch known,
gpu_kind one of the declared values INCLUDING `none` — because "no GPU" and "we
did not look" are different facts, and conflating them is what made the backend
receipt refuse a working CPU-by-plan host.

The Windows leg runs under Git Bash, which is the shell install.sh actually
uses there (uname -s reports MINGW64_NT-...), so it exercises the real branch
rather than a WSL or PowerShell approximation. `fail-fast: false` because the
point is to learn what ALL three report — failing fast would hide the second
bug behind the first, which is how these stayed hidden.

The job also runs a MUTATION step: force the RAM arm to the silent-zero shape
that shipped on 24H2, assert the leg goes red, restore. Verified by hand on
this Intel Mac before commit — mutated exit 1 with "IC_RAM_MIB=0 — a host with
no readable RAM figure will be mis-tiered, silently", restored exit 0. Written
after finding twice in one night that a green check can mean the checker never
ran (a crashed linter counted as zero errors; a pipe returned tail's exit
status instead of cargo's).

Both triggers carry the same paths filter, per the comment on
ts-persona-forbidden-strings-ratchet.yml where a missing filter on `push`
produced 100/100 red and taught everyone to ignore the X.

Card b2e4a0bb.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(ci): the mutation must patch EVERY platform's RAM arm, not two of three

The Windows leg failed on its own mutation step, and the failure was correct.

My first cut patched the two expression shapes I could see from a Mac —
macOS's `IC_RAM_MIB=$(( $(sysctl …) ))` and Linux's `IC_RAM_MIB=$(awk …)`.
Windows's arm is a `case` over a captured variable since #3739, so neither
pattern matched, nothing was mutated, the assertions passed unchanged, and the
step reported exactly what had happened:

    host-detect-assert did NOT fail with RAM forced to 0 — the gate is dead.

That is the mutation step catching a hole in the mutation step. It is also the
same defect the whole PR is about, committed by me while writing the PR: I
wrote a check against the platforms I could see and shipped it to three.

Now patches by LINE rather than by expression — every `IC_RAM_MIB=` assignment
becomes 0 regardless of the shape the platform's arm happens to use — and
prints the count of mutated lines so a future no-op is visible in the log
instead of inferred from a passing gate. Verified locally: 4 lines mutated,
assert exits 1, restore exits 0.

WHAT THE WINDOWS LEG ALREADY PROVED, and it is the point of the matrix: its
ASSERTIONS all passed. `IC_PLATFORM=windows` on MINGW64_NT-10.0-26100, RAM a
positive integer, gpu_kind `none`. So #3739's Get-CimInstance fallback works on
a real 24H2-era runner — measured on a platform none of us can run, by the leg
that exists for that reason, on its first execution.

Card b2e4a0bb.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* fix(ci): inject the mutation at one point, not per-platform regexes

Second failure of the same kind, and the lesson is the PR's own thesis pointed
at me twice.

The mutation step must prove this gate can fail. My first cut patched the two
RAM-assignment shapes I could see from a Mac; Windows uses a `case` over a
captured variable since #3739, so nothing was mutated and the step reported the
gate dead. I fixed that with a line-wise regex — which patched four lines and
STILL left Windows reporting 16378 MiB, because replacing a whole line inside a
`case` arm does not do what replacing an assignment does.

Twice I wrote a platform-shaped mutation from the one platform I have, and both
times the thing that caught it was the mutation step refusing to pass. That is
the same defect this PR exists to prevent — a check written against the
platforms its author can see — committed inside the check itself.

So the defect is now injected where every platform CONVERGES: a
`HOST_DETECT_MUTATE_RAM` hook in the assert script, applied after
`ic_detect_hardware` returns and before the assertions run. Shape-independent,
cannot silently miss an arm, and it lives in CI scaffolding rather than in a
sed over production source — install-common.sh is no longer touched by the
test at all.

Verified locally, both directions:
    MUTATION: forcing IC_RAM_MIB=0 (was 32768)
    FAIL ram — IC_RAM_MIB=0 — a host with no readable RAM figure will be
               mis-tiered, silently
    mutated exit=1   clean exit=0

Card b2e4a0bb.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* ci(install): the leg reports WHICH arm produced the RAM figure

ce8b9074's gap on #3748, and it lands on a claim I had already made without
checking.

I said the green Windows leg "confirms #3739's Get-CimInstance fallback works
on a real 24H2-era runner". That is only true IF `wmic` was absent. `wmic` was
removed in Windows 11 24H2, but a runner that still has it takes the LEGACY arm
— the leg would pass, prove the old path, and say nothing about the fix. A
passing RAM check reports the answer, never how it was obtained, and I filled
in the how from what I wanted it to mean.

The leg now prints the precondition, so the log answers the question instead of
the reader assuming:

    wmic PRESENT — the RAM figure came from the legacy wmic arm; this run does
                   NOT exercise the Get-CimInstance fallback (#3739)
    wmic ABSENT (removed in Win11 24H2) — the RAM figure came from the
                   Get-CimInstance fallback (#3739)

with the equivalent one-liner for the macOS sysctl and Linux /proc/meminfo arms,
so every platform's log says which code actually ran.

ON THE SECOND GAP (unconditional restore): already closed by the previous
commit rather than by this one. The mutation moved from patching
install-common.sh to a HOST_DETECT_MUTATE_RAM hook in the assert script, so the
workflow no longer copies, edits or restores production source at all — there
is nothing left to restore conditionally or otherwise. Verified: no `cp` of a
backup remains in the workflow.

Card b2e4a0bb.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant