Skip to content

provider: App Attest keeps working after a self-update (refresh LaunchServices) - #1765

Merged
jonathan308 merged 4 commits into
devfrom
fix/app-attest-launchservices-refresh
Nov 4, 2026
Merged

jonathan308 merged 4 commits into
devfrom
fix/app-attest-launchservices-refresh

Conversation

@jonathan308

@jonathan308 jonathan308 commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

About 12–15% of updating Macs lose App Attest after every self-update, and restarts don't fix it. Without the MDM
profile, App Attest is a Mac's only way to get inference work, so those Macs get none until macOS happens to fix itself,
minutes to hours later. This PR makes the provider repair it at once.

Production proof (read-only; coordinator App Attest telemetry and provider report 6024, 2026-11-03/04 UTC)

One user's Mac (report 6024). An M5 Ultra with no MDM profile; every ready ran in the logged-in GUI session, with
SIP on and valid entitlements.

Time (Z) Provider process App Attest ready
22:16–22:51 0.10.6 reported_supported, granted
22:55:49 0.10.7, started by the self-update unsupported · is_supported_false
23:02, 23:12 0.10.7, its automatic restart is_supported_false
23:20–23:55 0.10.7, five manual restarts is_supported_false
00:05:09 same process, no restart reported_supported → granted → serving

The coordinator held the Mac at trust_floor (no inference) the whole time. darkbloom doctor sent the user to Screen
Sharing to restart, which can't help.

The fleet, in the first 78 minutes after each release:

  • Every release causes it. 0.10.7: 122 of 832 updating macOS 27 Macs (14.7%). 0.10.6: 97 of 821 (11.8%). It always
    starts on the first ready of the updated process.
  • Restarts don't help. 0.10.7's automatic restart ran on 117 affected Macs and fixed 1.
  • It is random per update, not a few bad Macs: only 21 Macs were hit on both releases.
  • It clears inside a running process at a random time, after a median of about 2 h on 0.10.6.
  • At ~00:10Z, 109 Macs on 0.10.7 were still stuck, 52 of them without MDM at trust_floor with no inference.

Cause. The self-update swaps Darkbloom.app into place by renaming directories (RENAME_SWAP) and never refreshes
macOS LaunchServices. Apple's DCAppAttestService.isSupported depends on LaunchServices' record of the running app, so
until macOS re-registers the app, every process gets is_supported_false, however it is started.

  • Our own prior evidence: the platform's native qualification test runs lsregister -f before launching for exactly
    this reason: "DeviceCheck still rejects a missing or stale LaunchServices entry".
  • This Mac's LaunchServices still holds 11 records at past self-update staging paths.

The change

  1. In-process repair. The first time Apple answers unsupported in a process, checkAvailability re-registers the
    running bundle with LaunchServices and asks Apple again, so that same exchange succeeds.
    • The call is LSRegisterURL(Bundle.main.bundleURL, true), the public API behind lsregister -f.
    • At most once per App Attest service: once per process, or once per availability window for a scheduled
      provider. Nothing is touched when Apple says supported. No process, shell, sudo or Keychain.
    • This is the part that matters for 0.10.8: the swap to 0.10.8 is still done by 0.10.7's updater, so only the new
      process can repair it.
  2. Prevention. Right after commitStagedBundle swaps the bundle, on the signature-verified path only, the updater
    registers <install>/Darkbloom.app.
  3. Doctor. For a provider already in the GUI session, it explains the self-update cause and gives the full
    lsregister -f command plus the SIP and Full Security checks. The advice outside the GUI session is unchanged.

Everything else in App Attest is unchanged, including 0.10.7's unsupported restart (owner decision whether to keep it).

Linked issue

Provider report 6024 (an end user: "unable to app attest on the inference side since updating to latest version").

