Repository navigation
fix(engine): up --wait 只按本次运行确认就绪 - #278
Merged
Merged
Conversation
waitForStartReady 直接调用 groupRowsObserved,就绪规则只能靠真实扫描或超时来观察。收成包级变量 startRows(生产仍读 status 的同一快照),让规则可以在指定的状态行上验证。 Co-Authored-By: Claude Code <noreply@anthropic.com>
A 启动 R1 并等待时,B 把同一服务重启为 R2;R2 健康后,等待会把 R2 的健康算到 R1 头上并报告就绪。 就绪判定现在先认运行身份:状态行指名另一个运行即为 run_replaced,立即失败且不停任何运行; 状态行无法指名本次运行时(包括未归属到该运行的监听)不算就绪,继续等待; 完全没有 run_id 的旧 daemon 没有可比对的身份,保持原来的服务行判定。 Co-Authored-By: Claude Code <noreply@anthropic.com>
补充 --wait 的归属规则:状态行指名另一运行即 run_replaced 且不停任何运行;无法指名本次运行不算就绪; 没有 run_id 的 chunk 保持旧行为。中英文同步。 Co-Authored-By: Claude Code <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.
问题
A 用
up --wait启动 R1 并在客户端等待时,B 把同一 worktree 的同一服务重启为 R2。waitForStartReady在确认运行身份之前就用服务行的健康状态判定成功:R2 健康后,A 会把 R2 的结果算到 R1 头上并输出就绪。上一步的误停问题(超时清理按 run_id 授权)已关闭,这里是同一类结果归属错误。改动
engine/internal/cmd/up_ready.go):状态行指名另一个运行即为run_replaced,立即以failed结束并不停止任何运行(替换运行不是本次调用启动的)。run_id的旧 daemon 没有可比对的身份,保持原来的服务行判定。docs/cli.md/docs/cli.zh.md同步说明;JSON 的state仍是failed,新增 reason 值,不改 schema。验证(实际执行)
go build ./...、go vet ./...、go test -count=1 -timeout=8m ./...(engine,已合并 origin/mainbba30941):通过go test -race ./internal/cmd/ -count=1:通过python3 scripts/check_docs.py:6 pair(s) consistentpython3 -m unittest discover -s scripts -p '*_test.py':267 tests OK(skipped=1)TestWaitForStartReadyCreditsOnlyTheRunItIsAbout在修复前失败(run run-r1 was reported ready on run run-r2's evidence),修复后通过;TestWaitForStartReadyConfirmsItsOwnRun、TestWaitForStartReadyKeepsLegacyChunksUsable防止规则过度收紧。真实场景与未覆盖
在隔离
HOME/BERTH_HOME的丢弃项目里用restart跑了 4 次:修复前后二进制都先观察到 R1 的停止退出(reason=stopped),本地没有命中“R2 先于 R1 退出记录登记、旧退出被 generation 守卫丢弃”的竞态窗口,R2 先登记的时间窗口在本地不可控。该状态由回归测试直接构造(状态行指名 R2 且健康、无 R1 退出记录)。完整 race 门槛与真实服务清单按每日/发版路径执行,本 PR 未跑。🤖 Generated with Claude Code