Bug 1781629 - keep macOS notifications off test worker screens (safe re-land) - #1357
Bug 1781629 - keep macOS notifications off test worker screens (safe re-land)#1357rcurranmoz wants to merge 2 commits into
Conversation
…re-land) Second attempt. #1354 was reverted in #1355 because it managed the Focus assertion files under ~/Library/DoNotDisturb, which the atboot puppet run cannot write. Root cause of that failure: puppet's ruby is denied kTCCServiceSystemPolicyAllFiles, while macos_tcc_perms grants it to /usr/sbin/sshd and /usr/libexec/sshd-keygen-wrapper. Running run-puppet.sh over ssh therefore borrows sshd's Full Disk Access and the write succeeds; the same catalog applied by org.mozilla.atboot_puppet has no such grant and fails with EPERM on a lock file. The staging validation was invalid by construction, not merely insufficient -- it exercised a TCC context production never uses. Granting puppet FDA would need an MDM PPPC payload, which is out of scope here. Changes from #1354: - No writes to any TCC protected location. The whole Monterey-and-later Focus branch is gone, along with the four payload files. Assertions.json is dropped too, since nothing references it now. There is no DND layer above Big Sur; the agent disables are the actual fix and they need no TCC grant. - Every script exits 0 in command mode. run-puppet.sh forces retval=1 on any "^Error:" in the log and mails a failure report per host per boot, so on reboot-per-task pools one unlucky resource is a mail flood plus a fleet-wide false red in last_run_metadata.json. Partial failures now warn and retry. - clear_notification_store.sh treats an unreadable store as nothing-to-do rather than work-pending, so the macOS 13+ store being TCC protected cannot make the exec run on every apply forever. - Wired to the three staging roles ONLY. Production roles are deliberately untouched until this has survived real reboots on staging. Retained from #1354 (all verified on Catalina, Sonoma and Sequoia): resolving cltbld's uid at run time, writing the launchd override plist so the disable survives the per-task reboot, accepting both spellings of launchctl's disabled value, and not killing cfprefsd after the DND write. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Puppet on these roles is not started by org.mozilla.atboot_puppet; nothing in the gecko-t macOS roles installs that. It is started by the org.mozilla.worker-runner LaunchDaemon, whose worker-runner.sh calls run-puppet.sh and only then starts the worker. No behaviour change. The TCC reasoning is unaffected -- worker-runner runs as root with no Full Disk Access grant either -- and the ordering claim is actually confirmed rather than weakened: puppet genuinely does run before the worker starts, so restarting NotificationCenter cannot land mid-task. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Validation resultRun on
Run 2 is not an idempotency result — the three scripts legitimately changed because that commit edited their comments. Run 3, on the identical commit, is the convergence proof. On-host state after run 1: The Zero Two notes for reviewers
Separately, and not caused by this change: the m4 staging pool is drifting. |
Second attempt at Bug 1781629, after #1354 was reverted in #1355. Staging roles only.
Why #1354 broke, precisely
It managed the Focus assertion files under
~/Library/DoNotDisturb, which is TCC protected.macos_tcc_permsgrantskTCCServiceSystemPolicyAllFilesto/usr/sbin/sshdand/usr/libexec/sshd-keygen-wrapper(auth_value 2), but puppet's interpreter/opt/puppetlabs/puppet/bin/rubyis denied it (auth_value 0):I validated #1354 by running
run-puppet.shover SSH, which inherits sshd's Full Disk Access, so the protected write succeeded. The same catalog applied byorg.mozilla.atboot_puppethas no such grant and fails withEPERMon a lock file. The staging validation was invalid by construction, not merely thin — it exercised a TCC context production never uses.What made it look like something else during triage: the directory permissions are unremarkable (
drwxr-xr-x cltbld:staff, no restricted flags) andsudo mkdirin that exact directory succeeds by hand — because that is over SSH too.Granting puppet FDA would need an MDM PPPC payload, which is MDM-only and out of scope here. So the Focus path is abandoned rather than fixed.
What changed
Settings.sqlitethat was truncating cltbld's real Focus database) andAssertions.json, now unreferenced. There is no DND layer above Big Sur. The agent disables are the actual fix and need no TCC grant.run-puppet.shforcesretval=1on any^Error:in the log and mails a failure report per host per boot, so on reboot-per-task pools one unlucky resource is a mail flood plus a fleet-wide false red inlast_run_metadata.json. That amplification is what turned Bug 1781629 - keep macOS notifications off test worker screens #1354 from a no-op into an incident. Partial failures now warn and are retried next boot. The only non-zero exits are inside the--check/--countguard modes, where puppet requires them.Retained from #1354, all verified on Catalina, Sonoma and Sequoia: resolving cltbld's uid at run time (it is not derivable from the OS version — 36, 555 and 1025 all occur), writing the launchd override plist so the disable survives the per-task reboot, accepting both spellings of launchctl's disabled value, and not killing
cfprefsdafter the DND write.Testing
Puppet validate, puppet-lint and shellcheck green.
Validated by actual reboot on
macmini-m4-113(macOS 15.3, the OS that broke), reading/var/log/puppet/puppet.outfrom the atboot run. SSH-driven applies are no longer accepted as evidence for this module. Result posted as a comment below.Follow-ups, not in this PR
macmini-r8-154has a truncatedSettings.sqlitefrom the old module. Nothing repairs it now that the file is unmanaged; needs a manual restore from a clean host.macos_utils::suppress_keyboard_assistantmaps OS major to cltbld's uid and is wrong on any host where it is 1025. Same class of silent bug.🤖 Generated with Claude Code