fix(monitor): prevent startup crash when helper watcher init fails#15
Merged
jdjingdian merged 2 commits intomainfrom Mar 24, 2026
Merged
fix(monitor): prevent startup crash when helper watcher init fails#15jdjingdian merged 2 commits intomainfrom
jdjingdian merged 2 commits intomainfrom
Conversation
Guard HelperToolMonitor source creation with valid file descriptors and expose start health for degraded monitoring paths. Enable RouterService fallback status polling and refresh on app activation when filesystem watchers are unavailable. Mark OpenSpec tasks done, sync updated specs, and archive 2026-03-24-fix-macos13-startup-crash.
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.
背景
在 macOS 13 环境下,应用启动阶段会在
HelperToolMonitor.start(changeOccurred:)必现崩溃。根因是目录监听初始化时,open(..., O_EVTONLY)失败后仍继续创建DispatchSource,触发EXC_BREAKPOINT (SIGTRAP)。变更内容
1) 修复启动崩溃(核心)
HelperToolMonitor中为每个监控目录增加open返回值校验,仅在fd >= 0时创建DispatchSource。StartReport,暴露监听初始化结果(可用 source 数量 / 失败信息)。start/stop生命周期改为幂等,避免重复注册与异常取消。2) 启动降级策略(保证可用性)
RouterService接入HelperToolMonitor.start的返回结果。helperStatus可更新。helperStatus更新增加去重,降低重复写和竞态风险。3) OpenSpec 同步与归档
fix-macos13-startup-crash变更任务已完成并归档:openspec/changes/archive/2026-03-24-fix-macos13-startup-crashopenspec/specs/helper-monitor-stability/spec.mdopenspec/specs/router-service/spec.md4) 版本信息
MARKETING_VERSION:2.2.1CURRENT_PROJECT_VERSION:66验证
xcodebuild -project StaticRouteHelper.xcodeproj -scheme "Static Router" -configuration Debug -sdk macosx build CODE_SIGNING_ALLOWED=NO12/12影响评估