Skip to content

fix(agents): use macOS product version in runtime prompt OS metadata#95216

Closed
1052326311 wants to merge 1 commit into
openclaw:mainfrom
1052326311:fix/95145-darwin-os-version
Closed

fix(agents): use macOS product version in runtime prompt OS metadata#95216
1052326311 wants to merge 1 commit into
openclaw:mainfrom
1052326311:fix/95145-darwin-os-version

Conversation

@1052326311

Copy link
Copy Markdown
Contributor

Closes #95145

Summary

os.release() returns the Darwin kernel version (e.g. "25.5.0"), which diverged from the macOS marketing version starting with macOS 26 Tahoe. Agents reported "Darwin 25.5.0" instead of "Darwin 26.5.1" in their runtime prompts.

Changes

  • Added resolveAgentOsString() to src/infra/os-summary.ts that uses sw_vers -productVersion on Darwin
  • Updated 3 agent runtime-info sites:
    • src/agents/embedded-agent-runner/compact.ts
    • src/agents/embedded-agent-runner/run/attempt.ts
    • src/agents/cli-runner/helpers.ts
  • 4 files, +20 -3 lines

Test

node scripts/run-vitest.mjs src/infra/os-summary.test.ts src/agents/system-prompt.test.ts
=> 94/94 passed

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling plugin: workboard size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 20, 2026
@clawsweeper

clawsweeper Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close: the linked Tahoe runtime prompt bug is valid, but this branch is superseded by an open proof-positive candidate that covers the same three runtime prompt paths with a cached macOS product-version helper and focused regression coverage.

Root-cause cluster
Relationship: superseded
Canonical: #95189
Summary: This PR and the canonical sibling PR target the same macOS Tahoe runtime prompt OS metadata bug, but the sibling has accepted proof, cached lookup behavior, and regression coverage.

Members:

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

Canonical path: Close this branch as superseded and continue the canonical fix in #95189, or an equivalent cached, tested macOS-label implementation.

So I’m closing this here and keeping the remaining discussion on #95189.

Review details

Best possible solution:

Close this branch as superseded and continue the canonical fix in #95189, or an equivalent cached, tested macOS-label implementation.

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

Yes. Source inspection shows the three current runtime prompt builders still pass os.type() plus os.release(), and the linked issue provides Tahoe sw_vers versus Darwin kernel evidence; I did not run a live Tahoe host.

Is this the best way to solve the issue?

No. The direction is right, but this branch returns a Darwin/product-version hybrid and bypasses the cached sw_vers path; the sibling PR is the narrower maintainable fix.

Security review:

Security review cleared: No concrete security or supply-chain concern was found; the diff only changes local TypeScript OS metadata formatting.

AGENTS.md: found and applied where relevant.

What I checked:

  • Current main still has the reported bug path: Current main still builds embedded attempt runtime OS metadata with os.type() plus os.release(), which exposes Darwin kernel releases to the agent prompt on Tahoe. (src/agents/embedded-agent-runner/run/attempt.ts:1928, d1b917120a47)
  • Current main sibling prompt paths share the same invariant: The CLI runner and compaction prompt paths use the same raw OS expression, so the canonical fix needs all three callers. (src/agents/cli-runner/helpers.ts:160, d1b917120a47)
  • Existing cache precedent: resolveOsSummary() caches OS summaries and explicitly notes that Darwin sw_vers lookup is comparatively slow, which this PR bypasses for runtime prompt construction. (src/infra/os-summary.ts:27, d1b917120a47)
  • This PR keeps a Darwin/product-version hybrid: At the PR head, the new helper returns ${os.type()} ${macosVersion()} on Darwin, so a Tahoe host would render a Darwin label with a macOS product version rather than the expected macOS product label. (src/infra/os-summary.ts:29, e2f241d46ac7)
  • Superseding PR is open and proof-positive: The canonical sibling PR is open, mergeable, labeled proof: sufficient, and targets the same linked Tahoe runtime prompt bug. (64677b034305)
  • Superseding PR has the better implementation shape: The sibling PR returns macOS <productVersion>, preserves non-Darwin output, adds runtime prompt tests, and includes cache-sharing coverage for the Darwin product-version lookup. (src/infra/os-summary.ts:86, 64677b034305)

Likely related people:

  • Peter Steinberger: Shortlog shows the heaviest history across the affected agent prompt/runtime files, including prior CLI runner and prompt-surface work. (role: adjacent feature-history owner; confidence: medium; commits: 89d7a24a3523, 2d0e25c23aa7; files: src/agents/cli-runner/helpers.ts, src/agents/system-prompt.ts)
  • Vincent Koc: Recent file history and previous ClawSweeper evidence connect this person to the current runtime prompt and OS-summary surfaces. (role: recent area contributor; confidence: medium; commits: aa69b12d0086, 74e7b8d47b18; files: src/infra/os-summary.ts, src/agents/cli-runner/helpers.ts)
  • lin-hongkuan: Local blame at the checked-out main boundary points to this author on the OS-summary helper and runtime prompt lines after a broad recent commit. (role: recent current-line contributor; confidence: low; commits: 67118d5ab912; files: src/infra/os-summary.ts, src/agents/embedded-agent-runner/run/attempt.ts, src/agents/embedded-agent-runner/compact.ts)

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

@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: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 20, 2026
@xuwei-xy

Copy link
Copy Markdown

Good approach. Would it make sense to handle edge cases like test as well?

os.release() returns the Darwin kernel version (e.g. "25.5.0"), which
diverged from the macOS marketing version starting with macOS 26 Tahoe.
This caused agents to report "Darwin 25.5.0" instead of "Darwin 26.5.1".

Add resolveAgentOsString() that uses sw_vers -productVersion on Darwin
and update all three agent runtime-info sites to use it.

Closes openclaw#95145
@1052326311
1052326311 force-pushed the fix/95145-darwin-os-version branch from 4d851cf to e2f241d Compare June 20, 2026 05:20
@1052326311

Copy link
Copy Markdown
Contributor Author

Real behavior proof

Environment: macOS 26.5.1 (Tahoe), Darwin kernel 25.5.0, Node v22.22.0

Drift proof (upstream/main → fix branch):

# BEFORE (os.release()):
$ node -e "console.log(require(\"os\").release())"
25.5.0
→ agents report: Darwin 25.5.0 (WRONG — Darwin kernel, not macOS version)

# AFTER (resolveAgentOsString):
$ sw_vers -productVersion
26.5.1
→ agents will report: Darwin 26.5.1 (CORRECT)

Test evidence:

node scripts/run-vitest.mjs src/infra/os-summary.test.ts src/agents/system-prompt.test.ts
=> 94/94 passed

Branch rebuilt: only 4 files changed (os-summary + 3 agent runtime-info sites). No Workboard commit.

@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.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 20, 2026
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Jun 21, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Jun 21, 2026
@steipete steipete closed this Jul 9, 2026
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. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

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)

3 participants