Skip to content

fix(macos): prevent discovery startup from crashing on transient bundles - #169884

Merged
steipete merged 1 commit into
mainfrom
ci/fix1-shared-test-process
Oct 12, 2026
Merged

steipete merged 1 commit into
mainfrom
ci/fix1-shared-test-process

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes a macOS discovery startup crash in native test processes when concurrent bundle loading exposes a bundle without a URL.

User Impact

Onboarding and discovery can determine test mode without repeatedly walking transient bundles. Normal discovery behavior, runner recognition, configuration and dependencies are preserved.

Why This Change Was Made

Discovery duplicated the app's test detector but scanned Bundle.allBundles before checking runner markers. A full native replay trapped in URL._unconditionallyBridgeFromObjectiveC from this detector during OnboardingView.updateDiscoveryMonitoring.

The existing cached detector now lives in OpenClawKit, which both consumers already depend on. The app property delegates to that one owner, and Discovery's duplicate is removed. This adds one source file, not a module or dependency. The apps/ audit found no other hot global bundle enumeration; the remaining fallback scan runs once, after environment/process/argv recognition. Explicit main/module/class bundle lookups are unchanged.

Follow-up to 94940fb. The existing resolver and concurrent-reader tests remain. A touched Nix test's inherited five-field tuple lint finding is fixed with an equivalent local struct, preserving all rows and assertions.

Evidence

  • Forced missing-URL bundle: the new real Discovery start/stop test traps in the old getter at line 404; the candidate passes all 21 Discovery/Nix tests with the same fault in 0.045 seconds.
  • Native test-bundle compilation passed; final incremental build took 36.63 seconds wall time. Scoped SwiftLint and SwiftFormat passed.
  • Isolated P2 review: scoped-clean, 0.94.
  • Full default native replay passed 2,499 tests in 281 suites in 629.825 seconds in a disposable, headless macOS VM. Actual check-changed passed its selected tooling/runtime suites and native schema guard.
  • Completed PR CI 38249057877 has external dependency-download failures before compilation: WebRTC HTTP 504 in the shared iOS scan and iPad screenshot job, and a Gradle distribution read timeout in Android native-access. The source was not repushed or the jobs rerun; the remaining ancillary checks are being classified before landing. The shared-kit intersection also reports the absent iOS result file downstream of that fetch failure. CI calls the Android/iPad rows new/unknown because baseline job coverage differs; the logs and unchanged dependency/workflow blobs in the actual tested merge independently establish a source-independent infrastructure failure.

The focused command uses the compiled SwiftPM testing helper; pnpm test does not run Swift targets. The new regression adds no sleep, polling, timeout, skip, or extra process boot within the suite. No rendered UI changed.

Discovery's private test detector enumerated loaded bundle URLs on every
access before checking runner markers. A native onboarding replay and a
forced missing-URL bundle both trapped in that scan during discovery start.

Move the existing cached app detector to OpenClawKit and share the result
with Discovery. Both targets already depend on that module. Preserve runner
recognition and the one-time fallback, remove the competing detector, and
keep the app's existing convenience property. Audit found no other hot
loaded-bundle enumeration in apps.

The real Discovery start/stop regression traps on the old owner with the
fault injected. With the fix, all 21 Discovery/Nix tests pass in 0.045s with
the same fault. Native compilation, scoped Swift lint/format and P2 pass.
The full native default replay and PR CI provide the remaining broad proof.
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review October 12, 2026 12:26
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 12, 2026
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR shares the cached native test-process detector between the macOS app and Gateway discovery.

Example: Discovery starts inside swiftpm-testing-helper while a transient loaded bundle has no URL.

  • Before: Discovery inspects bundle URLs before recognizing the test runner and can trap.
  • After: The shared detector recognizes swiftpm-testing-helper before inspecting bundles, allowing discovery to start and stop.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused consolidation appears correct and useful; behavior confidence rests on reported production-owner regression evidence rather than inspectable shipped-entry-point output.
