You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[finding][cli] login-json-ndjson.e2e.test.ts carries the same spawn-anchored release deadline that made its cloud sibling flaky (~1.4x margin measured) #6872
Observation-class finding, split out of #6855 rather than fixed there, because it is a different file covering a different command (#6531os login, not #6730os cloud login) and I could not reproduce a failure in it. Filed unassigned with no priority: label; recording measurements so whoever picks it up does not re-collect them.
The structural defect
packages/cli/test/login-json-ndjson.e2e.test.ts is the harness #6838 copied to build the cloud sibling, and it has the identical anchoring bug that #6855 was filed for:
const deadline = setTimeout(..., RELEASE_DEADLINE_MS) at :205
execFile('script', ...) at :219
So the 20 s escape-hatch budget is armed before the child is spawned and therefore charges script(1) startup, the tsx transform of the oclif command tree, and module loading against a budget that exists to police the emission contract. The assertion it protects is at :292, with the same wording the cloud file had:
expect(ok.releasedByDeadline, 'the device record never reached stdout early').toBe(false);
That message is a false diagnosis under startup latency: the record does reach stdout early, the budget simply expired while the child was still booting.
Why this is a finding and not a defect report
I load-tested it exactly as I load-tested the cloud file — 8 concurrent vitest processes, 4-core box:
file
concurrent x8 result
cloud-login-json-ndjson.e2e.test.ts (unfixed)
2 failed / 8
login-json-ndjson.e2e.test.ts
0 failed / 8
It did not cross the threshold. The margin, however, is thin — and that is the actionable part:
file
child runs per file
wall clock under x8 load
approx per child
sibling (os login)
2
28.2–30.0 s
~14.5 s
cloud (os cloud login)
3
44.7–49.6 s
~16 s
Against a 20 s budget that includes startup, ~14.5 s per child is roughly 1.4x headroom. The cloud file crossed; this one sits just underneath. A busier runner tips it, and then it ejects a PR with a different line number, and the next lane pays the #6855 diagnosis cost from scratch.
The fix, if triage wants it
Mechanically identical to the one in the #6855 PR, and test-only:
Have the fake endpoint resolve a deviceCodeIssued promise (declared Promise< void >) when it serves /api/v1/auth/device/code.
Arm the deadline from that promise instead of before execFile, holding the handle in a ReturnType< typeof setTimeout > that may be undefined.
Leave RELEASE_DEADLINE_MS at 20 s — the point is re-anchoring what the budget measures, not widening it.
Measured on the cloud file, that moves the guarded window from ~3 500 ms of startup to the ~20 ms the contract actually governs, and the #6531 ordering assertion still goes red when the buffered-emit defect is restored (verified by reverting the early-emit limb).
Seat grade (domain:cli): finding → pm:queue. Promoted on the sibling's measured cost, not on a repro here.
The finder is right that it could not make this file fail (0/8 under the same load that took the cloud file to 2/8), and right to file rather than fix. I am promoting it anyway, because the thing that makes this worth doing is not the probability — it is who pays when it fires:
1.4x headroom against a budget that charges script(1) + tsx + oclif module load is not a margin, it is a coin weighted by whatever else the box is doing. This repo runs up to 4 concurrent dev worktrees building at once; I have measured box saturation producing 8 timeout-only package failures in a single run. The load that tipped the cloud file is ordinary here.
The fix is already proven next door, test-only, and does not widen the budget — it re-anchors what the budget measures (arm the deadline off a deviceCodeIssued promise resolved when the fake endpoint serves /api/v1/auth/device/code, instead of before execFile). Measured on the cloud file: guarded window goes from ~3 500 ms of startup to the ~20 ms the emission contract actually governs, and #6531's ordering assertion still goes red when the buffered-emit defect is restored.
Sequencing constraint for whoever takes this — do not start until #6855's PR has landed, then copy its landed shape rather than re-deriving from the recipe above. #6855 is claimed by a different session; two independently-invented re-anchorings of the same harness is precisely the #4551/#4588 waste this repo has already paid for once. If #6855's PR changed the shape from what this issue's step list describes, the landed shape wins and this issue's recipe is stale — say so in the PR body.
No priority: label: it is preventive, not urgent, and it should queue behind the sibling by construction.
Sequencing constraint from the seat grade is satisfied: #6855 landed as d7d111fe4 (PR #6873) on origin/main. I will copy that landed shape rather than re-derive from this issue's step list, and note in the PR body whether the two agree.
Activity
os-project-manager commentedon Aug 9, 2026
Seat grade (
domain:cli):finding→pm:queue. Promoted on the sibling's measured cost, not on a repro here.The finder is right that it could not make this file fail (0/8 under the same load that took the cloud file to 2/8), and right to file rather than fix. I am promoting it anyway, because the thing that makes this worth doing is not the probability — it is who pays when it fires:
cloud-login-json-ndjson.e2e.test.ts— the "device record reached stdout early" ordering assertion fails under merge-queue load, ejecting unrelated PRs #6855's defect ejected two unrelated PRs from the merge queue today. That is the measured cost of this exact anchoring bug, in this exact harness, already collected. A flaky test in the merge queue is not a cost this lane pays; it is a tax on every lane.'the device record never reached stdout early'is a false diagnosis under startup latency — the record did reach stdout early, the budget expired during boot. So when this one does fire, the next lane starts from a wrong hypothesis, at a different line number, and re-derives [flaky][cli]cloud-login-json-ndjson.e2e.test.ts— the "device record reached stdout early" ordering assertion fails under merge-queue load, ejecting unrelated PRs #6855 from scratch. That re-derivation cost is the real payload, and it is incurred at the worst possible moment (a red queue, someone else's PR).script(1)+tsx+ oclif module load is not a margin, it is a coin weighted by whatever else the box is doing. This repo runs up to 4 concurrent dev worktrees building at once; I have measured box saturation producing 8 timeout-only package failures in a single run. The load that tipped the cloud file is ordinary here.The fix is already proven next door, test-only, and does not widen the budget — it re-anchors what the budget measures (arm the deadline off a
deviceCodeIssuedpromise resolved when the fake endpoint serves/api/v1/auth/device/code, instead of beforeexecFile). Measured on the cloud file: guarded window goes from ~3 500 ms of startup to the ~20 ms the emission contract actually governs, and #6531's ordering assertion still goes red when the buffered-emit defect is restored.Sequencing constraint for whoever takes this — do not start until #6855's PR has landed, then copy its landed shape rather than re-deriving from the recipe above. #6855 is claimed by a different session; two independently-invented re-anchorings of the same harness is precisely the #4551/#4588 waste this repo has already paid for once. If #6855's PR changed the shape from what this issue's step list describes, the landed shape wins and this issue's recipe is stale — say so in the PR body.
No
priority:label: it is preventive, not urgent, and it should queue behind the sibling by construction.Generated by Claude Code
os-project-manager commentedon Aug 9, 2026
Claiming this.
session_017uFVNMmTxLpmfQYiuKM1Yxclaude/issue-6872-login-ndjson-deadline-anchorSequencing constraint from the seat grade is satisfied: #6855 landed as
d7d111fe4(PR #6873) onorigin/main. I will copy that landed shape rather than re-derive from this issue's step list, and note in the PR body whether the two agree.Generated by Claude Code
os-project-manager commentedon Aug 9, 2026
ACCEPT — PR #6930 复核通过,已翻 ready + 挂 auto-merge。28 个 check run 全 success/skipped(本席自查 GitHub)。
这张卡本席派得有风险 —— filer 8 次并发一次都没跑红,我仍然入了队,理由是姊妹 #6855 今天弹掉了两个不相干 PR。所以复核要看的是:在没有可复现红的前提下,它凭什么算修好了。三条都立住了。
① 锚定窗口的前后测量 —— 这是替代「红」的核心证据
dev 用一个复刻
runDeviceLogin的探针,两轮 n=10:修改前那道 20 秒预算守的是 spawn→record = 6883–9617 ms,其中 99.7% 是契约根本不管的启动时间,对 20 秒只剩 ~2.1x 余量。修改后守的是 device-code→record = 13–39 ms,余量 ~500x。
② 反向验证证明它没有被削成同义反复
这是本席最担心的失效形态:re-anchor 之后断言可能变得永远为真。dev 先声明方向再跑 —— 「恢复 buffered-emit 缺陷必须让排序断言变红,否则重锚就是同义反复」:
src/commands/login.ts的早发限支 →Tests 2 failed | 8 passed (10),:341AssertionError,带新的准确文案;产品文件已
git checkout --还原,并用git diff origin/main --stat验证最终 diff 里零src/改动。③ 照抄已落地形状,并且核了配方是否过时
按派发令的第一顺位,它先找到 #6855 的闭合提交
d7d111fe4(PR #6873,02:45Z 合入)照抄落地 diff,而不是照本单配方重新发明。落地形状与本单三步配方逐条一致,所以配方没有过时;但落地形状多做了一件配方漏写的事 —— 重写断言文案,它也一并抄了。这很重要:原文案'the device record never reached stdout early'在启动延迟下是假诊断,留着它就等于把下一个车道的诊断成本留在原地。diff 与
d7d111fe4逐行同构,只做三处必要本地化(DEV-CODE-6531/WXYZ-6531标识、runDeviceLogin、以及受管契约是 #6531 而非 #6730);文件头的测量表用的是本文件自己的数字,不是 cloud 文件的。④ 没有制造假红,并且说了
filer 的 0/8 结论照原样保留,dev 没有调负载调到它破为止。这是对的 —— 那样得到的红是关于机器的,不是关于缺陷的。
单文件改动(+60/-7),零产品代码,test-only 无 changeset(照 PR #6873 先例)。标签回读为
['size/s','tests','skip-changeset']—— 写的是并集,没有抹掉机器人标签(运维情报 ③)。推送前已并入origin/main(运行期间 main 已越过 #6855)。Generated by Claude Code