Skip to content

fix(infra): bound macOS metadata probes - #109241

Merged
steipete merged 1 commit into
openclaw:mainfrom
Alix-007:alix/macos-system-metadata-probe-timeouts
Jul 16, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
Alix-007:alix/macos-system-metadata-probe-timeouts

Conversation

@Alix-007

Copy link
Copy Markdown
Contributor

What Problem This Solves

The best-effort macOS metadata probes for sysctl -n hw.model and sw_vers -productVersion used synchronous child processes without deadlines. The presence probe runs during gateway module initialization, while the OS label is also used by gateway status and first-turn prompt preparation. A stalled system command could therefore block gateway startup or an agent turn indefinitely for metadata that already has fallback behavior.

Why This Change Was Made

Apply the existing 5-second system-probe budget and SIGKILL to both synchronous macOS commands. The presence module now reuses the infra-owned Darwin product-version helper instead of maintaining a second unbounded sw_vers implementation.

The existing fallback contracts remain unchanged: a failed or timed-out model probe yields no model identifier, and a failed product-version probe falls back to os.release(). This keeps the change local to the metadata owner and avoids changing synchronous module initialization or downstream APIs.

User Impact

A stalled macOS metadata command can no longer hang gateway startup, status resolution, or prompt preparation forever. Healthy commands produce the same model and product-version values. In the failure case, users receive the existing best-effort fallback after a bounded wait.

Evidence

  • Updated to current main at b6e90cbed4c2 immediately before PR creation; the reviewed patch-id remained unchanged across both rebases.
  • Node 24.15.0 focused test: node scripts/run-vitest.mjs src/infra/os-summary.test.ts src/infra/system-presence.version.test.ts -> 2 files, 16 tests passed.
  • Tests assert the exact sysctl and sw_vers arguments plus timeout: 5_000 and killSignal: "SIGKILL", and verify the resulting Darwin presence metadata.
  • A cross-platform-safe default child-process mock was added after adversarial review found that a bare mock would fail during module initialization on a real macOS test runner.
  • Controlled Node synchronous-child probe with a child ignoring SIGTERM: the SIGKILL deadline returned ETIMEDOUT in about 130 ms for a 120 ms test budget.
  • oxfmt --check, targeted oxlint, and git diff --check passed.
  • Fresh independent Codex adversarial re-review found no remaining issue and rated the change about 88-92% likely to land. Live searches found no open PR or issue implementing the same macOS probe deadlines.

Proof gap: no real macOS command-hang reproduction was available. The exact commands and fallback outputs are covered by focused tests, while the hard-kill behavior is covered by the controlled Node child-process probe.

@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. labels Jul 16, 2026
@clawsweeper

clawsweeper Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 16, 2026, 1:38 PM ET / 17:38 UTC.

Summary
The PR gives synchronous macOS model and product-version probes a shared five-second SIGKILL timeout and consolidates product-version lookup in the infra helper.

PR surface: Source +4, Tests +59. Total +63 across 4 files.

Reproducibility: no. there is not yet a high-confidence real current-main reproduction. Source inspection clearly exposes the unbounded synchronous calls, and the controlled Node probe validates the mechanism, but no actual macOS OpenClaw path was made to hang.

Review metrics: none identified.

Stored data model
Persistent data-model change detected: vector/embedding metadata: src/infra/system-presence.version.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
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:

  • Capture a real macOS OpenClaw run using temporary PATH shims that make sysctl and sw_vers hang, showing bounded completion and fallback output without private data.
  • Inspect the failing checks-node-compact-large-5 log and resolve it if it is attributable to this head.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The controlled Node output is useful but does not run the changed OpenClaw behavior on macOS; add redacted terminal or log proof, update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P2] The generic Node probe demonstrates timeout mechanics but does not prove that the changed OpenClaw startup and OS-label paths return their expected fallback metadata on a real macOS environment.
  • [P1] The failing checks-node-compact-large-5 result remains unexplained; it should be inspected to determine whether it is related before merge.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the shared helper and bounded-probe design, then add redacted macOS terminal or log proof that the actual OpenClaw path exits within the deadline and preserves fallback metadata when shimmed sysctl and sw_vers commands hang.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Wait for contributor-supplied macOS real-behavior proof and attribution of the failed Node shard; there is no concrete code defect for an automated repair worker.

