Skip to content

fix(infra): use sw_vers productVersion for macOS release on Darwin 25+#95157

Closed
ZOOWH wants to merge 2 commits into
openclaw:mainfrom
ZOOWH:fix/95145-darwin-macos-version
Closed

fix(infra): use sw_vers productVersion for macOS release on Darwin 25+#95157
ZOOWH wants to merge 2 commits into
openclaw:mainfrom
ZOOWH:fix/95145-darwin-macos-version

Conversation

@ZOOWH

@ZOOWH ZOOWH commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • os.release() returns the Darwin kernel version (e.g. "25.5.0") which no longer matches the macOS marketing version starting with macOS 26 (Tahoe / Darwin 25). The actual macOS version is "26.5.1" (via sw_vers -productVersion).
  • Export resolveOsRelease() that prefers sw_vers -productVersion on Darwin, falling back to os.release() if sw_vers is unavailable. On other platforms, returns os.release() unchanged.
  • Export resolveRuntimeOsLabel() that returns "macos <version>" on Darwin and os.type() + os.release() on other platforms.
  • Use resolveOsRelease() for the OsSummary.release field so openclaw status, diagnostics, and host detection report the correct macOS version.
  • Replace os.type() + os.release() in all three runtime prompt paths (cli-runner/helpers.ts, attempt.ts, compact.ts) with resolveRuntimeOsLabel() so agent context shows the correct macOS product version instead of raw Darwin kernel version.
  • 12 unit tests pass: resolveOsRelease (darwin with sw_vers, darwin fallback, linux, win32) + resolveRuntimeOsLabel (darwin with sw_vers, darwin fallback, linux, win32) + resolveOsSummary (4 cases via it.each)

Files changed

File Change
src/infra/os-summary.ts Export resolveOsRelease() and resolveRuntimeOsLabel(), use resolveOsRelease() in OsSummary.release
src/agents/cli-runner/helpers.ts Replace `${os.type()} ${os.release()}` with resolveRuntimeOsLabel()
src/agents/embedded-agent-runner/run/attempt.ts Replace `${os.type()} ${os.release()}` with resolveRuntimeOsLabel()
src/agents/embedded-agent-runner/compact.ts Replace `${os.type()} ${os.release()}` with resolveRuntimeOsLabel()
src/infra/os-summary.test.ts Add tests for resolveOsRelease() and resolveRuntimeOsLabel(), update resolveOsSummary test data

Real behavior proof

Behavior addressed: Darwin kernel version 25.x is incorrectly mapped to macOS 15.x instead of macOS 26 (Tahoe). Both the OsSummary.release field and the runtime prompt os field expose raw Darwin kernel versions instead of the macOS marketing version.

Environment tested: Node v24.13.1 on Linux, vitest run with mocked platform/release/sw_vers + node --import tsx calling real production functions.

Steps run after the patch:

# Unit tests
node_modules/.bin/vitest run src/infra/os-summary.test.ts

# Production function verification
node --import tsx --no-warnings -e "
import { resolveOsRelease, resolveRuntimeOsLabel, resolveOsSummary } from './src/infra/os-summary.ts';
console.log('resolveOsRelease:', resolveOsRelease());
console.log('resolveRuntimeOsLabel:', resolveRuntimeOsLabel());
console.log('resolveOsSummary:', JSON.stringify(resolveOsSummary()));
"

Evidence after fix:

Unit test results (12/12 pass):

 ✓ resolveOsRelease > returns sw_vers productVersion on darwin
 ✓ resolveOsRelease > falls back to os.release on darwin when sw_vers output is blank
 ✓ resolveOsRelease > returns os.release unchanged on linux
 ✓ resolveOsRelease > returns os.release unchanged on win32
 ✓ resolveRuntimeOsLabel > returns macos label with sw_vers productVersion on darwin
 ✓ resolveRuntimeOsLabel > falls back to Darwin kernel version on darwin when sw_vers is blank
 ✓ resolveRuntimeOsLabel > returns os.type plus os.release on linux
 ✓ resolveRuntimeOsLabel > returns os.type plus os.release on win32
 ✓ resolveOsSummary > formats darwin labels from sw_vers output and uses productVersion as release
 ✓ resolveOsSummary > falls back to os.release when sw_vers output is blank
 ✓ resolveOsSummary > formats windows labels from os metadata
 ✓ resolveOsSummary > formats non-darwin labels from os metadata

 Test Files  1 passed (1)
      Tests  12 passed (12)

Production function output on Linux host:

resolveOsRelease: 4.19.112-2.el8.x86_64
resolveRuntimeOsLabel: Linux 4.19.112-2.el8.x86_64
resolveOsSummary: {"platform":"linux","arch":"x64","release":"4.19.112-2.el8.x86_64","label":"linux 4.19.112-2.el8.x86_64 (x64)"}

