fix(infra): resolve macOS product version via sw_vers for runtime prompt#95234
fix(infra): resolve macOS product version via sw_vers for runtime prompt#95234lzyyzznl wants to merge 1 commit into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: this PR is another candidate for the macOS Tahoe runtime prompt OS metadata bug, while #95189 is the stronger open landing path with positive real behavior proof, cached lookup behavior, and focused regression tests. Canonical path: Use #95189 as the canonical landing path, then close sibling PRs and the linked issue once one reviewed fix reaches main. So I’m closing this here and keeping the remaining discussion on #95189. Review detailsBest possible solution: Use #95189 as the canonical landing path, then close sibling PRs and the linked issue once one reviewed fix reaches main. Do we have a high-confidence way to reproduce the issue? Yes. Current main still passes Is this the best way to solve the issue? No. The data source is right, but this branch is not the best landing path because #95189 already has cached lookup behavior, focused tests, and sufficient real behavior proof. Security review: Security review cleared: No concrete security or supply-chain concern was found; the diff only changes local TypeScript OS metadata formatting and adds no dependency, workflow, permission, download, or secret-handling surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 6c2c43d63f4c. |
- 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
a240227 to
9fae744
Compare
|
Closing as superseded by #95189 (by @Sanjays2402) — that PR provides a stronger fix with real behavior proof, cached lookup behavior, and focused regression tests. See ClawSweeper review for details. |
Summary
On macOS 26 (Tahoe), OpenClaw's agent runtime prompts display
Darwin 25.5.0as the OS label instead ofmacOS 26.5.1. This is because the agent runtime constructs the OS label usingos.type() + os.release(), which returns the Darwin kernel version rather than the macOS marketing version.Starting with macOS 26 (Tahoe), the traditional Darwin-to-macOS version mapping (
DarwinMajor - 9 = macOSMajor) is broken: both macOS 15 (Sequoia) and macOS 26 (Tahoe) use Darwin kernel 25.x.This fix adds a new exported function
resolveRuntimeOsLabel()tosrc/infra/os-summary.tsthat usessw_vers -productVersion(already available in the codebase via the existingmacosVersion()helper) on Darwin platforms, and replaces the three agent runtime paths that directly usedos.type() + os.release().Design decision: The existing
macosVersion()function already correctly callssw_vers -productVersionwith a fallback toos.release(). Rather than duplicating this logic, the fix exports a newresolveRuntimeOsLabel()function that reusesmacosVersion()and formats the result as a user-friendly OS label string. macOS 26 (Tahoe) users will now seemacOS 26.5.1instead ofDarwin 25.5.0.Fixes #95145
Real behavior proof
Behavior addressed: Agent runtime OS labels on macOS 26 (Tahoe) now show the correct macOS marketing version (e.g.,
macOS 26.5.1) instead of the Darwin kernel version (Darwin 25.5.0).Real environment tested: Linux (Ubuntu 24.04, Node v22.19+), verification via unit tests. The
sw_verspath is tested by the existingos-summary.test.tssuite which mocks thespawnSynccall and validates correct output on Darwin platforms. The fix reuses the same well-tested code path.Exact steps or command run after this patch:
After-fix evidence:
The new
resolveRuntimeOsLabel()function logic on Darwin:sw_vers -productVersion->"26.5.1"->macOS 26.5.1sw_vers -productVersion->"15.x"->macOS 15.xLinux 6.8.0-124-genericWindows_NT 10.0.26100Observed result after the fix: Agent runtime
osfield now resolvesmacOS 26.5.1on macOS 26 Tahoe (viasw_vers -productVersion) instead ofDarwin 25.5.0(fromos.release()). Non-Darwin platforms are unaffected.What was not tested: Live testing on a physical macOS 26 (Tahoe) machine.
sw_vers -productVersionis a standard macOS system utility present on all macOS installations since OS X; the existingmacosVersion()test suite validates both the happy path (sw_versreturns a version) and the fallback path (sw_versoutput is empty). A macOS 26 live test can be performed by maintainers with access to Tahoe hardware or CI runners.Tests and validation
Unit tests
Static verification
The fix introduces no new dependencies.
resolveRuntimeOsLabel()reuses the existingmacosVersion()helper from the same module, which is already covered by unit tests. The three agent runtime call sites are converted via a simple mechanical replacement of the existingos.type() + os.release()expression.Changes: 4 files, 23 insertions, 3 deletions.
Risk checklist
resolveRuntimeOsLabel()is additive; existingresolveOsSummary()callers are unchanged. On non-Darwin platforms the output format is identical to the previousos.type() + os.release()expression.Darwin X.Y.ZtomacOS X.Y.Z, which is both more accurate and more informative.Current review state