Security
Cleared: The patch only changes fixed system-command execution options and an internal helper export; it adds no dependency, secret access, workflow permission, download, or supply-chain surface.

Review details

Best possible solution:

Keep the shared helper and bounded-probe design, then add redacted macOS terminal or log proof that the actual OpenClaw path exits within the deadline and preserves fallback metadata when shimmed sysctl and sw_vers commands hang.

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

No, there is not yet a high-confidence real current-main reproduction. Source inspection clearly exposes the unbounded synchronous calls, and the controlled Node probe validates the mechanism, but no actual macOS OpenClaw path was made to hang.

Is this the best way to solve the issue?

Yes, the proposed code shape is the narrowest maintainable fix: it reuses the existing infra helper and fallback contracts rather than adding a new API, asynchronous initialization path, or compatibility layer.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P2: This is a bounded reliability fix for a plausible gateway or agent-turn stall, but it requires an unusual macOS metadata-command failure and has limited blast radius.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The controlled Node output is useful but does not run the changed OpenClaw behavior on macOS; add redacted terminal or log proof, update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review.

Label justifications:

  • P2: This is a bounded reliability fix for a plausible gateway or agent-turn stall, but it requires an unusual macOS metadata-command failure and has limited blast radius.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The controlled Node output is useful but does not run the changed OpenClaw behavior on macOS; add redacted terminal or log proof, update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +4, Tests +59. Total +63 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 14 10 +4
Tests 2 60 1 +59
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 74 11 +63

What I checked:

  • Current behavior: Current main performs synchronous sysctl -n hw.model and sw_vers -productVersion metadata probes without deadlines, so a stalled command can block module initialization or runtime OS-label resolution. (src/infra/system-presence.ts:60, cb84dc76fc05)
  • Patch boundary: The PR applies the same timeout and hard-kill options to both Darwin probes while preserving the existing empty-output fallbacks and downstream data shapes. (src/infra/system-presence.ts:63, ffcf52909106)
  • Shared helper: The branch exports the existing Darwin product-version helper and makes it own the timeout, avoiding a second sw_vers implementation in presence initialization. (src/infra/os-summary.ts:16, ffcf52909106)
  • Focused regression coverage: The tests assert exact command arguments, the 5,000 ms timeout, SIGKILL, and Darwin presence metadata, including a cross-platform-safe child-process mock. (src/infra/system-presence.version.test.ts:138, ffcf52909106)
  • Real behavior proof gap: The PR body reports a generic controlled Node child-process timeout probe but explicitly states that no real macOS command-hang reproduction was run; the changed OpenClaw functions were only covered with mocked commands. (ffcf52909106)
  • Current checks: Most available guards are successful or still running, but checks-node-compact-large-5 currently reports failure; the supplied context does not include enough log detail to attribute it. (ffcf52909106)

Likely related people:

  • steipete: The change affects core gateway startup and prompt-runtime infrastructure; this is the best available routing candidate, although precise file-history attribution could not be established from the available read-only evidence. (role: repository-level core runtime owner; confidence: low; files: src/infra/os-summary.ts, src/infra/system-presence.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.

@steipete
steipete merged commit 23de5c2 into openclaw:main Jul 16, 2026
216 of 224 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 17, 2026
dwc1997 added a commit to dwc1997/openclaw that referenced this pull request Jul 17, 2026
The synchronous git symbolic-ref probe runs during gateway prompt footer
assembly. It had no timeout, so a stalled git process could block the
gateway indefinitely.

Add GIT_SYMBOLIC_REF_TIMEOUT_MS (5s) and SIGKILL, matching the bounded
probe pattern applied to macOS system probes (openclaw#109241).
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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.

2 participants