Expected on macOS 26 Tahoe (Darwin 25.5.0, sw_vers returns 26.5.1):

resolveOsRelease():         "26.5.1" (instead of "25.5.0")
resolveRuntimeOsLabel():    "macos 26.5.1" (instead of "Darwin 25.5.0")
resolveOsSummary().release: "26.5.1" (instead of "25.5.0")
resolveOsSummary().label:   "macos 26.5.1 (arm64)" (unchanged, already correct on main)

What was not tested: Live macOS 26 Tahoe host (no access). The Darwin path uses the same sw_vers -productVersion mechanism already validated by the existing resolveOsSummary() label and system-presence.ts.

Closes #95145

@clawsweeper

clawsweeper Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 19, 2026, 10:27 PM ET / 02:27 UTC.

Summary
The PR adds shared macOS product-version helpers backed by sw_vers, uses them for OS summary release values and agent runtime prompt OS labels, and expands OS-summary unit coverage.

PR surface: Source +38, Tests +99. Total +137 across 5 files.

Reproducibility: yes. from source inspection and the linked report. Current main and v2026.6.8 still expose raw Darwin release values in OsSummary.release and runtime prompt OS fields, while the reporter provided sw_vers 26.5.1 versus Darwin 25.5.0 data.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #95145
Summary: This PR is a candidate fix for the open macOS 26/Darwin 25 host metadata bug, with several open overlapping PRs that are not merged and therefore do not supersede it.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted macOS 26/OpenClaw terminal output, logs, screenshot, or recording showing resolveOsSummary or an actual status/runtime prompt path after the patch.
  • Update the PR body after adding proof; if ClawSweeper does not re-review automatically, ask a maintainer to comment @clawsweeper re-review.
  • [P1] Have maintainers choose or consolidate the canonical fix among the overlapping open PRs before merge.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body has Linux terminal output and mocked Darwin tests, but no redacted real macOS 26/OpenClaw terminal output, logs, screenshot, or recording showing the corrected after-fix metadata; private IPs, keys, phone numbers, non-public endpoints, and other private details should be redacted before posting proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The contributor proof does not show corrected macOS 26/Tahoe metadata in a real OpenClaw run, so the external-PR proof gate is still unmet.
  • [P1] Several open PRs target the same linked issue; maintainers should choose or consolidate the canonical branch before merging and closing the bug.
  • [P1] Merging this branch moves a synchronous sw_vers lookup into first-use agent runtime prompt construction on macOS; the cache limits repeat cost, but green CI does not prove the real macOS availability behavior.

Maintainer options:

  1. Add real macOS proof before merge (recommended)
    Have the contributor add redacted macOS 26/OpenClaw terminal output, logs, screenshot, or recording showing corrected status or runtime prompt metadata after this patch.
  2. Accept the cached sw_vers runtime dependency
    Maintainers may decide the single cached synchronous lookup is acceptable because it reuses the existing product-version source and falls back to os.release().
  3. Consolidate the overlapping fixes
    Pause this PR until maintainers choose one branch or replacement that covers both OS-summary release metadata and runtime prompt metadata.

Next step before merge

  • [P1] Maintainers need contributor-supplied real macOS proof and a canonical choice among overlapping open PRs; there is no safe automated repair for the proof or branch-selection blocker.

Security
Cleared: No concrete security or supply-chain concern was found; the diff adds no dependencies, workflows, permissions, or secret handling, and the invoked command is fixed rather than user-controlled.

Review details

Best possible solution:

Land one canonical cached macOS product-version fix that covers both status release metadata and runtime prompt metadata, with redacted real macOS/OpenClaw proof, then reconcile the overlapping candidate PRs.

Do we have a high-confidence way to reproduce the issue?

Yes from source inspection and the linked report. Current main and v2026.6.8 still expose raw Darwin release values in OsSummary.release and runtime prompt OS fields, while the reporter provided sw_vers 26.5.1 versus Darwin 25.5.0 data.

Is this the best way to solve the issue?

Yes as a code direction: a shared macOS product-version helper covering both OS summary release and runtime prompt labels is the narrowest maintainable fix. The PR still needs real macOS proof and maintainer consolidation among overlapping candidate PRs before merge.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 3518fa575a2f.

Label changes

Label justifications:

  • P2: This is a normal-priority macOS host metadata correctness bug with limited blast radius but real impact on Tahoe status output and agent runtime context.
  • merge-risk: 🚨 availability: The diff adds a synchronous sw_vers product-version lookup to macOS agent runtime prompt construction, and CI does not prove that first-use runtime behavior on a real Tahoe host.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body has Linux terminal output and mocked Darwin tests, but no redacted real macOS 26/OpenClaw terminal output, logs, screenshot, or recording showing the corrected after-fix metadata; private IPs, keys, phone numbers, non-public endpoints, and other private details should be redacted before posting proof. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +38, Tests +99. Total +137 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 4 43 5 +38