Test plan

  • Red on dev (tests-only commit 4fd2297e7d), green with the fix:
    • AppAttestLaunchServicesRefreshTests (3 new): a stale record is repaired in the same exchange; supported never
      touches LaunchServices; at most once per service (…OncePerService).
    • SelfUpdaterTests (2 new): a verified commit registers <install>/Darkbloom.app; a refused commit registers
      nothing.
    • AppAttestLocalDiagnosisTests: the new GUI-session advice. Red: 6 issues (it said "Screen Sharing", with no
      lsregister).
  • Regressions (CI build identity DARKBLOOM_RELEASE_ENVIRONMENT=prod, sandboxed):
    • ProviderAppAttestTests: 85 executed, 0 failures, 1 skipped (it reads the installed app, which the sandbox denies).
    • Doctor/updater set: 60/60.
  • make docs-check, make docs-impact-check BASE=origin/dev, make changelog-check, git diff --check.
  • A test merge with provider: an App Attest attestation cut off by a disconnect or a stop keeps Apple's answer #1763 (fix/app-attest-attestation-survives-disconnect) is clean.
  • In progress: the 0.10.8 candidate's signed validation build on the owner's Macs.
  • After release: the fleet's is_supported_false rate with start_reason=update should drop to about zero.

Components touched

  • provider-swift (Swift CLI)
  • native runtime / MLX
  • landing (Next.js)
  • enclave (Swift)
  • CI / provider release
  • docs

Protocol / interface changes

  • No protocol/interface changes

Documentation impact

  • Canonical documentation updated:
    • docs/provider/attestation.md: cause, manual command, corrected advice;
    • docs/provider/installation.md: the update registers the app;
    • docs/provider/troubleshooting.md: the doctor row;
    • docs/reference/app-attest-shadow.md: the restart row.

Changelog

  • Added changelog.d/app-attest-launchservices-refresh.md and ran make changelog-check.

Notes for reviewers

  • LSRegisterURL(url, true) is the same force registration as lsregister -f. Checked read-only on macOS 27.0.1:
    both reach _LSRegisterBundleURL with the force bit. No binary is spawned.
  • No wall-clock deadline on the registration call, as with the isSupported call beside it. Both are synchronous
    system requests; a deadline would belong around the whole availability check.
  • Rollback and crash-recovery swaps don't register; the next process's repair covers them.
  • Not validated on a real stuck Mac yet. The manual command (lsregister -f) is the cheapest confirmation on the
    next stuck Mac.

Before And After

Behavior

flowchart TB
  classDef bad fill:#fde2e1,stroke:#c0392b,color:#641e16
  classDef good fill:#e3f6e8,stroke:#1e8449,color:#0b3d1f
  classDef step fill:#eef2f7,stroke:#5d6d7e,color:#1b2631
  subgraph BEFORE["Before"]
    direction TB
    b1["Self-update swaps Darkbloom.app (RENAME_SWAP)"]:::step --> b2["LaunchServices still describes the old bundle"]:::bad
    b2 --> b3["isSupported = false in every process"]:::bad
    b3 --> b4["restart (automatic or manual): same answer"]:::bad
    b4 --> b5["no App Attest → trust_floor → no inference<br/>until macOS re-registers (minutes to hours)"]:::bad
  end
  subgraph AFTER["After"]
    direction TB
    a1["Self-update swaps Darkbloom.app"]:::step --> a2["updater registers the new app<br/>(signature-verified path)"]:::good
    a2 --> a3{"isSupported?"}:::step
    a3 -- "true" --> a5["App Attest granted"]:::good
    a3 -- "false (stale record)" --> a4["re-register the running bundle once,<br/>ask Apple again in the same exchange"]:::good
    a4 --> a5
  end
Loading

Code flow

flowchart LR
  classDef same fill:#eef2f7,stroke:#5d6d7e,color:#1b2631
  classDef changed fill:#fff4d6,stroke:#b9770e,color:#4d3200
  subgraph CB["Before"]
    direction TB
    u1["SelfUpdater.commitStagedBundle"]:::same --> u2["UpdateAtomicFilesystem.replace (RENAME_SWAP)"]:::same
    c1["AppleAppAttestService.checkAvailability"]:::same --> c2["requireSupported(isSupported)"]:::same
  end
  subgraph CA["After"]
    direction TB
    v1["SelfUpdater.commitStagedBundle"]:::same --> v2["UpdateAtomicFilesystem.replace"]:::same
    v2 --> v3["LaunchServicesRegistration.refresh(<install>/Darkbloom.app)<br/>verified path only"]:::changed
    d1["checkAvailability"]:::same --> d2["requireSupported(isSupportedRefreshingRegistration(app:))"]:::changed
    d2 --> d3["AppAttestSupport: isSupported, else refresh once → isSupported"]:::changed
  end
Loading

Validation follow-up

