fix(cli): replace existing runner on start#754
Merged
Conversation
There was a problem hiding this comment.
Findings
- 未发现需要阻断合入的明确问题。
Summary
- Review mode: initial
- 已检查 PR 元数据、完整 diff、
README.md、AGENTS.md、cli/README.md,以及 runner stop/start 相关实现上下文。未发现本次新增/修改行引入的高置信度 correctness/security/regression 问题。 - 残余风险:本地环境缺少
bun,无法在当前 runner 里实际执行新增测试;依赖 CI 覆盖cli/src/commands/runner.test.ts和 CLI typecheck。
Testing
- Not run (automation):
bun --cwd cli vitest run src/commands/runner.test.tsfailed becausebunis not installed in this environment.
HAPI Bot
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.
变更概述
hapi runner start发现已有 runner 时,先停止旧 runner,再启动新的 detached runner。start会替换已有 runner,让新参数和环境变量生效。原因
旧逻辑会直接 spawn
runner start-sync,而start-sync发现已有同版本/同身份 runner 后会直接退出。外层start只检查“有 runner 在运行”,导致输出Runner started successfully,但实际仍是旧 runner,新传入的--workspace-root、环境变量或配置不会生效。影响范围
hapi runner start行为:从“如果已有 runner 则沿用”改为“替换已有 runner”。hapi runner stop/status/list/stop-session/logs不变。验证结果
C:\Users\junes\.bun\bin\bun.exe run --cwd cli vitest run src/commands/runner.test.tsC:\Users\junes\.bun\bin\bun.exe run --cwd cli tsc --noEmitgit diff --check风险/回滚
hapi runner start会重启 runner,不再静默复用旧 runner。Reviewer notes
start分支中 stop -> wait stopped -> spawn 的顺序。stopRunner(),并保留--workspace-root参数传给新 runner。