Skip to content

fix: use macOS product version in runtime prompts#95194

Closed
ly85206559 wants to merge 2 commits into
openclaw:mainfrom
ly85206559:codex/fix-macos-tahoe-runtime-os
Closed

fix: use macOS product version in runtime prompts#95194
ly85206559 wants to merge 2 commits into
openclaw:mainfrom
ly85206559:codex/fix-macos-tahoe-runtime-os

Conversation

@ly85206559

@ly85206559 ly85206559 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #95145.

OpenClaw already used sw_vers -productVersion for status/presence OS summaries, but agent runtime prompt metadata still used os.type() plus os.release(). On macOS Tahoe that exposes Darwin 25.x instead of macOS 26.x.

This PR adds a shared runtime OS-name helper in src/infra/os-summary.ts and uses it in:

  • src/agents/embedded-agent-runner/run/attempt.ts
  • src/agents/embedded-agent-runner/compact.ts
  • src/agents/cli-runner/helpers.ts

The helper intentionally returns OS name/release without architecture so buildRuntimeLine() can continue appending the existing separate arch field.

Review feedback addressed

  • Preserves previous non-Darwin runtime prompt strings by returning ${os.type()} ${os.release()} outside Darwin.
  • Keeps existing diagnostics/status resolveOsSummary() label behavior unchanged for Linux/Windows.
  • Adds focused Linux and Windows runtime-name invariant coverage.

Verification

  • node scripts/run-vitest.mjs src/infra/os-summary.test.ts
  • node scripts/run-vitest.mjs src/agents/cli-runner/helpers.system-prompt.test.ts
  • node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/attempt-system-prompt.test.ts
  • git diff --check origin/main...HEAD

Autoreview attempted with python .agents\skills\autoreview\scripts\autoreview --mode branch --base origin/main, but this Windows environment still fails to spawn the Codex reviewer executable with PermissionError: [WinError 5] Access is denied from the WindowsApps Codex path.

Real behavior proof

Behavior addressed: macOS Tahoe runtime prompt metadata no longer exposes the Darwin kernel release as the OS version.

Real environment tested: Windows checkout with mocked Darwin 25.5.0 and mocked sw_vers output 26.5.1 in focused unit tests.

Exact steps or command run after this patch: node scripts/run-vitest.mjs src/infra/os-summary.test.ts; node scripts/run-vitest.mjs src/agents/cli-runner/helpers.system-prompt.test.ts; node scripts/run-vitest.mjs src/agents/embedded-agent-runner/run/attempt-system-prompt.test.ts; git diff --check origin/main...HEAD.

Evidence after fix: resolveOsRuntimeName() returns macos 26.5.1 for Darwin 25.5.0 when sw_vers reports 26.5.1, CLI prompt metadata includes os=macos 26.5.1, and Linux/Windows runtime names preserve the previous os.type() shape (Linux ..., Windows_NT ...).

Observed result after fix: all three focused Vitest files passed after rebasing on latest origin/main.

What was not tested: no live macOS 26/Tahoe host was available in this environment, so live Tahoe Runtime-line proof is still missing.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S 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 as superseded: this draft is a plausible fix for the macOS Tahoe runtime prompt bug, but the same remaining work is already owned by a proof-positive sibling PR while this branch still has only mocked proof.

Root-cause cluster
Relationship: superseded
Canonical: #95189
Summary: This PR is superseded by an open proof-positive sibling PR for the same macOS Tahoe runtime prompt OS metadata bug.

Members:

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

Canonical path: Keep the remaining work on #95189, land one cached helper covering all three runtime prompt producers, then close overlapping PRs and the linked issue after it reaches main.

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

Review details

Best possible solution:

Keep the remaining work on #95189, land one cached helper covering all three runtime prompt producers, then close overlapping PRs and the linked issue after it reaches main.

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

Yes. Source inspection shows current main and v2026.6.9 still use os.type() plus os.release() in all three runtime prompt producers, and the linked issue supplies macOS product-version versus Darwin kernel-version evidence.

Is this the best way to solve the issue?

No. This branch is plausible, but the best remaining path is the proof-positive sibling at #95189 because it covers the same runtime prompt producers with live macOS proof and stronger cache/test coverage.

Security review:

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

AGENTS.md: found and applied where relevant.

What I checked:

  • Repository policy read: Root AGENTS.md and the scoped agent runner AGENTS.md files were read fully; the review applied their whole-path review, focused helper-test, and real behavior proof guidance. (AGENTS.md:1, d1cbe29f3d52)
  • Current main still has the reported runtime prompt path: The CLI, embedded attempt, and compaction runtime prompt producers still pass os.type() plus os.release() into runtime metadata, so current main can expose Darwin 25.x on Tahoe. (src/agents/embedded-agent-runner/run/attempt.ts:1936, d1cbe29f3d52)
  • Prompt renderer contract: buildRuntimeLine() appends the separate architecture field after runtimeInfo.os, so the correct helper shape is an OS name/version string without its own architecture suffix. (src/agents/system-prompt.ts:1404, d1cbe29f3d52)
  • Shipped behavior check: The latest release tag still contains the same raw runtime OS expression in the embedded and CLI prompt producers, so the bug is not already shipped-fixed. (src/agents/cli-runner/helpers.ts:160, c645ec4555c0)
  • This PR overlaps the canonical sibling: The PR diff updates the same three runtime prompt producers and adds an OS helper for the same linked Tahoe/Darwin mismatch. (src/infra/os-summary.ts:22, b2f222044bdd)
  • Contributor proof remains mock-only: The PR body reports Windows-hosted mocked Darwin tests and explicitly says no live macOS 26/Tahoe runtime-line proof was available. (b2f222044bdd)

Likely related people:

  • vincentkoc: Recent GitHub path history shows work in the CLI helper and agent runtime files, and local blame in this shallow checkout points the current raw runtime OS lines at the shallow boundary commit authored by Vincent Koc. (role: recent area contributor; confidence: medium; commits: 92d1f04de340, 0ea08076c3b5, fa4f1abb290c; files: src/agents/cli-runner/helpers.ts, src/agents/embedded-agent-runner/run/attempt.ts, src/infra/os-summary.ts)
  • steipete: GitHub path history shows repeated status, OS-summary, and system-prompt work around this metadata boundary, including the status output work that introduced the existing macOS product-version precedent. (role: adjacent feature-history owner; confidence: medium; commits: 1eb50ffac476, a9a386dee19f, 1d7d8a1658b3; files: src/infra/os-summary.ts, src/infra/system-presence.ts, src/agents/system-prompt.ts)
  • zhangguiping-xydt: Recent history shows runtime prompt metadata work adding session identity across embedded and CLI-backed prompts, adjacent to the affected OS metadata fields. (role: recent runtime prompt contributor; confidence: low; commits: 78c66742ab97; files: src/agents/system-prompt.ts, src/agents/cli-runner/helpers.ts, src/agents/embedded-agent-runner/run/attempt.ts)

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

@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: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 20, 2026
@ly85206559
ly85206559 force-pushed the codex/fix-macos-tahoe-runtime-os branch from 771033a to 557a06b Compare June 20, 2026 03:08
@ly85206559
ly85206559 force-pushed the codex/fix-macos-tahoe-runtime-os branch from 557a06b to b2f2220 Compare June 20, 2026 03:13
@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 20, 2026
@ly85206559 ly85206559 closed this Jun 23, 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 P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S 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