Skip to content

fix(infra): resolve macOS product version via sw_vers for runtime prompt#95158

Closed
lzyyzznl wants to merge 1 commit into
openclaw:mainfrom
lzyyzznl:fix/issue-95145-darwin-kernel-version-mapping
Closed

fix(infra): resolve macOS product version via sw_vers for runtime prompt#95158
lzyyzznl wants to merge 1 commit into
openclaw:mainfrom
lzyyzznl:fix/issue-95145-darwin-kernel-version-mapping

Conversation

@lzyyzznl

Copy link
Copy Markdown
Contributor

Summary

On macOS 26 (Tahoe), Darwin kernel version 25.x no longer maps to macOS marketing version 26.x — os.release() returns 25.5.0 while the actual product version is 26.5.1. The runtime prompt paths (cli-runner/helpers.ts, attempt.ts, 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.

The fix adds resolveRuntimeOsLabel() to src/infra/os-summary.ts that uses sw_vers -productVersion on Darwin (matching the pattern already used by resolveOsSummary() and system-presence.ts) and falls back to the existing format on other platforms. All three runtime prompt callers are updated to use this shared function.

Fixes #95145

Real behavior proof

Behavior addressed: On macOS 26 (Tahoe) hosts, agent runtime prompts now show the correct macOS product version (e.g. "macOS 26.5.1") instead of the Darwin kernel version (e.g. "Darwin 25.5.0").

Real environment tested: Linux 6.8.0 (Node v24), macOS verification relies on the same sw_vers -productVersion mechanism already proven by resolveOsSummary() and system-presence.ts

Exact steps or command run after this patch: node -e "console.log(require('os').type(), require('os').release())" + pnpm tsgo + pnpm test src/infra/os-summary.test.ts + pnpm test src/agents/system-prompt-params.test.ts

After-fix evidence:

$ node -e "console.log(require('os').type(), require('os').release())"
Linux 6.8.0-124-generic

$ node -e "
const os = require('os');
const platform = os.platform();
const release = os.release();
const type = os.type();
console.log('Platform:', platform, '| os.type():', type, '| os.release():', release);
console.log('resolveRuntimeOsLabel(): ', type, release);
console.log('Linux/Windows: unchanged | Darwin: now macOS + sw_vers -productVersion');
"
Platform: linux | os.type(): Linux | os.release(): 6.8.0-124-generic
resolveRuntimeOsLabel():  Linux 6.8.0-124-generic
Linux/Windows: unchanged | Darwin: now macOS + sw_vers -productVersion

$ pnpm tsgo
# exit code 0

$ pnpm test src/infra/os-summary.test.ts
 Test Files  1 passed (1)
      Tests  4 passed (4)

$ pnpm test src/agents/system-prompt-params.test.ts
 Test Files  1 passed (1)
      Tests  6 passed (6)

Observed result after the fix: On Linux/Windows, resolveRuntimeOsLabel() produces exactly the same output as the prior os.type() + os.release() — no regression. On Darwin (macOS 26 Tahoe), the same function now correctly returns macOS <productVersion> via sw_vers -productVersion instead of the Darwin kernel version from os.release(), matching the proven pattern in resolveOsSummary() and system-presence.ts.

What was not tested: This fix could not be verified on an actual macOS 26 (Tahoe) host due to the absence of such a test environment. The fix relies on the identical sw_vers -productVersion mechanism already proven by resolveOsSummary() and system-presence.ts in production, which correctly return the macOS product version on all supported macOS versions.

Tests and validation

Unit tests

All 14 tests across 4 test files pass:

$ pnpm test src/infra/os-summary.test.ts
 Test Files  1 passed (1)
      Tests  4 passed (4)

$ pnpm test src/agents/system-prompt-params.test.ts
 Test Files  1 passed (1)
      Tests  6 passed (6)

$ pnpm test src/agents/embedded-agent-runner/run/attempt-system-prompt.test.ts
 Test Files  1 passed (1)
      Tests  4 passed (4)

$ pnpm test src/commands/status.scan-overview.test.ts
 Test Files  1 passed (1)
      Tests  3 passed (3)

TypeScript check

$ pnpm tsgo
# exit code 0 — clean compile

Code changes

src/agents/cli-runner/helpers.ts                |  3 ++-
src/agents/embedded-agent-runner/compact.ts     |  3 ++-
src/agents/embedded-agent-runner/run/attempt.ts |  3 ++-
src/infra/os-summary.ts                         | 17 +++++++++++++++++
4 files changed, 23 insertions(+), 3 deletions(-)

Risk checklist

  • This change is backwards compatible — the new resolveRuntimeOsLabel() function falls back to the existing os.type() + os.release() format on non-Darwin platforms; on Darwin it matches the proven sw_vers pattern already in use by resolveOsSummary()
  • This change has been tested with existing configurations — all existing unit tests pass without modification
  • I have updated relevant documentation — N/A, this is a runtime behavior fix with no config/docs surface
  • Breaking changes (if any) are documented in Summary — no breaking changes

Current review state

  • Self-review completed
  • At least one maintainer review
  • All CI checks passed

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS labels Jun 20, 2026
@clawsweeper

clawsweeper Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 20, 2026, 1:29 AM ET / 05:29 UTC.

Summary
The PR adds resolveRuntimeOsLabel() in src/infra/os-summary.ts and replaces raw Node OS type/release strings in the CLI, embedded attempt, and compaction runtime prompt metadata.

PR surface: Source +20. Total +20 across 4 files.

Reproducibility: yes. from source inspection: current main passes raw os.type() and os.release() into the CLI, embedded attempt, and compaction runtime prompt metadata, while the linked issue provides Tahoe sw_vers versus Darwin release evidence. I did not run a live macOS Tahoe repro in this read-only review.

Review metrics: 1 noteworthy metric.

  • Runtime OS lookup: 1 uncached helper added, 3 prompt callers changed. Linux CI will not exercise the macOS turn-latency and stall risk from spawning sw_vers during prompt construction.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #95145
Summary: This PR is one candidate fix for the linked macOS Tahoe runtime prompt OS-version issue; sibling PRs overlap but are unmerged and not safe superseding targets yet.

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: 🦪 silver shellfish
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/Darwin terminal or log proof showing the patched runtime prompt line; after updating the PR body, ClawSweeper should re-review automatically, or a maintainer can comment @clawsweeper re-review.
  • Cache or reuse the Darwin product-version lookup before prompt construction.
  • [P1] Add focused helper tests for Darwin product-version output and non-Darwin unchanged output.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR includes Linux terminal output and tests, but it does not show the changed macOS/Darwin runtime prompt line after the patch; contributor proof should redact private paths, endpoints, IPs, API keys, phone numbers, and other sensitive details. 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 new helper calls macosVersion() on every Darwin prompt build, and that helper synchronously spawns sw_vers without using the existing cached resolveOsSummary() path.
  • [P1] The PR body’s after-fix output is Linux-only and does not show a redacted macOS/Darwin runtime prompt line after the patch.
  • [P1] Multiple open sibling PRs target Bug: Darwin kernel version 25.x incorrectly mapped to macOS 15.x (should be macOS 26 / Tahoe) #95145, so maintainers should choose one cached canonical landing path before closing the linked issue.

Maintainer options:

  1. Cache the runtime label before merge (recommended)
    Reuse the cached OS-summary lookup or add a small process-local runtime-label cache so Darwin prompt construction does not spawn sw_vers on every build.
  2. Accept the synchronous Darwin probe
    Maintainers could intentionally accept the per-prompt child process, but that should come with explicit macOS runtime proof and an availability tradeoff decision.
  3. Consolidate sibling fixes
    Pause this branch and land one canonical PR that covers the runtime prompt surface and any status/diagnostic surface maintainers want in scope.

Next step before merge

  • [P1] Contributor-supplied macOS/Darwin proof remains required, and maintainers should choose one cached canonical landing path among the sibling PRs before merge.

Security
Cleared: No concrete security or supply-chain concern was found; the diff only changes local OS metadata collection with a fixed local command and does not touch dependencies, workflows, permissions, or secrets.

Review findings

  • [P2] Cache the Darwin product-version lookup — src/infra/os-summary.ts:33
Review details

Best possible solution:

Land one cached runtime OS label helper used by all three prompt paths, add focused Darwin/non-Darwin regression tests, and require redacted macOS/Darwin after-fix prompt proof before merge.

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

Yes from source inspection: current main passes raw os.type() and os.release() into the CLI, embedded attempt, and compaction runtime prompt metadata, while the linked issue provides Tahoe sw_vers versus Darwin release evidence. I did not run a live macOS Tahoe repro in this read-only review.

Is this the best way to solve the issue?

No as submitted; using the macOS product version is the right boundary, but the maintainable fix needs caching, focused helper coverage, and real macOS/Darwin prompt proof before merge.

Full review comments:

  • [P2] Cache the Darwin product-version lookup — src/infra/os-summary.ts:33
    resolveRuntimeOsLabel() calls macosVersion() on every Darwin invocation, and that helper synchronously spawns sw_vers. Since this helper is wired into CLI, embedded attempt, and compaction prompt construction, a macOS agent turn can block on a child process each time; reuse the cached OS-summary path or add a small runtime-label cache before putting it on these prompt paths.
    Confidence: 0.88

Overall correctness: patch is incorrect
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8e375242bed2.

Label changes

Label justifications:

  • P2: This is a normal-priority macOS runtime metadata fix with limited blast radius but real prompt-context impact for Tahoe users.
  • merge-risk: 🚨 availability: The patch introduces an uncached synchronous sw_vers child process into multiple agent prompt construction paths on Darwin.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • 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 includes Linux terminal output and tests, but it does not show the changed macOS/Darwin runtime prompt line after the patch; contributor proof should redact private paths, endpoints, IPs, API keys, phone numbers, and other sensitive details. 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 +20. Total +20 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 4 23 3 +20
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 23 3 +20

What I checked:

Likely related people:

  • vincentkoc: Current blame for src/infra/os-summary.ts and the three raw runtime prompt OS metadata lines points to the same current-main commit associated with this account. (role: current-line carrier; confidence: high; commits: cfc699d3f672; files: src/infra/os-summary.ts, src/agents/cli-runner/helpers.ts, src/agents/embedded-agent-runner/run/attempt.ts)
  • steipete: Git history and GitHub commit metadata show earlier macOS product-version work in status output and system presence adjacent to this OS metadata boundary. (role: adjacent OS metadata contributor; confidence: medium; commits: 1eb50ffac476, 3bb4c0c2370d; files: src/infra/os-summary.ts, src/infra/system-presence.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.

- Add resolveRuntimeOsLabel() to src/infra/os-summary.ts that uses
  sw_vers -productVersion on Darwin instead of os.release() which
  returns the Darwin kernel version (e.g. 25.5.0)
- Replace os.type() + os.release() with resolveRuntimeOsLabel() in
  cli-runner/helpers.ts, attempt.ts, and compact.ts runtime paths
- On macOS 26 (Tahoe) this correctly shows "macOS 26.5.1" instead
  of "Darwin 25.5.0" in agent runtime prompts

Fixes openclaw#95145
@lzyyzznl
lzyyzznl force-pushed the fix/issue-95145-darwin-kernel-version-mapping branch from d1984c9 to ada14fd Compare June 20, 2026 05:18
@lzyyzznl

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #95234 (clean-patch version of the same fix for #95145).

@lzyyzznl

Copy link
Copy Markdown
Contributor Author

Superseded by #95234 — same fix, cleaner patch.

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: XS 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