An independent validator passed this PR with notes. One was that "once per process" overstated how often the refresh
can run.

  • Wording fix after validation (2e35241c4c): the LaunchServices refresh runs at most once per
    AppleAppAttestService, not once per process. A provider without an availability schedule keeps one service per
    process; a scheduled provider makes one per availability window, so it can re-register once per window. The comments,
    docs and changelog now say this, the doctor sentence no longer states a frequency, and the test is renamed
    …OncePerService. Behavior is unchanged.
  • Validated at 2e35241c4c: prod-identity build. Sandboxed ProviderAppAttestTests (11 classes): 99 executed,
    0 failures, 1 skipped (it needs the installed app). AppAttestLocalDiagnosisTests: 12/12. docs-check,
    docs-impact-check BASE=origin/dev, changelog-check and git diff --check pass.

Refactor Pass

A dedicated refactor pass (d-inference AGENTS.md) reviewed the fix and added one behavior-preserving commit, 8d4462d9b1:

  • AppAttestSupportProbe → AppAttestSupport (file renamed). It also writes LaunchServices, so "probe" read as read-only, and it
    was easy to confuse with ProviderLoop.appAttestSupportProbe, the restart monitor's live isSupported read, which never
    re-registers. Its redundant hand-written init is gone, and its closures are let.
  • refreshRegistration returns Void. Nothing read the OSStatus; asking Apple again is the check.
  • Docs: the troubleshooting row no longer gives a bare lsregister -f (not on PATH) and points at the full command doctor
    prints. The attestation page drops a changelog-style "now" and says the manual command changes no Darkbloom file or key. The
    reference row cites each claim's own code.
  • The changelog fragment is in plain operator words, with the same facts.

No logic changed:

  • The support check order is unchanged.
  • The repair re-registers only Bundle.main.bundleURL, after the .app and entitlement checks, at most once per service (one per process, or one per availability window
    when scheduled), with no
    process, shell, sudo or Keychain access.
  • The updater registers only on the signature-verified path.
  • doctor advice outside the GUI session is unchanged.
  • The 0.10.7 unsupported restart is untouched, and every test assertion is unchanged.

Checked read-only on macOS 27.0.1: LSRegisterURL(url, true) makes the same force-update registration that lsregister -f does
(_LSRegisterBundleURL with the force bit).

Validation at 8d4462d9b1:

  • Prod-identity build.
  • Sandboxed focused tests:
    • App Attest set: 85 executed, 0 failures, 1 skipped. The skipped test reads the installed app, which the sandbox denies.
    • Doctor/updater set: 60/60. The 2 earlier failures were a missing build-product mlx.metallib, now staged from the repo's cache.
  • Gates: make docs-check, make docs-impact-check BASE=origin/dev, make changelog-check and git diff --check all pass.
  • A test merge with fix/app-attest-attestation-survives-disconnect is clean.

Left for the owner:

  • There is no wall-clock deadline on the synchronous LaunchServices call, as on the isSupported call beside it.
  • Rollback and crash-recovery swaps don't register; the next process's repair covers them.
  • No local log line records the re-registration.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

jonathan308 and others added 3 commits November 3, 2026 16:27
Report 6024: after updating to 0.10.7 an M5 Ultra answered every App Attest
ready with is_supported_false for 70 minutes, in the GUI session, across
0.10.7's automatic restart and five manual restarts, then recovered inside a
running process. DeviceCheck also reads macOS LaunchServices' record of the
running app, and the update swaps Darkbloom.app in place without refreshing it.

These tests fail on dev:
- AppleAppAttestService re-registers the running bundle once per process on an
  unsupported answer and asks Apple again (no seam exists yet);
- SelfUpdater registers the installed app with LaunchServices after a commit,
  and not after a refused one (no seam exists yet);
- doctor stops sending a provider that already runs in the GUI session to
  Screen Sharing and a restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The self-update swaps Darkbloom.app in place (renameatx_np RENAME_SWAP) and
never tells macOS LaunchServices. DeviceCheck also reads LaunchServices' record
of the running app (our native qualification harness registers its candidate
with lsregister -f for this reason), so isSupported stays false in every
process until LaunchServices re-registers the bundle. Fleet data: 12-15% of
updating macOS 27 Macs at the 0.10.6 and 0.10.7 rollouts, cleared after
minutes to hours. 0.10.7's automatic restart recovered 1 of 117 such Macs,
and 52 Macs without the MDM profile sat at trust_floor (report 6024).

