Skip to content

fix(infra): use macOS product version in os summary diagnostics (related #95145)#95170

Closed
zenglingbiao wants to merge 3 commits into
openclaw:mainfrom
zenglingbiao:fix/issue-95145-darwin-kernel-version
Closed

fix(infra): use macOS product version in os summary diagnostics (related #95145)#95170
zenglingbiao wants to merge 3 commits into
openclaw:mainfrom
zenglingbiao:fix/issue-95145-darwin-kernel-version

Conversation

@zenglingbiao

@zenglingbiao zenglingbiao commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem: On macOS 26 (Tahoe), resolveOsSummary() reports the Darwin kernel version (e.g. "25.5.0") as the release field instead of the macOS product version ("26.5.1"). Starting with macOS 26, Darwin kernel 25.x no longer maps to the macOS major version using the old convention, causing downstream diagnostics to display incorrect OS versions.
  • Root Cause: resolveOsSummary unconditionally assigned os.release() to the release field. On macOS, this is the Darwin kernel version. The macosVersion() helper (which calls sw_vers -productVersion) already existed but was only used for the label field.
  • Fix: Use macosVersion() for the release field on darwin, cached once per call to avoid double sw_vers probe. Route cli-runner and embedded attempt runtime OS fields through resolveOsSummary().release to propagate the product version to agent prompt metadata.
  • Scope: This PR fixes the status/diagnostics/trajectory metadata and runtime prompt OS fields. This is NOT a complete fix for all os.release() consumers — the linked issue may still need additional work for other code paths.
  • What changed:
    • src/infra/os-summary.ts — darwin release uses macosVersion() (cached)
    • src/agents/cli-runner/helpers.ts — runtime OS via resolveOsSummary().release
    • src/agents/embedded-agent-runner/run/attempt.ts — runtime OS via resolveOsSummary().release
    • src/infra/os-summary.test.ts — updated darwin expectations
  • What did NOT change: Linux/Windows — os.release() still used on non-darwin

Real behavior proof

Behavior or issue addressed (#95145): resolveOsSummary() returns Darwin kernel version as release on macOS, causing incorrect version reporting on macOS 26 where kernel 25 ≠ macOS 15.

Real environment tested: Linux, Node v22.22.0, OpenClaw built from source. Non-darwin backward compatibility verified — release = os.release() on Linux. The darwin code path uses the existing macosVersion() helper which calls sw_vers -productVersion.

Exact steps or command run after this patch: ran node --import tsx proof.mjs — confirmed non-darwin path unchanged.

Evidence after fix:

Platform: linux
Release:  4.19.112-2.el8.x86_64 (os.release() — unchanged)
RESULT: PASS — non-darwin platforms unchanged

Observed result after fix: On darwin, release now uses sw_vers -productVersion instead of os.release(). On Linux/Windows, os.release() continues to be used.

What was not tested: Live sw_vers on macOS 26 hardware. The fix is validated by source analysis (reporter confirmed sw_vers -productVersion → "26.5.1" vs uname -r → "25.5.0"), test updates (4 tests pass), and the non-darwin path remains unchanged.

Repro confirmation: os-summary.test.ts — darwin expectations updated, all 4 tests pass.

Change Type

  • Bug fix

Scope

  • infra / OS detection

Regression Test Plan

  • node scripts/run-vitest.mjs src/infra/os-summary.test.ts

Review Findings Addressed

N/A (initial submission)

Linked Issue/PR

Related to #95145

@clawsweeper

clawsweeper Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 19, 2026, 11:26 PM ET / 03:26 UTC.

Summary
This PR changes Darwin OS summary diagnostics and two runtime prompt callers to use the macOS product version instead of the Darwin kernel release.

PR surface: Source +6, Tests +2. Total +8 across 4 files.

Reproducibility: yes. from source and reporter evidence: current main passes raw os.release() into status metadata and runtime prompts, and the linked issue provides macOS 26.5.1 versus Darwin 25.5.0 host output. I did not run a live macOS 26 reproduction in this checkout.

Review metrics: 2 noteworthy metrics.

  • Runtime Prompt Callers: 2 changed, 1 sibling unchanged. CLI and embedded attempt are changed, but compaction still emits the shipped raw Darwin kernel release.
  • Darwin Release Semantics: 1 metadata field changed. OsSummary.release feeds status JSON and trajectory metadata, so maintainers should review upgrade compatibility before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #95145
Summary: This PR is a partial candidate fix for the canonical macOS Tahoe OS-version mismatch, while sibling PRs overlap on runtime prompt or documentation surfaces.

Members:

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

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until stronger real behavior proof is added.

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

Rank-up moves:

  • [P1] Add redacted macOS/OpenClaw terminal or log output showing the changed Darwin product-version metadata.
  • Use one cached runtime OS helper that returns a coherent macOS prompt display shape.
  • Route compaction through the same helper or remove runtime-prompt scope from this PR.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body only shows unchanged Linux output, not after-fix Darwin/macOS metadata; the contributor should add redacted macOS/OpenClaw terminal or log proof and update the PR body to trigger a fresh review, or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] Changing Darwin OsSummary.release from kernel release to macOS product version affects status JSON and trajectory metadata consumers that may parse the field.
  • [P1] The runtime prompt fix remains inconsistent: CLI and normal embedded attempts change, but compaction still emits the raw Darwin kernel release.
  • [P1] The PR computes the Darwin product version before checking the summary cache, so repeated resolveOsSummary() calls can synchronously spawn sw_vers on macOS.
  • [P1] The contributor proof only shows unchanged Linux behavior, not the changed Darwin/macOS path in a real OpenClaw setup.

Maintainer options:

  1. Repair And Prove Darwin Path (recommended)
    Use a cached helper, cover compaction, and add redacted macOS/OpenClaw terminal or log proof before merge.
  2. Narrow To Diagnostics Only
    Maintainers could remove the runtime-prompt changes and accept only the status/trajectory metadata change after deciding the release-field compatibility impact is intended.
  3. Consolidate With Runtime PR
    Pause or close this branch if a sibling runtime-prompt PR becomes the canonical fix and picks up the diagnostics metadata behavior too.

Next step before merge

  • [P1] Contributor macOS proof is still missing and maintainers need to choose the diagnostics/runtime scope before this can be a safe merge path.

Security
Cleared: No concrete security or supply-chain concern was found; the diff adds no dependency, workflow, permission, or secret-handling changes and only reuses a fixed local macOS command.

Review findings

  • [P2] Use a real macOS prompt OS shape — src/agents/cli-runner/helpers.ts:160
  • [P2] Cover the compaction prompt caller — src/agents/embedded-agent-runner/run/attempt.ts:1936
  • [P2] Preserve the Darwin summary cache — src/infra/os-summary.ts:27
Review details

Best possible solution:

Land one cached macOS product-version helper with explicit status metadata semantics, route every runtime prompt caller through the correct display shape, and add redacted macOS/OpenClaw proof before merging.

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

Yes, from source and reporter evidence: current main passes raw os.release() into status metadata and runtime prompts, and the linked issue provides macOS 26.5.1 versus Darwin 25.5.0 host output. I did not run a live macOS 26 reproduction in this checkout.

Is this the best way to solve the issue?

No. Updating Darwin OsSummary.release is a useful partial fix, but the best fix should use a cached macOS display helper, cover compaction, and prove the changed Darwin path on macOS.

Full review comments:

  • [P2] Use a real macOS prompt OS shape — src/agents/cli-runner/helpers.ts:160
    This changes the prompt value to ${os.type()} ${resolveOsSummary().release}, which renders an impossible string like Darwin 26.5.1 on Tahoe: the name is still Darwin but the version is now the macOS product version. Use a dedicated helper that returns macOS <productVersion> on Darwin and preserves the old os.type()/os.release() shape elsewhere.
    Confidence: 0.86
  • [P2] Cover the compaction prompt caller — src/agents/embedded-agent-runner/run/attempt.ts:1936
    The PR routes CLI and normal embedded attempts through the new value, but compactEmbeddedAgentSessionDirectOnce() still builds runtimeInfo.os from os.type() plus os.release(). After compaction on Tahoe, the runtime prompt can still expose raw Darwin 25.x, so route compaction through the same helper or scope this PR to diagnostics only.
    Confidence: 0.88
  • [P2] Preserve the Darwin summary cache — src/infra/os-summary.ts:27
    darwinProductVersion is computed before checking cachedOsSummaryByKey, so every Darwin call to resolveOsSummary() can synchronously spawn sw_vers even for an already cached tuple. Keep the cache key on stable os.* facts or cache the product version separately.
    Confidence: 0.84

Overall correctness: patch is incorrect
Overall confidence: 0.88

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add merge-risk: 🚨 availability: The diff moves the synchronous Darwin sw_vers probe before the cache lookup, so repeated summary calls can spawn a process every time.
  • remove merge-risk: 🚨 other: Current PR review merge-risk labels are merge-risk: 🚨 compatibility, merge-risk: 🚨 availability.

Label justifications:

  • P2: This is a focused macOS host metadata bug fix with limited blast radius but real status and agent-context impact for Tahoe users.
  • merge-risk: 🚨 compatibility: The PR changes the Darwin OsSummary.release value exposed through status JSON and trajectory metadata from kernel release to product version.
  • merge-risk: 🚨 availability: The diff moves the synchronous Darwin sw_vers probe before the cache lookup, so repeated summary calls can spawn a process every time.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body only shows unchanged Linux output, not after-fix Darwin/macOS metadata; the contributor should add redacted macOS/OpenClaw terminal or log proof and update the PR body to trigger a fresh review, or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +6, Tests +2. Total +8 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 3 10 4 +6
Tests 1 3 1 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 13 5 +8

What I checked:

  • Repository policy read: Read the full root policy and scoped agent runner guides; the review-beyond-diff, compatibility, hot-path, and real-behavior-proof guidance affected this review. (AGENTS.md:1, c946df023917)
  • Current main OS summary behavior: Current main uses os.release() as OsSummary.release and only calls sw_vers for the Darwin label after the cache lookup. (src/infra/os-summary.ts:22, c946df023917)
  • Current main runtime prompt callers: Current main builds runtime prompt OS strings from os.type() plus os.release() in CLI, embedded attempt, and compaction paths. (src/agents/embedded-agent-runner/compact.ts:1038, c946df023917)
  • PR scope: The live PR changes resolveOsSummary(), CLI runtime prompt metadata, and embedded attempt metadata, but it does not change the compaction runtime prompt caller. (src/agents/embedded-agent-runner/run/attempt.ts:1936, e61380f4ef5c)
  • Status and trajectory consumers: resolveOsSummary() feeds status scan output and trajectory run metadata, so changing Darwin release semantics is user-visible metadata, not only terminal display text. (src/trajectory/metadata.ts:232, c946df023917)
  • Shipped behavior check: Latest release v2026.6.8 still has raw os.release() in resolveOsSummary().release and the runtime prompt callers, so this PR changes shipped behavior. (src/infra/os-summary.ts:22, 844f405ac1be)

Likely related people:

  • vincentkoc: Current-main blame for resolveOsSummary() and the runtime prompt OS metadata lines points to commit 4575734, and recent GitHub path history shows adjacent CLI/agent runner maintenance. (role: recent area contributor; confidence: medium; commits: 4575734f5909, 92d1f04de340, 0ea08076c3b5; files: src/infra/os-summary.ts, src/agents/cli-runner/helpers.ts, src/agents/embedded-agent-runner/run/attempt.ts)
  • steipete: GitHub path history shows the OS summary/status area dating back to status-output work and repeated adjacent infra/system-presence changes. (role: feature-history owner; confidence: medium; commits: 1eb50ffac476, 00d8d7ead059, 334a1dd71698; files: src/infra/os-summary.ts, src/infra/system-presence.ts, src/commands/status.scan-overview.ts)
  • zhangguiping-xydt: Recent runtime prompt identity work touched the same prompt metadata surface that this PR changes. (role: adjacent prompt-surface contributor; confidence: low; commits: 78c66742ab97; files: src/agents/cli-runner/helpers.ts, src/agents/system-prompt.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: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jun 20, 2026
fixes openclaw#95145)

- Cache macosVersion() result to avoid double sw_vers probe
- Route cli-runner and embedded attempt OS fields through resolveOsSummary
- Update os-summary test expectations for darwin release = product version
@zenglingbiao

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated:

  1. Cached result to avoid double probe (P3)
  2. Routed and OS fields through (P2)
  3. Updated darwin expectations to reflect product version in field (P2)

All 4 tests pass, build passes.

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

@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Jun 20, 2026
@clawsweeper clawsweeper Bot added status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 20, 2026
@zenglingbiao zenglingbiao changed the title fix(infra): use macOS product version instead of kernel version in os summary (fixes #95145) fix(infra): use macOS product version in os summary diagnostics (related #95145) Jun 20, 2026
@zenglingbiao

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Scoped to diagnostics/runtime-prompt metadata. Removed closing reference — changed from "Fixes" to "Related to" #95145.

@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. labels Jun 20, 2026
@zenglingbiao

Copy link
Copy Markdown
Contributor Author

Superseded by #95189 which provides the superior cached resolveRuntimePromptOs() approach covering all three runtime prompt callers (CLI, embedded attempt, compaction) with proper Map-level caching, comprehensive tests, and real macOS proof (🐚 platinum hermit, 🦞 proof). Per ClawSweeper's maintainer option 3: "Consolidate With Runtime PR."

@zenglingbiao
zenglingbiao deleted the fix/issue-95145-darwin-kernel-version branch June 22, 2026 03:42
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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant