Skip to content

fix(os): use sw_vers for macOS version on Darwin instead of os.release()#95225

Merged
vincentkoc merged 3 commits into
openclaw:mainfrom
sunlit-deng:fix/issue-95145
Jun 29, 2026
Merged

fix(os): use sw_vers for macOS version on Darwin instead of os.release()#95225
vincentkoc merged 3 commits into
openclaw:mainfrom
sunlit-deng:fix/issue-95145

Conversation

@sunlit-deng

@sunlit-deng sunlit-deng commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

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.x to describe the host incorrectly.

Why This Change Was Made

The runtime prompt OS helper now uses sw_vers -productVersion only 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, and resolveOsSummary().release remains 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 of os=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 Darwin sw_vers product version, blank sw_vers fallback, Windows/Linux legacy output, raw resolveOsSummary().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:

uname -r: 25.4.0
sw_vers -productVersion: 26.4
node: v26.0.0
os.type/os.release/os.arch: Darwin 25.4.0 arm64
resolveRuntimeOsLabel(): macOS 26.4
resolveOsSummary(): {"platform":"darwin","arch":"arm64","release":"25.4.0","label":"macos 26.4 (arm64)"}
runtime line: Runtime: session=redacted | sessionId=redacted | host=redacted-host | os=macOS 26.4 (arm64) | node=v26.0.0 | model=redacted/provider | thinking=off

Observed result: on a real macOS 26.4 / Darwin 25.4.0 host, the runtime prompt renders os=macOS 26.4 (arm64) while resolveOsSummary().release remains the raw kernel release. Non-Darwin runtime labels preserve the previous ${os.type()} ${os.release()} shape, including Windows_NT ....

AI-assisted: built with Codex

@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 maintainer review before merge. Reviewed June 29, 2026, 10:11 AM ET / 14:11 UTC.

Summary
The PR adds a shared runtime OS label helper that uses sw_vers -productVersion on Darwin, routes CLI/embedded/compaction runtime prompt metadata through it, and adds regression coverage for Darwin and non-Darwin label behavior.

PR surface: Source +34, Tests +79. Total +113 across 5 files.

Reproducibility: yes. Source inspection shows current main and v2026.6.10 pass raw os.release() into runtime prompt metadata, and the issue/PR proof provides Tahoe host facts where Darwin 25.x should render as macOS 26.x.

Review metrics: 2 noteworthy metrics.

  • Runtime Prompt Producers: 3 changed. CLI, embedded attempt, and embedded compaction all share this runtime OS invariant, so reviewers should confirm the helper covers every prompt path.
  • Darwin Subprocess Path: 1 cached helper added. Prompt construction now reaches a Darwin-only sw_vers subprocess path, making cache scope and non-Darwin preservation important before merge.

Stored data model
Persistent data-model change detected: persistent cache schema: src/infra/os-summary.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #95145
Summary: This PR is one viable candidate fix for the canonical macOS Tahoe runtime prompt OS metadata issue; no fix has landed on current main, and several sibling PRs share the same root cause.

Members:

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

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

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

Rank-up moves:

  • none.

Risk before merge

  • [P1] Several open same-root PRs target the same canonical issue; maintainers should choose one branch to land and then close the remaining duplicates to avoid review churn and conflicting helper shapes.

Maintainer options:

  1. Decide the mitigation before merge
    Land one canonical runtime OS helper that uses sw_vers only for Darwin prompt metadata, preserves exact non-Darwin prompt output and raw summary release fields, then close the remaining duplicate candidate PRs.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No automated repair is needed; maintainers should pick the canonical linked PR and let normal CI/mergeability gate that selected branch.

Security
Cleared: No concrete security or supply-chain concern was found; the diff adds no dependency/workflow changes and invokes a fixed local sw_vers command without a shell.

Review details

Best possible solution:

Land one canonical runtime OS helper that uses sw_vers only for Darwin prompt metadata, preserves exact non-Darwin prompt output and raw summary release fields, then close the remaining duplicate candidate PRs.

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

Yes. Source inspection shows current main and v2026.6.10 pass raw os.release() into runtime prompt metadata, and the issue/PR proof provides Tahoe host facts where Darwin 25.x should render as macOS 26.x.

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 changes

Label changes:

  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.

Label justifications:

  • P2: This is a normal-priority agent runtime metadata bugfix with limited blast radius but real impact on macOS Tahoe prompt context.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes copied live macOS 26.4 after-fix output showing uname, sw_vers, resolveRuntimeOsLabel(), resolveOsSummary(), and the rendered runtime line with private host/session details redacted.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes copied live macOS 26.4 after-fix output showing uname, sw_vers, resolveRuntimeOsLabel(), resolveOsSummary(), and the rendered runtime line with private host/session details redacted.
Evidence reviewed

PR surface:

Source +34, Tests +79. Total +113 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 4 43 9 +34
Tests 1 80 1 +79
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 123 10 +113

What I checked:

Likely related people:

  • steipete: Introduced runtime info into system prompts and later unified system prompt runtime params; also introduced the OS summary helper used by adjacent diagnostics/status behavior. (role: feature-history contributor; confidence: high; commits: f70fd30cd3b6, 55d034358d3c, 1eb50ffac476; files: src/agents/system-prompt.ts, src/agents/cli-runner/helpers.ts, src/agents/system-prompt-params.ts)
  • zhangguiping-xydt: Recent commit touched the same runtime prompt metadata construction and prompt tests while adding session identity to runtime prompts. (role: recent runtime prompt contributor; confidence: medium; commits: 78c66742ab97; files: src/agents/cli-runner/helpers.ts, src/agents/embedded-agent-runner/run/attempt.ts, src/agents/system-prompt.ts)
  • vincentkoc: Recent GitHub history shows repeated work in the CLI helper and embedded attempt runner areas that surround this prompt metadata path. (role: recent adjacent owner; confidence: medium; commits: 92d1f04de340, 7f6a93eb8efd, bda4404f695a; files: src/agents/cli-runner/helpers.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: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jun 20, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Jun 21, 2026
sunlit-deng added a commit to sunlit-deng/openclaw that referenced this pull request Jun 23, 2026
…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.
…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.
@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 23, 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.

@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Jun 23, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jun 28, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 29, 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.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 29, 2026
@vincentkoc
vincentkoc merged commit 825d9a6 into openclaw:main Jun 29, 2026
128 of 135 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 30, 2026
…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
QiuYuang pushed a commit to QiuYuang/openclaw that referenced this pull request Jul 1, 2026
…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
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 1, 2026
…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
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 3, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

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)

2 participants