- AppleAppAttestService.checkAvailability: the first unsupported answer in a
  process re-registers the running bundle (LSRegisterURL, as lsregister -f)
  and asks Apple again, so the exchange that meets a stale record succeeds.
  This covers the first update to this version, which the old updater runs.
- SelfUpdater.commitStagedBundle registers the installed app right after the
  swap, on the signature-verified path only; tests inject an observer and
  never write the machine's LaunchServices database.
- doctor: is_supported_false inside the GUI session no longer advises Screen
  Sharing and a restart; it names the self-update cause and the lsregister
  command. Background and unknown sessions keep the old advice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Behavior-preserving cleanup of the LaunchServices refresh.

- AppAttestSupportProbe becomes AppAttestSupport (file renamed). It also
  writes LaunchServices, so "probe" read as read-only, and it was easy to
  confuse with ProviderLoop.appAttestSupportProbe, the unsupported-restart
  monitor's live isSupported read, which deliberately never re-registers.
- Drop its hand-written init; the synthesized memberwise init is the same
  internal init. Its closures are let.
- refreshRegistration returns Void. Nothing read the OSStatus: asking Apple
  again is the check. LaunchServicesRegistration.refresh still returns it.
- The registrationRefreshed comment says what holds: once per service, and
  a provider process keeps one service.
- troubleshooting.md no longer gives a bare `lsregister -f` (lsregister is
  not on PATH); it points at the full command doctor prints, and drops a
  duplicated link. attestation.md drops a changelog-style "now" and says the
  manual command changes no Darkbloom file or key. The app-attest-shadow.md
  row cites each claim's own code.
- The changelog fragment is in plain operator words; same facts and numbers.

Unchanged: the support check order, once-per-process refresh, updater
registration on the signature-verified path only, doctor advice outside the
GUI session, the unsupported-restart policy, and every test assertion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonathan308
jonathan308 requested a review from davidtai November 4, 2026 00:45
@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
d-inference Error Error Nov 4, 2026 2:34am UTC
d-inference-console-ui-dev Error Error Nov 4, 2026 2:34am UTC
d-inference-landing Ready Ready Preview Nov 4, 2026 2:34am UTC
darkbloom-status Ready Ready Preview Nov 4, 2026 2:34am UTC
eigen-homepages-darkbloom Ready Ready Preview Nov 4, 2026 2:34am UTC

Request Review

The guard that limits the LaunchServices refresh is per
AppleAppAttestService, not per process. A provider without an availability
schedule keeps one service per process, but a scheduled provider builds a
new ProviderLoop, and so a new service, for each availability window, so it
can re-register once per window. That is bounded and harmless; the words
overstated it. The behavior is unchanged.

- AppleAppAttestService: the registrationRefreshed and
  isSupportedRefreshingRegistration comments say once per service, and how
  many services each mode keeps.
- doctor's GUI-session is_supported_false message: "re-registers its app
  once per process when this happens" becomes "re-registers its app by
  itself when this happens".
- app-attest-shadow.md, attestation.md and the changelog fragment say once
  per process or once per scheduled availability window, citing the code
  that makes it so.
- The test testPersistentUnsupportedReRegistersOnlyOncePerProcess is renamed
  ...OncePerService; it builds one service, and its assertions are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jonathan308
jonathan308 merged commit edb7828 into dev Nov 4, 2026
34 of 37 checks passed
jonathan308 added a commit that referenced this pull request Nov 4, 2026
Brings #1763, #1765, #1764, #1770, #1772, #1767, #1768, #1769 and #1766 from dev. One conflict, in
docs/provider/two-mac-cluster.md (2 hunks): before "## Undo", #1774's "Stopping and starting again",
then #1770's "Pairing again"; Undo keeps #1770's opening, #1774's --service sentences, the Uninstall
link, and #1772's "## Uninstall" section as written. Resolution verified in a dry run (tree 4737f00).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	docs/provider/two-mac-cluster.md

This branch had an error being deployed

2 failed and 3 active deployments
Preview – d-inference-landing — 2e35241c Deployed Nov 4, 2026 by vercel[bot]
Preview – eigen-homepages-darkbloom — 2e35241c Deployed Nov 4, 2026 by vercel[bot]
Preview – d-inference-console-ui-dev — 2e35241c Deployed Nov 4, 2026 by vercel[bot]
Preview – d-inference — 2e35241c Deployed Nov 4, 2026 by vercel[bot]
Preview – darkbloom-status — 2e35241c Deployed Nov 4, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant