Start backend automatically from macOS menu bar - #13
Merged
Conversation
The coordinator previously depended on SwiftUI view tasks and could not discover the standard installed or source launcher without a persisted command. Start it from the application lifecycle and resolve persisted, explicit, source-checkout, and ~/.local launcher configurations while preserving exact endpoint ownership checks. Verified with the 18 focused Swift lifecycle tests, a warnings-as-errors release build, all 262 Node tests, and an offline/start/reuse runtime smoke. The full Swift suite remains 38/40 because of the existing headless AppKit activation-policy and settings-window size failures.
skuznetsov
approved these changes
Aug 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Root cause
Backend startup depended on SwiftUI view tasks. A MenuBarExtra label is not guaranteed to enter the view hierarchy before the user opens it, so a newly launched app could remain idle. In addition, without tokenomics-launch.json or a manually configured fallback, the existing ~/.local/bin/tokenomics-launch and source launcher were not discovered.
Verification
Known baseline failures
The complete Swift suite is 38/40 in the current headless test environment. The two existing failures are AppKit-only assertions for NSApplication activation policy and settings-window content height. The coordinator, launcher, discovery, decoding, clock, preferences, quota, and non-headless window tests pass.
Residual risk
The coordinator prevents duplicate launch inside one app process. Two independently forced app processes starting during the same offline interval could still race before either endpoint becomes ready; normal macOS app launch does not create that situation without explicitly requesting another instance.