Proof confidence 🦐 gold shrimp (3/6) Host facts identify a maintainer-authored PR outside the ordinary contributor proof gate; the body reports GatewayDiscoveryModel start/stop succeeding under the missing-URL fault in a disposable macOS VM, with supporting native replay results rather than attached runtime output.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Native onboarding and discovery tests can terminate when Discovery inspects a transient bundle without a URL.
Reason: The maintainer-authored repair addresses the reported crash with a small consolidation that preserves existing test-isolation behavior.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it addresses a concrete native discovery crash still present on main, consolidates test detection under one owner, and introduces no identified correctness defect.

Priority: P2
Reviewed head: ece6003ccecada87eb4bf406b8d11e4c9e3ba964

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The body reports base failure and candidate success through the real Discovery test boundary, but supplies no raw runtime trace or shipped-app reproduction.
Agent review details

How this fits together

macOS onboarding starts Gateway discovery, which uses process identity to decide whether background discovery fallbacks should run.

flowchart TD
  A[Onboarding monitoring] --> B[Gateway discovery]
  B --> C[Shared cached test detector]
  D[App ProcessInfo accessor] --> C
  E[Environment process and arguments] --> C
  F[Bundle fallback] --> C
  C --> G[Fallback scheduling decision]
Loading

Technical review

Best possible solution:

Keep one cached test-process detector in OpenClawKit and have both native consumers use it.

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

Source confirms the bundle-first Discovery path, and the author reports a failing-base/passing-head missing-URL reproduction; this read-only review executed no target code.

Is this the best way to solve the issue?

Sharing the existing cached detector removes the competing implementation while preserving runner recognition, bundle fallback, and normal discovery scheduling.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 30b2ef35d02b.

Provenance checked

  • Cached test-process detection keeps the original intent (94940fb: Avoid repeated transient-bundle scans by resolving process-stable test identity once and recognizing known runners first.)
  • Discovery test-mode suppression keeps the original intent (unknown: The detector carried through the Moltbot rename suppresses persistent background discovery work in SwiftPM tests; rename history does not establish its original introduction.)
  • Nix defaults fixture matrix keeps the original intent (cea952a: Exercise Nix resolution using independently owned defaults domains rather than operator application state.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Nimrod Gutman: Raw commit 4aa548c adds apps/macos/Sources/OpenClawDiscovery/GatewayDiscoveryModel.swift:335 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 4aa548cf7de9; files: apps/macos/Sources/OpenClawDiscovery/GatewayDiscoveryModel.swift)

PR surface

Source -8, Tests +16. Total +8 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 51 59 -8
Tests 2 35 19 +16
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 86 78 +8

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The concrete crash affects native test-process discovery startup; the evidence does not establish a released end-user startup failure.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-12T12:33:41.821Z sha ece6003 :: needs maintainer review before merge. :: none

Reviewed October 12, 2026, 8:41 AM ET / 12:41 UTC (Revision 2).

@steipete
steipete merged commit 9d9761d into main Oct 12, 2026
144 of 151 checks passed
@steipete
steipete deleted the ci/fix1-shared-test-process branch October 12, 2026 13:00
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…les (openclaw#169884)

Discovery's private test detector enumerated loaded bundle URLs on every
access before checking runner markers. A native onboarding replay and a
forced missing-URL bundle both trapped in that scan during discovery start.

Move the existing cached app detector to OpenClawKit and share the result
with Discovery. Both targets already depend on that module. Preserve runner
recognition and the one-time fallback, remove the competing detector, and
keep the app's existing convenience property. Audit found no other hot
loaded-bundle enumeration in apps.

The real Discovery start/stop regression traps on the old owner with the
fault injected. With the fix, all 21 Discovery/Nix tests pass in 0.045s with
the same fault. Native compilation, scoped Swift lint/format and P2 pass.
The full native default replay and PR CI provide the remaining broad proof.
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 20, 2026
First-parent upstream f956a18..9d9761d (openclaw#169879 database worker
ownership docs, UI retired render adapters, openclaw#169884 macOS discovery).
No conflicts; the one file both sides touched (agent-schema-history.md,
upstream reworded the snapshot paragraph) keeps our schema-27 rows and
section byte-for-byte. Stops before openclaw#169646 (fp#722),
which is step 69 on its own.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant