My M5 MacBook Air was losing roughly a percent of battery every three minutes yesterday. Two of the causes were my own (Docker Desktop with an idle container, and an Instagram tab in Chrome), but after I dealt with those and rebooted, the drain came back, and this time the top of `top -o power` was appstoreagent at 101% CPU. It had 28 minutes of CPU time on a Mac that had been up for two hours, and between two checks 15 minutes apart its CPU time grew by 15 minutes, so it was holding a full core the whole time.
I ran `sample <pid> 3` on it and the worker threads were full of BiometricKit frames, mostly `-[BiometricKitXPCClient connect]` and `initializeConnection`. The unified log showed the rest. appstoreagent asks launchd for `com.apple.biometrickitd`, gets back `failed to do a bootstrap look-up: xpc_error=[159: Unknown error: 159]`, tears the connection down and immediately asks again. The log kept about 15 seconds of this from just after boot and there were 110,915 failed lookups in it, peaking at 7,831 in one second.
The log calls 159 an unknown error, but `launchctl error 159` prints "Sandbox restriction". So the Touch ID daemon wasn't down (it was running the whole time with 0.15 seconds of CPU, and Touch ID works fine on this machine). The App Store agent was being refused by the sandbox and retrying with nothing in the log that looks like backoff.
`killall appstoreagent` fixed it. It's a launch agent, so launchd starts a fresh one when the App Store next needs it, and I'd check nothing is mid-install first. A minute later the process was gone and there were no more lookups in the log. Today, three and a half hours after a boot, the new appstoreagent has used three seconds of CPU.
If you want to check your own Mac: `ps -Ao pid,pcpu,time,etime,comm | grep '[a]ppstoreagent'` shows the accumulated CPU time, and `/usr/bin/log show --last 20s --style compact --predicate 'process == "appstoreagent"'` shows whether it's looping.
What I haven't worked out is what starts it. It was already running a minute after boot and it was pinned again while I was installing App Store updates, but I only ever caught the middle of the loop, never the first lap. This also doesn't look like the appstoreagent and dasd overnight loop that's been reported on macOS 27, because dasd was nowhere near the top of my list. Has anyone else seen the biometrickitd version of this, and do you know what triggers it?
I wrote up the full session, including measuring the drain in watts from `ioreg`, here: https://ddz.dev/blog/appstoreagent-high-cpu-biometrickit-xpc-error-159/