diff --git a/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift b/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift index 25cbba51..3e2c475e 100644 --- a/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift +++ b/mac/Sources/CodeBurnMenubar/CodeBurnApp.swift @@ -161,12 +161,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelegate { } private func prepareRefreshPipelineForSleep() { - // Cancel only in-flight work so a fetch started before sleep cannot - // apply a stale result after wake. The DispatchSource timer is paused - // by the kernel during sleep and fires normally on wake, so we leave - // it running — tearing it down here was the stranding bug: a missed - // wake notification left refreshTimer nil forever. The 5s rate limiter - // and single-flight forceRefreshTask guard absorb the wake burst. + // Leave the timer running: the kernel pauses it during sleep, and tearing + // it down stranded the loop whenever a wake notification was missed. forceRefreshTask?.cancel() forceRefreshTask = nil forceRefreshStartedAt = nil diff --git a/mac/Sources/CodeBurnMenubar/Security/CodeburnCLI.swift b/mac/Sources/CodeBurnMenubar/Security/CodeburnCLI.swift index befa3b1b..13a3e6c9 100644 --- a/mac/Sources/CodeBurnMenubar/Security/CodeburnCLI.swift +++ b/mac/Sources/CodeBurnMenubar/Security/CodeburnCLI.swift @@ -99,6 +99,13 @@ enum CodeburnCLI { return process } + // argv tokens are `isSafe`-validated and PATH entries are constants, so the + // result is safe to interpolate directly into the LaunchAgent shell script. + static func scriptEnvironment() -> (argv: [String], path: String) { + let basePath = ProcessInfo.processInfo.environment["PATH"] ?? "" + return (baseArgv(), augmentedPath(basePath)) + } + static func isSafe(_ s: String) -> Bool { let range = NSRange(s.startIndex..