fix(os): use sw_vers for macOS version on Darwin instead of os.release()#95225
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 29, 2026, 10:11 AM ET / 14:11 UTC. Summary PR surface: Source +34, Tests +79. Total +113 across 5 files. Reproducibility: yes. Source inspection shows current main and v2026.6.10 pass raw Review metrics: 2 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land one canonical runtime OS helper that uses Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main and v2026.6.10 pass raw Is this the best way to solve the issue? Yes. This branch is a narrow maintainable fix: it centralizes the runtime prompt label helper, preserves non-Darwin output, keeps serialized summary release raw, and covers the invariants in focused tests. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against be94853de0d0. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +34, Tests +79. Total +113 across 5 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
…nel version Addresses ClawSweeper P1 findings on openclaw#95225: 1. Cache sw_vers output for process lifetime: resolveDarwinProductVersion() is called on the agent prompt hot path (3 callers via resolveOsProductLabel). Without caching, every prompt build spawns a synchronous subprocess. Added module-level cache + _resetCachedDarwinProductVersion() for tests. 2. Keep resolveOsSummary().release as os.release(): changing release from raw kernel to product version breaks status JSON and trajectory metadata consumers that expect the Darwin kernel release. The darwin product version is now used only in the label field.
26f7eb4 to
5631c9d
Compare
…sion Addresses ClawSweeper P1 findings on openclaw#95225: 1. Cache sw_vers output for process lifetime: resolveDarwinProductVersion() is called on the agent prompt hot path (3 callers via resolveOsProductLabel). Without caching, every prompt build spawns a synchronous subprocess. Added module-level cache + _resetCachedDarwinProductVersion() for tests. 2. Keep resolveOsSummary().release as os.release(): changing release from raw kernel to product version breaks status JSON and trajectory metadata consumers that expect the Darwin kernel release. The darwin product version is now used only in the label field.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…e() (openclaw#95225) * fix(os): use sw_vers for macOS version on Darwin instead of os.release() * fix: cache sw_vers, keep resolveOsSummary().release as raw kernel version Addresses ClawSweeper P1 findings on openclaw#95225: 1. Cache sw_vers output for process lifetime: resolveDarwinProductVersion() is called on the agent prompt hot path (3 callers via resolveOsProductLabel). Without caching, every prompt build spawns a synchronous subprocess. Added module-level cache + _resetCachedDarwinProductVersion() for tests. 2. Keep resolveOsSummary().release as os.release(): changing release from raw kernel to product version breaks status JSON and trajectory metadata consumers that expect the Darwin kernel release. The darwin product version is now used only in the label field. * fix(os): preserve runtime OS labels off Darwin
…e() (openclaw#95225) * fix(os): use sw_vers for macOS version on Darwin instead of os.release() * fix: cache sw_vers, keep resolveOsSummary().release as raw kernel version Addresses ClawSweeper P1 findings on openclaw#95225: 1. Cache sw_vers output for process lifetime: resolveDarwinProductVersion() is called on the agent prompt hot path (3 callers via resolveOsProductLabel). Without caching, every prompt build spawns a synchronous subprocess. Added module-level cache + _resetCachedDarwinProductVersion() for tests. 2. Keep resolveOsSummary().release as os.release(): changing release from raw kernel to product version breaks status JSON and trajectory metadata consumers that expect the Darwin kernel release. The darwin product version is now used only in the label field. * fix(os): preserve runtime OS labels off Darwin
…e() (openclaw#95225) * fix(os): use sw_vers for macOS version on Darwin instead of os.release() * fix: cache sw_vers, keep resolveOsSummary().release as raw kernel version Addresses ClawSweeper P1 findings on openclaw#95225: 1. Cache sw_vers output for process lifetime: resolveDarwinProductVersion() is called on the agent prompt hot path (3 callers via resolveOsProductLabel). Without caching, every prompt build spawns a synchronous subprocess. Added module-level cache + _resetCachedDarwinProductVersion() for tests. 2. Keep resolveOsSummary().release as os.release(): changing release from raw kernel to product version breaks status JSON and trajectory metadata consumers that expect the Darwin kernel release. The darwin product version is now used only in the label field. * fix(os): preserve runtime OS labels off Darwin
…e() (openclaw#95225) * fix(os): use sw_vers for macOS version on Darwin instead of os.release() * fix: cache sw_vers, keep resolveOsSummary().release as raw kernel version Addresses ClawSweeper P1 findings on openclaw#95225: 1. Cache sw_vers output for process lifetime: resolveDarwinProductVersion() is called on the agent prompt hot path (3 callers via resolveOsProductLabel). Without caching, every prompt build spawns a synchronous subprocess. Added module-level cache + _resetCachedDarwinProductVersion() for tests. 2. Keep resolveOsSummary().release as os.release(): changing release from raw kernel to product version breaks status JSON and trajectory metadata consumers that expect the Darwin kernel release. The darwin product version is now used only in the label field. * fix(os): preserve runtime OS labels off Darwin
Fixes #95145
What Problem This Solves
Fixes an issue where agents running on macOS 26 (Tahoe) could receive Darwin kernel metadata in their runtime prompt instead of the macOS product version, causing prompt context such as
Darwin 25.xto describe the host incorrectly.Why This Change Was Made
The runtime prompt OS helper now uses
sw_vers -productVersiononly on Darwin and keeps the historical${os.type()} ${os.release()}shape on Linux and Windows. The Darwin runtime label is cached by the raw OS tuple, andresolveOsSummary().releaseremains the raw kernel release for status JSON and trajectory compatibility.User Impact
macOS 26 users now get runtime prompt context like
os=macOS 26.4 (arm64)instead ofos=Darwin 25.4.0 (arm64), while Linux and Windows prompt labels stay unchanged.Evidence
node scripts/run-vitest.mjs src/infra/os-summary.test.ts- 9 tests passed. Covers Darwinsw_versproduct version, blanksw_versfallback, Windows/Linux legacy output, rawresolveOsSummary().release, and cached Darwin runtime prompt lookup.node scripts/run-vitest.mjs src/agents/system-prompt.test.ts src/agents/embedded-agent-runner/run/attempt-system-prompt.test.ts- 94 tests passed across the prompt renderer and embedded attempt prompt surface.node scripts/run-oxlint.mjs src/infra/os-summary.ts src/infra/os-summary.test.ts src/agents/cli-runner/helpers.ts src/agents/embedded-agent-runner/compact.ts src/agents/embedded-agent-runner/run/attempt.ts- passed.git diff --check- passed.Live macOS proof from this branch's implementation:
Observed result: on a real macOS 26.4 / Darwin 25.4.0 host, the runtime prompt renders
os=macOS 26.4 (arm64)whileresolveOsSummary().releaseremains the raw kernel release. Non-Darwin runtime labels preserve the previous${os.type()} ${os.release()}shape, includingWindows_NT ....AI-assisted: built with Codex