fix(start.sh): 后台 detach 启动,修复 Code 模块 Offline - #55
Merged
Conversation
start.sh 原用 exec 前台启动 fusion-code,进程不退出。 Fusion-Studio UpstreamServiceManager.runStartSh 对 start.sh start 设 30s 超时强制 terminate,前台 exec 不返回 → 30s 后连同刚启动的服务一起被杀, Code 模块显示 Offline。 改为参考 fusion-projects/start.sh:nohup 后台 + PID 文件 + start|stop|status|restart 子命令。start 立即返回,服务 detach 存活;stop 按 PID 文件优雅停 + 强杀兜底。 Closes #54 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR #55 的 start.sh 后台 detach 会生成 .fusion-code.pid 与 logs/ 目录, 未加入 .gitignore 会污染工作树 (当前 .fusion-code.pid 已出现在 untracked)。 补齐忽略规则。 Co-Authored-By: Claude <noreply@anthropic.com>
dahai80
added a commit
that referenced
this pull request
Aug 7, 2026
补丁版本: - fix(start.sh): 后台 detach (nohup) 启动,新增 start|stop|status|restart 子命令, PID 文件 + 日志目录管理,避免被 Studio 30s 超时连带终止,修复 Code 模块 Offline (#55) - chore: gitignore start.sh 运行时产物 (.fusion-code.pid, logs/) 测试: tsc=0, biome=0 error, 345 tests pass, build OK, --version=0.4.16 CI: PR #55 success Co-Authored-By: Claude <noreply@anthropic.com>
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.
背景
Closes #54
点击 Fusion-Studio 的 Code 菜单,第三列显示 Offline,端口 11441 不监听。
根因
start.sh末尾exec ./fusion-code --serve是前台启动,进程不退出。Studio 的UpstreamServiceManager.runStartSh对start.sh start设 30s 超时强制 terminate,前台 exec 不返回 → 30s 后连同刚启动的服务一起被杀 → 健康探测失败 → Offline。修复
参考
fusion-projects/start.sh模式,改为后台 detach:nohup ./fusion-code --serve ... &+ 写 PID 文件.fusion-code.pidstart|stop|status|restart,start立即返回logs/stdout.log/logs/stderr.logstop优雅停 + 5s 后强杀兜底验证
启动后即使调用进程被终止,服务仍存活——这是修复的关键点。
🤖 Generated with Claude Code