Tests 1 105 6 +99
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 148 11 +137

What I checked:

  • Repository policy read: Root AGENTS.md and scoped agent-runner AGENTS.md files were read fully; the review applied the repository's deep PR review, best-fix, scoped agent helper-test, and contributor real behavior proof guidance. (AGENTS.md:1, 3518fa575a2f)
  • Current main OS summary release behavior: Current main already uses sw_vers for the macOS label, but resolveOsSummary() still returns the raw os.release() value as release, so Darwin 25.x remains exposed through that field. (src/infra/os-summary.ts:42, 3518fa575a2f)
  • Current main runtime prompt behavior: Current main still passes ${os.type()} ${os.release()} into runtime prompt metadata in the CLI runner, embedded attempt runner, and compaction path, so a Tahoe host would expose Darwin 25.5.0 in those agent context lines. (src/agents/embedded-agent-runner/run/attempt.ts:1936, 3518fa575a2f)
  • Prompt callee uses the supplied OS value: buildRuntimeLine() renders runtimeInfo.os directly into the prompt runtime line and appends architecture, so the PR's changed OS label feeds a visible agent-context field. (src/agents/system-prompt.ts:1404, 3518fa575a2f)
  • PR diff code direction: The PR routes the three prompt call sites through resolveRuntimeOsLabel() and changes OsSummary.release to use a macOS-aware release helper, with tests covering Darwin sw_vers, fallback, Linux, and Windows cases. (src/infra/os-summary.ts:15, ed3d8fd36737)
  • Contributor proof gap: The PR body reports Linux terminal output plus mocked Darwin unit tests and explicitly says no live macOS 26 Tahoe host was tested, so the changed macOS/OpenClaw behavior is not shown in a real setup. (ed3d8fd36737)

Likely related people:

  • vincentkoc: Current-main blame for the OS-summary helper and the three runtime prompt OS fields points to Vincent Koc, and recent history carries these files through the broad source commit. (role: recent area contributor; confidence: medium; commits: 3c3f1010aae4, 844f405ac1be; files: src/infra/os-summary.ts, src/infra/system-presence.ts, src/agents/cli-runner/helpers.ts)
  • steipete: Symbol history for macOS product-version presence/status behavior and earlier agent/runtime file splitting points to Peter Steinberger as a likely routing candidate for the OS metadata boundary. (role: adjacent owner; confidence: medium; commits: 3bb4c0c2370d, 1eb50ffac476, bcbfb357bec7; files: src/infra/system-presence.ts, src/infra/os-summary.ts, src/agents/embedded-agent-runner/run/attempt.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jun 20, 2026
@ZOOWH
ZOOWH requested a review from a team as a code owner June 20, 2026 01:44
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling extensions: qa-lab size: XL and removed size: S labels Jun 20, 2026
@ZOOWH

ZOOWH commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@ZOOWH
ZOOWH force-pushed the fix/95145-darwin-macos-version branch from 9ae3010 to 6204076 Compare June 20, 2026 01:47
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed scripts Repository scripts commands Command implementations docker Docker and sandbox tooling extensions: qa-lab size: XL labels Jun 20, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 20, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jun 20, 2026
On macOS 26 (Tahoe), Darwin kernel version 25.x no longer maps to the
macOS marketing version 26.x. os.release() returns "25.5.0" while the
actual product version is "26.5.1". The runtime prompt paths in
cli-runner/helpers.ts, attempt.ts, and compact.ts directly concatenated
os.type() + os.release(), producing "Darwin 25.5.0" in agent runtime
context instead of the correct "macos 26.5.1".

- Export resolveOsRelease() that prefers sw_vers -productVersion on
  Darwin, falling back to os.release() if sw_vers is unavailable.
- Export resolveRuntimeOsLabel() that returns "macos <version>" on
  Darwin and os.type() + os.release() on other platforms.
- Use resolveOsRelease() for OsSummary.release so openclaw status and
  diagnostics report the correct macOS version.
- Replace os.type() + os.release() in all three runtime prompt paths
  with resolveRuntimeOsLabel() so agent context shows the correct macOS
  product version instead of raw Darwin kernel version.
- Add unit tests for resolveOsRelease() and resolveRuntimeOsLabel()
  covering darwin with sw_vers, darwin fallback, linux, and win32.
- Update resolveOsSummary test to verify release field uses
  resolveOsRelease() on darwin.

Closes openclaw#95145
@ZOOWH
ZOOWH force-pushed the fix/95145-darwin-macos-version branch from 6204076 to a9772f8 Compare June 20, 2026 02:12
@ZOOWH

ZOOWH commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of stronger candidates — #95189 (🦐 gold shrimp) is closer to merge and I cannot provide live macOS proof to clear the needs-proof gate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Darwin kernel version 25.x incorrectly mapped to macOS 15.x (should be macOS 26 / Tahoe)

1 participant