Skip to content

test(cli): bind ephemeral loopback port in container-mode tests (#13775) - #13778

Merged
yiliang114 merged 3 commits into
mainfrom
autofix/issue-13775
Oct 10, 2026
Merged

yiliang114 merged 3 commits into
mainfrom
autofix/issue-13775

Conversation

@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator

What this PR does

Makes the two container-mode tests in the Managed Runtime container-entry suite stop binding the hard-coded container port 43190 for real. A new test-local helper spies on the HTTP server's listen, keeps the requested (43190, '0.0.0.0') arguments observable for assertions, but performs the actual bind on an ephemeral loopback port (0, '127.0.0.1') — the same pattern the sibling attestation-worker suite already uses for its own container-mode test. The explicit-port test still asserts the worker was asked to listen on (43190, '0.0.0.0'), and now derives the expected ready URL from the actually bound address instead of a hard-coded port. No production code changes.

Why it's needed

A main-branch CI run failed on exactly these two tests (issue #13775, run 37925143593 at 8c127de524a6). Both tests bind fixed port 43190 on 0.0.0.0; the Test (ubuntu-latest, Node 22.x) job can run on the shared self-hosted ecs-qwen fleet where several jobs share one host, so any neighbor holding 43190 fails both tests with EADDRINUSE while everything else passes. Locally holding the port with a throwaway process reproduces the identical failure signature (2 failed / 11 passed, listen EADDRINUSE: address already in use 0.0.0.0:43190); with this change the suite passes whether or not 43190 is occupied.

Reviewer Test Plan

How to verify

Confirm the flake mechanism and its removal: in one shell, hold the port with node -e "require('node:net').createServer().listen(43190, '0.0.0.0', () => setInterval(() => {}, 1000))"; in another, run cd packages/cli && npx vitest run src/serve/managed-runtime-container.test.ts. Before this change the two container-mode tests fail with EADDRINUSE; after it, all 13 tests pass. Also run the file normally (port free) — all 13 tests pass — and npx vitest run src/serve/managed-runtime-container.test.ts src/serve/managed-runtime-attestation-worker.test.ts for the pair of container-mode suites (42 passed). The retained behavioral witness: mutating the source bind port from 43190 to anything else makes opens the explicit container port with authenticated attestation fail at the toHaveBeenCalledWith(43190, '0.0.0.0') assertion.

Evidence (Before & After)

N/A — test-only change, no user-visible behavior.

Tested on

OS Status
🍏 macOS ⚠ïļ
🊟 Windows ⚠ïļ
🐧 Linux ✅

Environment (optional)

N/A — unit tests only (npx vitest run in packages/cli).

Risk & Scope

  • Main risk or tradeoff: the container-mode tests no longer exercise a real bind to the fixed port; that is deliberate (it is what made them flaky on shared CI hosts) and the explicit-port request remains asserted via the listen spy, matching the sibling suite's established pattern.
  • Not validated / out of scope: the real 43190 bind in production container startup is unchanged and untested here; other suites' use of fixed ports was not audited.
  • Breaking changes / migration notes: none.

Linked Issues

Fixes #13775

äļ­æ–‡čŊŽ

čŋ™äļŠ PR 做䚆äŧ€äđˆ

čŪĐ Managed Runtime åŪđå™Ļå…ĨåĢæĩ‹čŊ•åĨ—äŧķäļ­įš„äļĪäļŠåŪđå™ĻæĻĄåžæĩ‹čŊ•äļå†įœŸåŪžįŧ‘åŪšįĄŽįž–į įš„åŪđå™ĻįŦŊåĢ 43190。新åĒžįš„æĩ‹čŊ•内čū…åŠĐå‡―æ•° spy HTTP æœåŠĄå™Ļįš„ listen,äŋį•™åŊ断čĻ€įš„čŊ·æą‚参数 (43190, '0.0.0.0'),ä―†įœŸåŪžįŧ‘åۚæ”đäļšäļīæ—ķ回įŽŊįŦŊåĢ (0, '127.0.0.1')——äļŽå…„垟 attestation-worker æĩ‹čŊ•åĨ—äŧķäļšå…ķåŪđå™ĻæĻĄåžæĩ‹čŊ•采į”Ļįš„æĻĄåžäļ€č‡ī。æ˜ū垏įŦŊåĢæĩ‹čŊ•äŧį„ķ断čĻ€ worker čĒŦčĶæą‚į›‘åŽ (43190, '0.0.0.0'),åđķæ”đäļšäŧŽåŪžé™…įŧ‘åŪšįš„åœ°å€æŽĻåŊžæœŸæœ›įš„ ready URL,而äļå†įĄŽįž–᠁įŦŊåĢ。äļæ”đåŠĻäŧŧä―•į”Ÿäš§äŧĢį ã€‚

äļšäŧ€äđˆéœ€č́

äļŧ分æ”Ŋįš„äļ€æŽĄ CI čŋčĄŒæ°åĨ―åœĻčŋ™äļĪäļŠæĩ‹čŊ•äļŠåĪąčīĨ(issue #13775,čŋčĄŒ 37925143593,提äšĪ 8c127de524a6)。äļĪäļŠæĩ‹čŊ•éƒ―åœĻ 0.0.0.0 äļŠįŧ‘åŪšå›šåۚįŦŊåĢ 43190;Test (ubuntu-latest, Node 22.x) ä―œäļšåŊčƒ―čŋčĄŒåœĻå…ąäšŦįš„č‡Šæ‰˜įŪĄ ecs-qwen 朚įūĪäļŠ,åΚäļŠä―œäļšå…ąäšŦ同äļ€å°äļŧ朚,因æ­Īäŧŧä―•å į”Ļ 43190 įš„é‚ŧåą…éƒ―äžščŪĐčŋ™äļĪäļŠæĩ‹čŊ•äŧĨ EADDRINUSE åĪąčīĨ,而å…ķä―™æĩ‹čŊ•å…ĻéƒĻ通čŋ‡ã€‚朎地į”Ļäļ€äļŠäļīæ—ķčŋ›įĻ‹å į”ĻčŊĨįŦŊåĢåģåŊåĪįŽ°åیå…Ļį›ļåŒįš„åĪąčīĨį‰đåū(2 åĪąčīĨ / 11 通čŋ‡,listen EADDRINUSE: address already in use 0.0.0.0:43190);åš”į”Ļ朎æ”đåŠĻ后,无čŪš 43190 æ˜ŊåĶčĒŦ占į”Ļ,åĨ—äŧķéƒ―čƒ―é€ščŋ‡ã€‚

čŊ„åŪĄéŠŒčŊčŪĄåˆ’

åĶ‚ä―•éŠŒčŊ

įĄŪčŪοЖåŠĻ朚åˆķ及å…ķæķˆé™Ī:åœĻäļ€äļŠįŧˆįŦŊäļ­į”Ļ node -e "require('node:net').createServer().listen(43190, '0.0.0.0', () => setInterval(() => {}, 1000))" 占į”ĻįŦŊåĢ;åœĻåĶäļ€äļŠįŧˆįŦŊäļ­čŋčĄŒ cd packages/cli && npx vitest run src/serve/managed-runtime-container.test.ts。æ”đåŠĻ前,äļĪäļŠåŪđå™ĻæĻĄåžæĩ‹čŊ•äŧĨ EADDRINUSE åĪąčīĨ;æ”đåŠĻ后,13 äļŠæĩ‹čŊ•å…ĻéƒĻ通čŋ‡ã€‚同æ—ķåœĻįŦŊåĢįĐšé—ēæ—ķæ­ĢåļļčŋčĄŒčŊĨ文äŧķ——13 äļŠæĩ‹čŊ•å…ĻéƒĻ通čŋ‡â€”—åđķį”Ļ npx vitest run src/serve/managed-runtime-container.test.ts src/serve/managed-runtime-attestation-worker.test.ts čŋčĄŒäļĪäļŠåŪđå™ĻæĻĄåžåĨ—äŧķ(42 äļŠé€ščŋ‡)。äŋį•™įš„čĄŒäļšč§čŊ:å°†æšį äļ­įš„įŧ‘åۚįŦŊåĢäŧŽ 43190 æ”đ成äŧŧä―•å…ķäŧ–倞,侚ä―ŋ opens the explicit container port with authenticated attestation åœĻ toHaveBeenCalledWith(43190, '0.0.0.0') 断čĻ€åĪ„åĪąčīĨ。

前后åŊđæŊ”čŊæŪ

N/A —— äŧ…æĩ‹čŊ•æ”đåŠĻ,无į”Ļ户åŊ见行äļšã€‚

æĩ‹čŊ•åđģ台

OS Status
🍏 macOS ⚠ïļ
🊟 Windows ⚠ïļ
🐧 Linux ✅

įŽŊåǃ(åŊ选)

N/A —— äŧ…单元æĩ‹čŊ•(åœĻ packages/cli äļ­ npx vitest run)。

éĢŽé™ĐäļŽčŒƒå›ī

  • äļŧč́éĢŽé™Đæˆ–æƒčĄĄ:åŪđå™ĻæĻĄåžæĩ‹čŊ•äļå†įœŸåŪžįŧ‘åŪšå›šåۚįŦŊåĢ;čŋ™æ˜Ŋ有意äļšäđ‹(æ­Ģæ˜ŊåœĻå…ąäšŦ CI äļŧ朚äļŠé€ æˆæŠ–åŠĻįš„åŽŸå› ),ä˜ū垏įŦŊåĢčŊ·æą‚äŧé€ščŋ‡ listen spy 断čĻ€,äļŽå…„垟åĨ—äŧķįš„æ—Ē有æĻĄåžäļ€č‡ī。
  • 朊銌čŊ / čķ…å‡ščŒƒå›ī:į”Ÿäš§įŽŊåǃåŪđå™ĻåŊåŠĻæ—ķᜟåŪžįš„ 43190 įŧ‘åۚäŋæŒäļå˜,äļåœĻ朎 PR æĩ‹čŊ•čŒƒå›ī内;朊åŪĄčŪĄå…ķäŧ–åĨ—äŧķåŊđ囚åۚįŦŊåĢįš„ä―ŋį”Ļ。
  • į ī坏性变æ›ī / čŋį§ŧčŊŽ:无。

å…ģ联 Issue

Fixes #13775

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator Author

Autofix E2E Report — Issue #13775

Summary

Main CI (Test (ubuntu-latest, Node 22.x), run 37925143593, commit 8c127de524a6) failed on exactly two tests in packages/cli/src/serve/managed-runtime-container.test.ts:

  • Managed Runtime container entry > wires the gate in the actual boot3 startup while preserving boot2 route ownership
  • Managed Runtime container entry > opens the explicit container port with authenticated attestation

These are the only two tests in the file — and, after this fix, in the package — that bind the hard-coded container port 43190 on 0.0.0.0 for real. The job runs on the shared self-hosted ecs-qwen fleet where several jobs share one host (see the maxWorkers/RUNNER_NAME notes in packages/cli/vitest.config.ts and the CI workflow's per-fork bounding), so a neighbor job or leftover process holding 43190 makes both tests fail with EADDRINUSE while everything else passes.

Root cause

startManagedRuntimeAttestationWorker(..., containerMode = true) always binds the fixed port 43190 on 0.0.0.0 (managed-runtime-attestation-worker.ts). The sibling suite managed-runtime-attestation-worker.test.ts had already solved this for its own container-mode test: it mocks Server.prototype.listen so the worker is still asked for (43190, '0.0.0.0') while the real socket binds an ephemeral loopback port (0, '127.0.0.1'). managed-runtime-container.test.ts never adopted that pattern and bound 43190 for real — fine in isolation, flaky on a shared CI host.

Reproduction (before the fix)

With a throwaway holder process occupying the port (net.createServer().listen(43190, '0.0.0.0')), running npx vitest run src/serve/managed-runtime-container.test.ts in packages/cli reproduced the CI signature exactly:

× Managed Runtime container entry > wires the gate in the actual boot3 startup while preserving boot2 route ownership
  → listen EADDRINUSE: address already in use 0.0.0.0:43190
× Managed Runtime container entry > opens the explicit container port with authenticated attestation
  → listen EADDRINUSE: address already in use 0.0.0.0:43190
Tests  2 failed | 11 passed (13)

Exactly the two tests from the issue failed; every other test in the file passed.

Fix

Test-only change in managed-runtime-container.test.ts, following the pattern the sibling suite established:

  • Added a small mockEphemeralListen() helper that spies on Server.prototype.listen, keeps the requested (43190, '0.0.0.0') arguments observable, but performs the real bind on (0, '127.0.0.1') — an ephemeral loopback port that cannot collide with anything off-process.
  • wires the gate in the actual boot3 startupâ€Ķ uses the helper before starting the container worker; all of its traffic already goes through worker.ready.url, which both createManagedContextReady (boot v2/v3) and the v1 ready record derive from the actually bound port, so nothing else in the test changed.
  • opens the explicit container port with authenticated attestation now asserts listen was called with (43190, '0.0.0.0') — preserving the "explicit container port" witness — and asserts worker.ready.url against the real bound address instead of a hard-coded 43190. The authenticated-attestation flow (401 without a token, 200 with it, no-store, token never echoed) is unchanged.

No production code was modified.

Verification

  • node -e port-holder + cd packages/cli && npx vitest run src/serve/managed-runtime-container.test.ts (before fix) — reproduced: 2 failed / 11 passed with EADDRINUSE 0.0.0.0:43190, matching the CI signature.
  • Mutation probe: temporarily changed the source bind port 43190 → 43191 in managed-runtime-attestation-worker.ts and reran the file — opens the explicit container port with authenticated attestation failed at expect(listen).toHaveBeenCalledWith(43190, '0.0.0.0'), proving the assertion still witnesses the explicit-port behavior. Source restored and confirmed via grep.
  • cd packages/cli && npx vitest run src/serve/managed-runtime-container.test.ts (after fix, port free) — 13 passed / 13.
  • Port-holder + same command (after fix, port 43190 occupied) — 13 passed / 13: the original failure condition no longer affects the suite.
  • cd packages/cli && npx vitest run src/serve/managed-runtime-container.test.ts src/serve/managed-runtime-attestation-worker.test.ts — 42 passed / 42 across both container-mode suites.
  • npm run build — passed.
  • npm run typecheck — passed.
  • npm run lint — passed (also re-checked by the pre-commit hook: prettier + eslint on the staged file, clean).

Environment note: the exact CI failure was host-specific (shared ecs-qwen runner), so it cannot be replayed against the real CI environment locally; the held-port probe above is the faithful surrogate and reproduces the identical failing signature. The workflow's independent CI remains the final gate.

äļ­æ–‡čŊŽ

Autofix E2E æŠĨ告 — Issue #13775

摘č́

äļŧ分æ”Ŋ CI(Test (ubuntu-latest, Node 22.x),čŋčĄŒ 37925143593,提äšĪ 8c127de524a6)恰åĨ―åœĻ packages/cli/src/serve/managed-runtime-container.test.ts įš„äļĪäļŠæĩ‹čŊ•äļŠåĪąčīĨ:

  • Managed Runtime container entry > wires the gate in the actual boot3 startup while preserving boot2 route ownership
  • Managed Runtime container entry > opens the explicit container port with authenticated attestation

čŋ™äļĪäļŠæ˜ŊčŊĨ文äŧķäļ­â€”—äŧĨåŠæœŽæŽĄäŋŪåĪåŽæ•īäļŠåŒ…äļ­â€”—äŧ…æœ‰įš„įœŸåŪžįŧ‘åŪšįĄŽįž–į åŪđå™ĻįŦŊåĢ 43190(0.0.0.0)įš„æĩ‹čŊ•。čŊĨ CI ä―œäļščŋčĄŒåœĻå…ąäšŦįš„č‡Šæ‰˜įŪĄ ecs-qwen 朚įūĪäļŠ,åΚäļŠä―œäļšå…ąäšŦ同äļ€å°äļŧ朚(见 packages/cli/vitest.config.ts äļ­å…ģ䚎 maxWorkers/RUNNER_NAME įš„æģĻ释äŧĨ及 CI å·Ĩä―œæĩäļ­įš„ fork 数量限åˆķ),因æ­Īé‚ŧåą…ä―œäˆ–æŪ‹į•™čŋ›įĻ‹å į”Ļ 43190 æ—ķ,čŋ™äļĪäļŠæĩ‹čŊ•äžšäŧĨ EADDRINUSE åĪąčīĨ,而å…ķä―™æĩ‹čŊ•å…ĻéƒĻ通čŋ‡ã€‚

æ đ因

startManagedRuntimeAttestationWorker(..., containerMode = true) æ€ŧæ˜Ŋįŧ‘åŪšå›šåۚįŦŊåĢ 43190(0.0.0.0,见 managed-runtime-attestation-worker.ts)。同į›Ūå―•įš„å…„åžŸæĩ‹čŊ•åĨ—äŧķ managed-runtime-attestation-worker.test.ts æ—Đå·ēäļšåŪƒč‡Šå·ąįš„åŪđå™ĻæĻĄåžæĩ‹čŊ•č§Ģå†ģ乆čŋ™äļŠé—Ūéǘ:åۃ mock Server.prototype.listen,ä―ŋ worker äŧį„ķäŧĨ (43190, '0.0.0.0') čĒŦ调į”Ļ,č€ŒįœŸåŪž socket įŧ‘åۚ到äļīæ—ķ回įŽŊįŦŊåĢ (0, '127.0.0.1')。managed-runtime-container.test.ts äŧŽæœŠé‡‡į”Ļčŋ™äļŠæĻĄåž,而æ˜ŊᜟåŪžįŧ‘åۚ 43190â€”â€”å•į‹ŽčŋčĄŒæ—ķæēĄé—Ūéǘ,åœĻå…ąäšŦ CI äļŧ朚äļŠåˆ™äžšæŠ–åŠĻåĪąčīĨ。

åĪįŽ°(äŋŪåĪå‰)

į”Ļäļ€äļŠäļīæ—ķčŋ›įĻ‹å į”ĻčŊĨįŦŊåĢ(net.createServer().listen(43190, '0.0.0.0'))后,åœĻ packages/cli äļ­čŋčĄŒ npx vitest run src/serve/managed-runtime-container.test.ts,įēūįĄŪåĪįŽ°äš† CI įš„åĪąčīĨį‰đåū:

× Managed Runtime container entry > wires the gate in the actual boot3 startup while preserving boot2 route ownership
  → listen EADDRINUSE: address already in use 0.0.0.0:43190
× Managed Runtime container entry > opens the explicit container port with authenticated attestation
  → listen EADDRINUSE: address already in use 0.0.0.0:43190
Tests  2 failed | 11 passed (13)

恰åĨ―æ˜Ŋ issue äļ­åˆ—å‡šįš„äļĪäļŠæĩ‹čŊ•åĪąčīĨ,文äŧķäļ­å…ķä―™æĩ‹čŊ•å…ĻéƒĻ通čŋ‡ã€‚

äŋŪåĪ

äŧ…äŋŪæ”đ managed-runtime-container.test.ts æĩ‹čŊ•æ–‡äŧķ,æēŋį”Ļ兄垟åĨ—äŧķå·ēåŧšįŦ‹įš„æĻĄåž:

  • 新åĒžå°åž‹ mockEphemeralListen() čū…åŠĐå‡―æ•°:spy Server.prototype.listen,äŋį•™åŊ断čĻ€įš„čŊ·æą‚参数 (43190, '0.0.0.0'),ä―†įœŸåŪžįŧ‘åۚæ”đäļš (0, '127.0.0.1')——äļ€äļŠäļäžšäļŽčŋ›įĻ‹åĪ–äŧŧä―•äļœčĨŋå†ēįŠįš„äļīæ—ķ回įŽŊįŦŊåĢ。
  • wires the gate in the actual boot3 startupâ€Ķ åœĻåŊåŠĻåŪđå™Ļ worker å‰č°ƒį”ĻčŊĨčū…åŠĐå‡―æ•°;åŪƒįš„æ‰€æœ‰čŊ·æą‚朎æĨå°ąįŧį”ą worker.ready.url,而 createManagedContextReady(boot v2/v3)和 v1 ready čŪ°å―•éƒ―äŧŽåŪžé™…įŧ‘åŪšįš„įŦŊåĢį”Ÿæˆ URL,因æ­ĪčŊĨæĩ‹čŊ•å…ķä―™éƒĻ分无需æ”đåŠĻ。
  • opens the explicit container port with authenticated attestation įŽ°åœĻ断čĻ€ listen äŧĨ (43190, '0.0.0.0') čĒŦ调į”Ļ——äŋį•™"æ˜ū垏åŪđå™ĻįŦŊåĢ"čŋ™äļ€čĄŒäļšč§čŊâ€”—åđķåŸšäšŽįœŸåŪžįŧ‘åŪšåœ°å€æ–­čĻ€ worker.ready.url,而äļå†įĄŽįž–᠁ 43190。čŪĪčŊčŊæ˜ŽæĩįĻ‹(无 token čŋ”回 401,åļĶ token čŋ”回 200,no-store åĪī,token äļå›žæ˜ū)äŋæŒäļå˜ã€‚

朊äŋŪæ”đäŧŧä―•į”Ÿäš§äŧĢį ã€‚

驌čŊ

  • node -e å ä―čŋ›įĻ‹ + cd packages/cli && npx vitest run src/serve/managed-runtime-container.test.ts(äŋŪåĪå‰)——åĪįŽ°æˆåŠŸ:2 åĪąčīĨ / 11 通čŋ‡,æŠĨ EADDRINUSE 0.0.0.0:43190,äļŽ CI į‰đåūäļ€č‡ī。
  • 变垂æŽĒ针:äļīæ—ķ将 managed-runtime-attestation-worker.ts äļ­įš„įŧ‘åۚįŦŊåĢ 43190 æ”đäļš 43191 åđķé‡č·‘čŊĨ文äŧķ——opens the explicit container port with authenticated attestation åœĻ expect(listen).toHaveBeenCalledWith(43190, '0.0.0.0') åĪ„åĪąčīĨ,čŊæ˜ŽčŊĨ断čĻ€äŧåœĻ见čŊæ˜ū垏įŦŊåĢ行äļšã€‚æšį å·ēæĒåĪåđķį”Ļ grep įĄŪčŪĪ。
  • cd packages/cli && npx vitest run src/serve/managed-runtime-container.test.ts(äŋŪåĪåŽ,įŦŊåĢįĐšé—ē)——13 通čŋ‡ / 13。
  • å ä―čŋ›įĻ‹ + 同äļ€å‘―äŧĪ(äŋŪåĪåŽ,43190 čĒŦ占į”Ļ)——13 通čŋ‡ / 13:原始åĪąčīĨæĄäŧķäļå†å―ąå“čŊĨåĨ—äŧķ。
  • cd packages/cli && npx vitest run src/serve/managed-runtime-container.test.ts src/serve/managed-runtime-attestation-worker.test.ts——äļĪäļŠåŪđå™ĻæĻĄåžåĨ—äŧķå…ą 42 通čŋ‡ / 42。
  • npm run build——通čŋ‡ã€‚
  • npm run typecheck——通čŋ‡ã€‚
  • npm run lint——通čŋ‡(pre-commit é’Đ子äđŸåŊđæš‚å­˜æ–‡äŧķčŋčĄŒäš† prettier + eslint,无äŋŪæ”đ)。

įŽŊåǃčŊŽ:įĄŪåˆ‡įš„ CI åĪąčīĨæ˜Ŋäļŧ朚į›ļå…ģįš„(å…ąäšŦ ecs-qwen runner),无æģ•åœĻ朎地åŊđᜟåŪž CI įŽŊåĒƒé‡æ”ū;äļŠčŋ°å ä―įŦŊåĢæŽĒ针æ˜Ŋåŋ åŪžįš„æ›ŋäŧĢ驌čŊ,åĪįŽ°äš†åیå…Ļį›ļåŒįš„åĪąčīĨį‰đåūã€‚å·Ĩä―œæĩį‹ŽįŦ‹įš„ CI äŧæ˜Ŋ最įŧˆéЌčŊå…ģåĄã€‚


🧠 Handled by Qwen Code · model/æĻĄåž‹ kimi-k3 · CLI 0.25.0

@github-actions github-actions Bot added the review/self-reported The linked issue was opened by the PR author (self-reported) label Oct 9, 2026
@qwen-code-review-bot

qwen-code-review-bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Qwen Triage finished — view run. See the stage comments in this thread for the result.

✅ Qwen Triage å·ēåŪŒæˆ —— æŸĨįœ‹čŋčĄŒã€‚įŧ“æžœč§æœŽįšŋįĻ‹äļ­įš„各é˜ķæŪĩčŊ„čŪšã€‚

@qwen-code-review-bot

qwen-code-review-bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Thanks for the PR. This is a re-run, and the head has moved since my last pass (6991d18b → 39d9dd57), so everything below is a fresh read of the current commit rather than a restatement of the old one.

Template looks good ✓ — all nine headings present, and the Risk & Scope section states the coverage trade plainly instead of burying it.

Problem: observed, not theoretical. Issue #13775 is a real main CI failure — run 37925143593 at 8c127de524a6, job Test (ubuntu-latest, Node 22.x), step Run tests and generate reports — and it names exactly the two tests this PR touches. I also read the production bind myself rather than taking the description's word for it: managed-runtime-attestation-worker.ts:292 really does server.listen(containerMode ? 43190 : 0, containerMode ? '0.0.0.0' : '127.0.0.1'). So on the shared self-hosted fleet a neighbour holding 43190 fails both container-mode tests with EADDRINUSE while everything else passes. Mechanism confirmed end to end.

Direction: aligned. A hard-coded port in a suite that runs on hosts with neighbours is a flake generator by construction, and CI reliability is squarely in scope. CHANGELOG: no direct reference, but the area is relevant — this is test-suite hygiene with no user-facing surface.

Size: not applicable. No core paths — both changed files are packages/cli/src/serve/*.test.ts, so production logic lines are 0 and all 32 changed lines are test lines. No generated or schema files.

Approach: minimal, and it reuses an existing precedent rather than inventing a mechanism. I checked the completeness question that actually matters here — whether some other test still binds 43190 for real, which would leave the flake half-fixed. Grepping the tree for 43190 finds it only in these two test files, in production, and in the Java pod-spec/URI declarations (which construct container specs and endpoints; they don't bind a socket). All six startManagedRuntimeAttestationWorker call sites in the container suite are accounted for: the two that reach a real bind are exactly the two that got the mock, and the other four either default to non-container mode (listen(0, '127.0.0.1'), already ephemeral) or reject before the listener opens. The fix is complete for this port.

One scope question, offered as a question rather than an objection: commit 410f707f also edits the sibling attestation-worker suite, which was not itself flaky, and that widens its real bind from loopback to the requested wildcard address. Applying the same shape to both copies is what stops the two from drifting apart — and it was my own R1-1 suggestion last round that prompted the change — so I think those 2 lines are well spent. Naming it so the choice is visible rather than incidental.

Risk: no elevated risk signals. Stage 1e matched nothing; both paths are excluded as .test.ts before the high-risk pattern check even runs.

Moving on to code review. 🔍

äļ­æ–‡čŊŽ

感č°ĒčīĄįŒŪ。čŋ™æ˜Ŋäļ€æŽĄ re-runhead č‡Šæˆ‘äļŠæŽĄåŪĄæŸĨ后å·ēįŧį§ŧåŠĻ6991d18b → 39d9dd57因æ­Īäļ‹éĒ所有内åŪđéƒ―æ˜ŊåŊđå―“å‰æäšĪįš„é‡æ–°é˜…čŊŧïžŒč€Œäļæ˜ŊåŊđæ—§įŧ“čŪšįš„åĪčŋ°ã€‚

æĻĄæŋåیæ•ī ✓ —— äđäļŠæ ‡éĒ˜é―å…ĻRisk & Scope éƒĻ分把č͆ᛖéĒäļŠįš„å–čˆčŪēåū—åūˆæļ…æĨšïžŒæēĄæœ‰å›žéŋ。

é—ŪéĒ˜ïžšå·ē观æĩ‹åˆ°ïžŒäļæ˜ŊᐆčŪšæ€§įš„ã€‚ issue #13775 æ˜Ŋäļ€æŽĄįœŸåŪžįš„ main CI åĪąčīĨ —— 提äšĪ 8c127de524a6 äļŠįš„čŋčĄŒ 37925143593ïžŒä―œäļš Test (ubuntu-latest, Node 22.x)æ­ĨéŠĪ Run tests and generate reports —— åۃį‚đåįš„æ­Ģæ˜Ŋ朎 PR æ”đåŠĻįš„é‚ĢäļĪäļŠæĩ‹čŊ•。我äđŸč‡Šå·ąčŊŧäš†į”Ÿäš§äŧĢį įš„įŧ‘åۚé€ŧčū‘ïžŒč€Œäļæ˜Ŋ采äŋĄæčŋ°ïžšmanaged-runtime-attestation-worker.ts:292 įĄŪåŪžæ˜Ŋ server.listen(containerMode ? 43190 : 0, containerMode ? '0.0.0.0' : '127.0.0.1')。所äŧĨåœĻå…ąäšŦįš„č‡Šæ‰˜įŪĄæœšįūĪäļŠïžŒäŧŧä―•å į”Ļ 43190 įš„é‚ŧåą…éƒ―äžščŪĐčŋ™äļĪäļŠåŪđå™ĻæĻĄåžæĩ‹čŊ•äŧĨ EADDRINUSE åĪąčīĨïžŒč€Œå…ķä―™æĩ‹čŊ•å…ĻéƒĻ通čŋ‡ã€‚朚åˆķå·ēåیæ•īæ ļåŪžã€‚

æ–đ向åŊđé―ã€‚åœĻäļ€äļŠäļŽé‚ŧåą…å…ąäšŦäļŧæœšįš„æĩ‹čŊ•åĨ—äŧķé‡ŒįĄŽįž–į įŦŊåĢ朎čšŦå°ąæ˜Ŋ抖åŠĻæĨ暐CI įĻģåŪšæ€§åیå…ĻåąžäšŽæœŽéĄđį›Ū范å›ī。CHANGELOGïžšæ— į›īæŽĨåž•į”ĻïžŒä―†čŊĨéĒ†åŸŸį›ļå…ģ —— čŋ™æ˜Ŋæĩ‹čŊ•åĨ—äŧķåą‚éĒįš„åŦį”Ÿé—ŪéĒ˜ïžŒæēĄæœ‰į”Ļ户åŊ见éĒ。

规æĻĄïžšäļé€‚į”Ļ。朊č§Ķ及æ ļåŋƒč·Ŋåū„ —— äļĪäļŠæ”đåŠĻ文äŧķéƒ―æ˜Ŋ packages/cli/src/serve/*.test.ts因æ­Īį”Ÿäš§äŧĢį čĄŒæ•°äļš 0å…ĻéƒĻ 32 行æ”đåŠĻ均äļšæĩ‹čŊ•čĄŒã€‚æ— į”Ÿæˆæ–‡äŧķæˆ– schema 文äŧķ。

æ–đæĄˆïžšæ”đåŠĻåūˆå°ïžŒäļ”åĪį”Ļ乆æ—Ē有先äū‹č€ŒæēĄæœ‰åĶ造朚åˆķ。我æ ļæŸĨ乆čŋ™é‡ŒįœŸæ­Ģå…ģé”Ūįš„åیæ•ī性é—Ūéǘ —— æ˜ŊåĶčŋ˜æœ‰å…ķäŧ–æĩ‹čŊ•äŧåœĻᜟåŪžįŧ‘åۚ 43190é‚Ģ样抖åŠĻå°ąåŠäŋŪ乆äļ€åŠã€‚åœĻæ•īäļŠäŧĢį æ ‘äļ­æœįīĒ 43190ïžŒåŠå‡šįŽ°åœĻčŋ™äļĪäļŠæĩ‹čŊ•æ–‡äŧķã€į”Ÿäš§äŧĢį ïžŒäŧĨ及 Java įš„ pod spec / URI åĢ°æ˜Žäļ­ïžˆåŽč€…构造åŪđå™Ļč§„æ žäļŽįŦŊį‚đåđķäļįŧ‘åۚåĨ—æŽĨ字。åŪđå™Ļæĩ‹čŊ•åĨ—äŧķäļ­å…ĻéƒĻ六åĪ„ startManagedRuntimeAttestationWorker 调į”Ļį‚đéƒ―å·ēæ ļåŊđïžšįœŸæ­Ģäžšæ‰§čĄŒįŧ‘åŪšįš„äļĪåĪ„ïžŒæ­Ģæ˜Ŋ加䚆 mock įš„é‚ĢäļĪåĪ„ïž›å…ķä―™å››åĪ„č́äđˆéŧ˜čŪĪäļšéžåŪđå™ĻæĻĄåžïžˆlisten(0, '127.0.0.1')朎æĨå°ąæ˜Ŋäļīæ—ķįŦŊåĢč́äđˆåœĻį›‘åŽå™Ļ打垀äđ‹å‰å°ąå·ē rejectã€‚å°ąčŋ™äļŠįŦŊåĢ而čĻ€ïžŒäŋŪåĪæ˜Ŋåیæ•īįš„ã€‚

äļ€äļŠčŒƒå›īäļŠįš„į–‘é—Ūæ˜Ŋ提é—Ū而äļæ˜Ŋ反åŊđ提äšĪ 410f707f čŋ˜æ”đåŠĻ䚆兄垟 attestation-worker åĨ—äŧķïžŒč€ŒåŪƒæœŽčšŦåđķäļæŠ–åŠĻčŋ™ä”đåŠĻ把åŪƒįš„įœŸåŪžįŧ‘åۚäŧŽå›žįŽŊ地址æ”ūåŪ―åˆ°äš†čŊ·æą‚įš„é€šé…åœ°å€ã€‚čŪĐäļĪäŧ―å‰Ŋ朎äŋæŒåŒå―Ēæ­Ģæ˜Ŋé˜ēæ­Ē乌者æ—Ĩ后枂į§ŧįš„åŠžæģ• —— 而äļ”äŋƒæˆčŋ™æŽĄæ”đåŠĻįš„æ­Ģæ˜Ŋ我äļŠäļ€č―Ūįš„ R1-1 åŧščŪŪ â€”â€” 所äŧĨ我čŪĪäļščŋ™ 2 行花åū—倞。į‚đ凚æĨæ˜Ŋäļšäš†čŪĐčŋ™äļŠé€‰æ‹Đæ˜Ŋæ˜ūåžįš„ïžŒč€Œäļæ˜ŊéĄšæ‰‹åļĶčŋ‡įš„。

éĢŽé™Đïžšæ— å‡įš§éĢŽé™ĐäŋĄå·ã€‚Stage 1e æœŠå‘―äļ­äŧŧä―•æĻĄåžïž›äļĪäļŠč·Ŋåū„åœĻéŦ˜éĢŽé™ĐæĻĄåžæĢ€æŸĨčŋčĄŒäđ‹å‰å°ąå·ēčĒŦ .test.ts č§„åˆ™æŽ’é™Ī。

čŋ›å…ĨäŧĢ᠁åŪĄæŸĨ 🔍

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at 39d9dd574a4101101fdb2f451ab0d18fdbf7a45b · re-run with @qwen-code /triage

@qwen-code-review-bot

qwen-code-review-bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Code review

My independent proposal last round was the same shape this PR took — spy on listen, keep the requested arguments assertable, bind an ephemeral port for real — so the interesting question on this re-run is narrower: did commit 410f707f restore the host witness that my R1-1 said was lost, without breaking the port witness or the flake fix? For that delta my own baseline was "override only the port, forward the caller's remaining arguments", which is literally what landed.

Both witnesses now hold, and I checked each against production rather than against the description:

  • Port witness. expect(listen).toHaveBeenCalledWith(43190, '0.0.0.0') reads the recorded call arguments, not the socket. Production passes exactly those two arguments at managed-runtime-attestation-worker.ts:292-295 — no callback, it waits on the 'listening' event instead. Change the port in production and the recorded arguments change, so the assertion fails. The ephemeral real bind does not weaken it.
  • Host witness. Because the mock forwards args.slice(1), a container-mode worker really binds 0.0.0.0:<ephemeral>, while production builds url: http://127.0.0.1:${address.port} (line 313) and the test expects that literal. Had production switched to deriving the host from the bound address, ready.url would come back as http://0.0.0.0:<port> and the assertion would go red. This is precisely the witness R1-1 flagged as self-referential at the previous head; it is back, and it is back for the right reason — the port is substituted, the host is not.

Two smaller things I verified because a prototype-level mock is easy to get subtly wrong:

  • Argument shape. Reflect.apply(nativeListen, this, [0, ...args.slice(1)]) keeps any trailing arguments, so a future listen(port, host, cb) still receives its callback. The previous form ([0, '127.0.0.1']) replaced the whole argument list and would have silently dropped one. Strictly better, and the substituted port stays 0, so the EADDRINUSE collision this PR removes is not reintroduced through the back door.
  • Mock lifecycle. The helper's return value is discarded at the first call site, which is only safe because afterEach(() => vi.restoreAllMocks()) at line 63 covers it; the sibling restores in its own finally. No spy leaks into the rest of the suite.

Non-blocking nit, not worth a round trip on a test-only change: listen.mock.results[0]?.value?.address() as AddressInfo uses a cast that discards the ?. chain's undefined case, so if a worker ever failed to listen the test would die on a TypeError instead of a readable assertion. It still goes red, just less helpfully.

The residual the PR discloses is real and I accept it: no test now proves a genuine bind to 43190 succeeds inside a container. That proof was the flake, so removing it is the fix rather than a side effect. If we ever want it back it belongs in an isolated lane with the port guaranteed free — not in a shared unit suite running on a host with neighbours.

On conventions: the helper's comment is the kind AGENTS.md actually asks for — it explains a non-obvious why (the port is deliberately not really bound, and forcing loopback would make the URL assertion self-referential), which is exactly what stops a future reader "fixing" it back into a flake. Type-only import via import type, no production delta, no drive-by refactors in either file.

Test evidence

This is a CI-path re-run (GITHUB_EVENT_NAME=issue_comment), so per the skill's rules I executed nothing: no build, no test run, no checkout of the PR branch, and no PR-derived code. Every check below is the PR's own CI, read through the API for the reviewed commit 39d9dd57 — 25 check-runs, 22 success, 3 skipped, 0 failure, 0 pending.

The load-bearing one is Test (ubuntu-latest, Node 22.x) — the exact job and step that failed on main in issue #13775 — and it is success here. Lint & Static (ubuntu-latest, Node 22.x) is green too, which covers typecheck and lint for the new AddressInfo import and the rest-parameter mock signature. The two SDK Java jobs that flaked at the previous head in Initialize containers (before checkout, so no repository code ran) are both success on this commit, consistent with the author's transient-infra diagnosis. Test (macos-latest, â€Ķ), Test (windows-latest, â€Ķ) and Integration Tests (CLI, No Sandbox) are skipped, which is this repo's normal matrix pruning for a change of this shape, not a gap the PR caused.

The author's local vitest counts and mutation probes are their own claim and I did not lean on them for the verdict — I verified both witnesses statically by reading production and the assertions, so nothing in my conclusion rests on a result I could not check myself.

Check Conclusion
Classify PR success
Desktop Shell (ubuntu-22.04) success
Desktop Shell (windows-2022) success
Flyway migration version uniqueness success
Hosted process fault gates / MySQL 8.4 / Java 21 success
Integration Tests (CLI, No Sandbox) skipped
Integration Tests (no-AK, No Sandbox) success
Lint & Static (ubuntu-latest, Node 22.x) success
OpenTUI no-flicker gate success
Real daemon E2E / Java 11 success
Remind on force-push success
Runtime Broker and Managed Agent MariaDB / Java 21 success
Serve A/B (ubuntu-latest, Node 22.x) success
TUI parity snapshots (ink vs opentui) success
Test (macos-latest, Node 22.x) skipped
Test (ubuntu-latest, Node 22.x) success
Test (windows-latest, Node 22.x) skipped
assign success
label success
macos-latest / Java 21 success
ubuntu-latest / Java 11 success
ubuntu-latest / Java 17 success
ubuntu-latest / Java 21 success
web-shell E2E Smoke (ubuntu-latest, Node 22.x) success
windows-latest / Java 21 success

Real-scenario testing: N/A — nothing user-visible (test-only, zero production lines), and on the CI path the live-behaviour signal comes from the PR's own checks above rather than from a locally driven session. There is also no behavioural claim left for a sandboxed lane to settle: the port witness follows from how a spy records call arguments, the host witness follows from the mock forwarding the requested host while production hard-codes loopback in the URL, and the suite's green state comes from the job that previously flaked.

äļ­æ–‡čŊŽ

äŧĢ᠁åŪĄæŸĨ

我äļŠäļ€č―Ūįš„į‹ŽįŦ‹æ–đæĄˆäļŽæœŽ PR 采į”Ļįš„å―Ē垏į›ļ同 —— spy listen、äŋį•™åŊ断čĻ€įš„čŊ·æą‚å‚æ•°ã€įœŸåŪžįŧ‘åۚæ”đ到äļīæ—ķįŦŊåĢ —— 所äŧĨčŋ™æŽĄ re-run äļŠįœŸæ­Ģæœ‰æ„æ€įš„é—Ūéǘæ›īįŠ„ïžšæäšĪ 410f707f æ˜ŊåĶæĒåĪäš†æˆ‘ R1-1 指凚å·ēäļĒåĪąįš„äļŧæœšč§čŊïžŒåŒæ—ķæēĄæœ‰į ī坏įŦŊåĢ见čŊã€äđŸæēĄæœ‰æŠŠæŠ–åŠĻåļĶ回æĨ。针åŊđčŋ™äŪĩåĒžé‡ïžŒæˆ‘č‡Šå·ąįš„åŸšįšŋæ–đæĄˆå°ąæ˜Ŋ"及č͆ᛖįŦŊåĢïžŒč―Žå‘č°ƒį”Ļæ–đå…ķä―™å‚æ•°"ïžŒč€Œč―åœ°įš„æ­Ģæ˜Ŋčŋ™äļŠã€‚

äļĪäļŠč§čŊįްåœĻéƒ―æˆįŦ‹ïžŒäˆ‘éƒ―æ˜ŊåŊđį€į”Ÿäš§äŧĢ᠁æ ļåŊđįš„ïžŒč€Œäļæ˜ŊåŊđį€ PR 描čŋ°ïžš

  • įŦŊåĢ见čŊã€‚ expect(listen).toHaveBeenCalledWith(43190, '0.0.0.0') čŊŧįš„æ˜ŊčŪ°å―•äĨįš„č°ƒį”Ļ参数äļæ˜ŊåĨ—æŽĨå­—ã€‚į”Ÿäš§äŧĢ᠁åœĻ managed-runtime-attestation-worker.ts:292-295 恰åĨ―及䞠čŋ™äļĪäļŠå‚æ•° —— æēĄæœ‰å›žč°ƒïžŒåۃæ”đäļšį­‰åū… 'listening' 之äŧķ。æ”đæŽ‰į”Ÿäš§äŧĢį é‡Œįš„įŦŊåĢčŪ°å―•åˆ°įš„å‚æ•°å°ąäžšå˜ïžŒæ–­čĻ€éšäđ‹åĪąčīĨã€‚įœŸåŪžįš„äļīæ—ķįŦŊåĢįŧ‘åۚåđķäļäžšå‰ŠåžąåŪƒã€‚
  • äļŧæœšč§čŊã€‚ į”ąäšŽ mock č―Žå‘äš† args.slice(1)åŪđå™ĻæĻĄåžįš„ worker äžšįœŸåŪžįŧ‘åۚ 0.0.0.0:<äļīæ—ķįŦŊåĢ>ïžŒč€Œį”Ÿäš§äŧĢį æž„é€ įš„æ˜Ŋ url: http://127.0.0.1:${address.port}ïžˆįŽŽ 313 čĄŒïž‰ïžŒæĩ‹čŊ•æ–­čĻ€įš„æ­Ģæ˜Ŋčŋ™äļŠå­—éĒ量。åĶ‚æžœį”Ÿäš§äŧĢ᠁æ”đ成äŧŽåŪžé™…įŧ‘åŪšåœ°å€æŽĻåŊžäļŧ朚ready.url å°ąäžšå˜æˆ http://0.0.0.0:<port>断čĻ€įŦ‹åˆŧ变įšĒ。čŋ™æ­Ģæ˜Ŋ R1-1 指凚åœĻäļŠäļ€äļŠ head äļŠå·ē退化äļšč‡ŠčŊįš„é‚ĢäļŠč§čŊïž›åŪƒå›žæĨäš†ïžŒč€Œäļ”回æĨįš„į†į”ąæ˜ŊåŊđįš„ —— čĒŦæ›ŋæĒįš„æ˜ŊįŦŊåĢäļæ˜Ŋäļŧ朚。

åĶåĪ–äļĪį‚đ我į‰đ意æ ļåŪžäš†ïžŒå› äļš prototype įš§åˆŦįš„ mock åūˆåŪđæ˜“å‡šåūŪåĶ™įš„é”™ïžš

  • 参数å―ĒįŠķ。 Reflect.apply(nativeListen, this, [0, ...args.slice(1)]) äŋį•™äš†åŽįŧ­å‚数因æ­Ī将æĨč‹Ĩå‡šįŽ° listen(port, host, cb)ïžŒå›žč°ƒäŧčƒ―æ”ķ到。æ­Īå‰įš„å―Ē垏[0, '127.0.0.1']䞚æ•īä―“æ›ŋæĒ参数列čĄĻ将悄悄äļĒæŽ‰å›žč°ƒã€‚æ–°å†™æģ•äļĨæ žæ›ī䞘äļ”čĒŦæ›ŋæĒįš„įŦŊåĢäŧäļš 0所äŧĨ朎 PR æķˆé™Īįš„ EADDRINUSE å†ēįŠäļäžšäŧŽåŽé—ĻčĒŦ重新垕å…Ĩ。
  • mock į”Ÿå‘―å‘Ļ期。 įŽŽäļ€åĪ„č°ƒį”ĻäļĒ垃䚆 helper įš„čŋ”回倞čŋ™äđ‹æ‰€äŧĨåŪ‰å…Ļæ˜Ŋ因äļšįŽŽ 63 čĄŒįš„ afterEach(() => vi.restoreAllMocks()) čĶ†į›–äš†åŪƒïž›å…„åžŸæ–‡äŧķ则åœĻč‡Šå·ąįš„ finally äļ­æĒåĪã€‚æēĄæœ‰ spy æģ„枏到åĨ—äŧķå…ķä―™éƒĻ分。

äļ€äļŠäļé˜ŧåĄžįš„å°į‚đåœĻįšŊæĩ‹čŊ•æ”đåŠĻäļŠäļå€žåū—åΚčĩ°äļ€č―Ūïžšlisten.mock.results[0]?.value?.address() as AddressInfo į”Ļįąŧ型断čĻ€äļĒæŽ‰äš† ?. é“ūįš„ undefined 分æ”Ŋ所äŧĨäļ‡äŸäļŠ worker æēĄčƒ―čŋ›å…Ĩį›‘åŽïžŒæĩ‹čŊ•äžšäŧĨ TypeError åīĐæŽ‰ïžŒč€Œäļæ˜Ŋįŧ™å‡šåŊčŊŧįš„æ–­čĻ€åĪąčīĨ。åۃäŧį„ķ䞚变įšĒ及æ˜Ŋ提įĪšæēĄé‚Ģäđˆå‹åĨ―。

PR č‡Šå·ąæŠŦéœēįš„æŪ‹į•™įĄŪåŪžå­˜åœĻ我äđŸæŽĨå—ïžšįŽ°åœĻæēĄæœ‰æĩ‹čŊ•čƒ―čŊæ˜ŽåŪđå™Ļå†…įœŸåŪžįŧ‘åۚ 43190 äžšæˆåŠŸã€‚č€Œé‚ĢäļŠčŊæ˜ŽæœŽčšŦå°ąæ˜Ŋ抖åŠĻæĨ暐所äŧĨį§ŧé™Īåۃæ˜ŊæœŽæŽĄäŋŪåĪįš„į›Ūįš„ïžŒäļæ˜Ŋå‰Ŋä―œį”Ļ。åĶ‚æžœå°†æĨæƒģčĄĨ回æĨ嚔čŊĨæ”ūåœĻčƒ―äŋčŊįŦŊåĢįĐšé—ēįš„éš”įĶŧé€šé“é‡ŒïžŒč€Œäļæ˜Ŋæ”ūåœĻäļŽé‚ŧåą…å…ąäšŦäļŧæœšįš„å•å…ƒæĩ‹čŊ•åĨ—äŧķäļ­ã€‚

规范æ–đéĒïžšhelper ä–đé‚ĢæŪĩæģĻ释æ­Ģæ˜Ŋ AGENTS.md 所čĶæą‚įš„é‚Ģäļ€įąŧ —— åۃč§Ģ释乆äļæ˜ūį„ķįš„äļšäŧ€äđˆïžˆįŦŊåĢæ˜Ŋ故意äļįœŸåŪžįŧ‘åŪšįš„ïžŒč€Œåžšåˆķ回įŽŊ侚ä―ŋ URL 断čĻ€é€€åŒ–äļšč‡ŠčŊïž‰ïžŒčŋ™æ°æ°æ˜Ŋé˜ŧæ­Ē后æĨč€…æŠŠåۃ"äŋŪ"回抖åŠĻįŠķ态所需čĶįš„äŋĄæŊ。įąŧ型åŊžå…Ĩä―ŋį”Ļ import typeïžŒæ— į”Ÿäš§äŧĢ᠁æ”đåŠĻäļĪäļŠæ–‡äŧķéƒ―æēĄæœ‰åĪđåļĶéĄšæ‰‹é‡æž„ã€‚

æĩ‹čŊ•čŊæŪ

čŋ™æ˜Ŋäļ€æŽĄ CI č·Ŋåū„įš„ re-runGITHUB_EVENT_NAME=issue_comment因æ­Ī按 skill č§„åˆ™æˆ‘æēĄæœ‰æ‰§čĄŒäŧŧä―•äļœčĨŋïžšæēĄæœ‰æž„åŧšã€æēĄæœ‰č·‘æĩ‹čŊ•、æēĄæœ‰æĢ€å‡š PR 分æ”ŊäđŸæēĄæœ‰čŋčĄŒäŧŧä―•æĨ臩 PR įš„äŧĢį ã€‚äļ‹éĒæŊäļ€éĄđéƒ―æ˜Ŋ朎 PR č‡Šå·ąįš„ CI通čŋ‡ API čŊŧ取čĒŦåŪĄæäšĪ 39d9dd57 įš„įŧ“æžœ —— å…ą 25 äļŠ check-run22 成功、3 č·ģčŋ‡ã€0 åĪąčīĨ、0 åū…čŋčĄŒã€‚

最å…ģé”Ūįš„æ˜Ŋ Test (ubuntu-latest, Node 22.x) —— æ­Ģæ˜Ŋ issue #13775 äļ­åœĻ main äļŠåĪąčīĨįš„é‚ĢäļŠä―œäļšäļŽæ­ĨéŠĪ —— åœĻæœŽæŽĄæäšĪäļŠäļš success。Lint & Static (ubuntu-latest, Node 22.x) 同样äļšįŧŋčĶ†į›–äš†æ–°åĒž AddressInfo åŊžå…ĨäļŽ rest 参数 mock į­ūåįš„ typecheck äļŽ lint。äļŠäļ€äļŠ head äļŠåœĻ Initialize containers é˜ķæŪĩ抖åŠĻįš„äļĪäļŠ SDK Java ä―œäļšïžˆå‘į”ŸåœĻ checkout äđ‹å‰ïžŒå› æ­ĪæēĄæœ‰čŋčĄŒäŧŧä―•äŧ“åš“äŧĢį ïž‰ïžŒåœĻ朎提äšĪäļŠå‡äļš successäļŽä―œč€…įš„įžŽæ—ķåŸšįĄ€čŪūæ–―æ•…éšœåˆĪ断äļ€č‡ī。Test (macos-latest, â€Ķ)、Test (windows-latest, â€Ķ) äļŽ Integration Tests (CLI, No Sandbox) äļš skippedčŋ™æ˜Ŋ朎äŧ“嚓针åŊđæ­Īįąŧæ”đåŠĻįš„æ­ĢåļļįŸĐé˜ĩčĢå‰ŠïžŒäļæ˜Ŋ朎 PR é€ æˆįš„įžšåĢ。

ä―œč€…æœŽåœ°įš„ vitest 数量äļŽå˜åž‚æŽĒé’ˆåąžäšŽå…ķ臩čŋ°ïžŒæˆ‘įš„įŧ“čŪšæēĄæœ‰äūčĩ–åۃäŧŽ â€”â€” 我通čŋ‡é˜…čŊŧį”Ÿäš§äŧĢ᠁äļŽæ–­čĻ€ïžŒé™æ€æ ļåŪžäš†äļĪäļŠč§čŊïžŒå› æ­Īįŧ“čŪšäļ­æēĄæœ‰äŧŧä―•éƒĻ分åŧšįŦ‹åœĻ我无æģ•äšē臩æ ļæŸĨįš„įŧ“æžœäđ‹äļŠã€‚

ä–đčĄĻæ žäļš CI æĢ€æŸĨéĄđäļŽįŧ“čŪšįš„æœšå™ĻåŊčŊŧ匚域æ­ĪåĪ„äļå†é‡åĪã€‚ïž‰

ᜟåŪžåœšæ™Ŋæĩ‹čŊ•ïžšN/A —— æēĄæœ‰į”Ļ户åŊ见æ”đåŠĻįšŊæĩ‹čŊ•ïžŒį”Ÿäš§äŧĢ᠁ 0 čĄŒïž‰ïž›äļ”åœĻ CI č·Ŋåū„äļŠïžŒåŪžæ—ķ行äļšäŋĄå·æĨ臩äļŠéĒįš„ CI æĢ€æŸĨïžŒč€Œäļæ˜Ŋ朎地éĐąåŠĻįš„äžščŊã€‚äđŸæēĄæœ‰į•™įŧ™æē™įŪąé€šé“åŽŧ驌čŊįš„čĄŒäļšæ€§æ–­čĻ€ïžšįŦŊåĢ见čŊæšäšŽ spy čŪ°å―•č°ƒį”Ļå‚æ•°įš„æœšåˆķäļŧæœšč§čŊæšäšŽ mock č―Žå‘čŊ·æą‚äļŧæœšã€č€Œį”Ÿäš§äŧĢ᠁åœĻ URL äļ­įĄŽįž–į å›žįŽŊčŋ™äļ€įŧ„合åĨ—äŧķįš„įŧŋč‰ēįŠķ态则æĨ臩æ­Ī前抖åŠĻįš„é‚ĢäļŠä―œäœŽčšŦ。

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at 39d9dd574a4101101fdb2f451ab0d18fdbf7a45b · re-run with @qwen-code /triage

@qwen-code-review-bot

qwen-code-review-bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Confidence: 4/5 — clean across every stage and CI is fully green on the job that flaked; the single point keeping it from 5 is the disclosed coverage trade, which is inherent to the fix rather than a defect in it.

Stepping back over the whole picture: the problem is a real main failure with a run ID and a named job, the mechanism is confirmed by reading the production bind rather than the PR description, and the fix removes the fixed port from exactly the two call sites that reach a real socket while leaving the four that don't. My independent proposal for this delta — override the port only, forward the caller's remaining arguments — is what shipped, so there is no simpler path I think it missed.

The failure mode I went looking for is the one that matters on an autofix PR pointed at a flaky test: making CI green by weakening the assertion. That did not happen, and this head is stronger than the one I reviewed last round. At 6991d18b the helper replaced the whole argument list, which quietly turned the rewritten ready.url expectation into a self-referential check. 410f707f fixed that by forwarding the requested host, so a container worker really binds 0.0.0.0:<ephemeral> while production still publishes a loopback URL — and the assertion now pins both halves: what production asks for (toHaveBeenCalledWith(43190, '0.0.0.0'), read off the recorded arguments) and what it publishes (http://127.0.0.1:<bound port>, which only holds because the real bind is on the wildcard address). I confirmed both against managed-runtime-attestation-worker.ts lines 292-295 and 313 rather than taking the round-2 summary's word for it.

Nothing was deleted to get to green, and the diff carries no drive-by refactors. The one scope question — the sibling suite was edited too, and was not itself flaky — I've already answered in my favour: two copies of the same mock that behave differently is how the next person re-introduces this bug, and 2 lines to prevent that is cheap. It also followed from my own R1-1, so holding it against the author would be inconsistent.

Would I curse or thank the author in six months? Thank them. The comment above the helper says why the port is deliberately not really bound and why forcing loopback would break the URL witness — that is precisely the note a future reader needs to avoid "fixing" this back into a flake. The residual is honest and stated in the PR: no test now proves a genuine 43190 bind succeeds in a container, and that proof was the flake. If we want it back, it belongs in an isolated lane with the port guaranteed free, not in the shared unit suite. Carrying that is the right trade.

The non-blocking nit (the as AddressInfo cast dropping the clean-failure path) is not worth a round trip on a test-only change with zero production lines.

Verification posture, stated plainly so nobody has to guess what this run did and did not do: this is a CI-path re-run, so I executed nothing — no build, no test run, no PR checkout. The evidence is the PR's own 25 check-runs at 39d9dd57 (22 success, 3 skipped, 0 failure, 0 pending), with Test (ubuntu-latest, Node 22.x) — the job that failed on main — green. Both assertion witnesses I verified statically, by reading production and the assertions, so my verdict does not rest on the author's self-reported mutation probes. The three skipped matrix legs are this repo's normal pruning for a change of this shape.

Approval guardrail: not triggered. This is a same-repo branch (isCrossRepository: false) and the title is test(cli):, not a refactor, so nothing caps the score or blocks an approval. Stage 0 raised no escalation either — no core paths, 0 production logic lines.

Unlike last round, there is no CI left to wait for: zero workflow runs with event == "pull_request" are in flight on this commit, so the approval is given here rather than deferred, and it is pinned to the reviewed commit through the reviews API. The stale deferral marker my previous Stage 3 comment carried for 6991d18b is removed by this update — that commit is no longer the head, and branch protection had already dismissed the approval attached to it.

äļ­æ–‡čŊŽ

äŋĄåŋƒïžš4/5 —— 各é˜ķæŪĩ均无é—ŪéĒ˜ïžŒäļ”åœĻæ­Ī前抖åŠĻįš„é‚ĢäļŠä―œäļšäļŠ CI å·ēå…Ļįŧŋïž›æēĄåˆ° 5 åˆ†įš„å”Ŋäļ€äļ€į‚đæ˜Ŋ朎 PR äļŧåŠĻæŠŦéœēįš„čĶ†į›–å–čˆïžŒč€Œé‚Ģæ˜ŊæœŽæŽĄäŋŪåĪå›šæœ‰įš„äŧĢäŧ·ïžŒäļæ˜Ŋæ”đåŠĻ朎čšŦįš„įžšé™·ã€‚

退ä­Ĩįœ‹æ•īä―“ïžšé—Ūéǘæ˜Ŋäļ€æŽĄæœ‰čŋčĄŒįž–å·ã€æœ‰ä―œäļšåįš„įœŸåŪž main åĪąčīĨ朚åˆķæ˜Ŋ通čŋ‡é˜…čŊŧį”Ÿäš§äŧĢį įš„įŧ‘åۚé€ŧčū‘æ ļåŪžįš„ïžŒč€Œäļæ˜Ŋ采äŋĄ PR 描čŋ°ïž›äŋŪåĪæ°åĨ―äŧŽįœŸæ­Ģ䞚打垀åĨ—æŽĨå­—įš„é‚ĢäļĪåĪ„č°ƒį”Ļį‚đį§ŧé™Ī䚆囚åۚįŦŊåĢïžŒč€Œå…ķä―™å››åĪ„æœŠčĒŦč§Ķ及。针åŊđčŋ™äŪĩåĒžé‡ïžŒæˆ‘įš„į‹ŽįŦ‹æ–đæĄˆ —— 及č͆ᛖįŦŊåĢã€č―Žå‘č°ƒį”Ļæ–đå…ķä―™å‚æ•° —— æ­Ģæ˜Ŋč―åœ°įš„æ–đæĄˆïžŒæ‰€äŧĨäļå­˜åœĻ我čŪĪäļšåŪƒæžæŽ‰įš„æ›īįŪ€č·Ŋåū„。

我į‰đ意åŽŧæ‰ūįš„åĪąæ•ˆæĻĄåžïžŒæ˜Ŋ autofix PR åŊđį€ flaky æĩ‹čŊ•æ—ķ最čŊĨč­Ķæƒ•įš„é‚Ģäļ€į§ïžšé å‰Šåžąæ–­čĻ€æŠŠ CI 变įŧŋ。čŋ™é‡ŒæēĄæœ‰å‘į”ŸïžŒč€Œäļ”å―“å‰ head æŊ”我äļŠäļ€č―ŪåŪĄæŸĨįš„é‚ĢäļŠæ›ī垚。åœĻ 6991d18b äļŠïžŒhelper æ•īä―“æ›ŋæĒ䚆参数列čĄĻ悄悄把æ”đå†™åŽįš„ ready.url 断čĻ€å˜æˆäš†č‡ŠčŊã€‚410f707f 通čŋ‡č―Žå‘čŊ·æą‚įš„äļŧ朚äŋŪåĪäš†čŋ™äļ€į‚đ因æ­ĪåŪđå™Ļ worker ᜟåŪžįŧ‘åۚ 0.0.0.0:<äļīæ—ķįŦŊåĢ>ïžŒč€Œį”Ÿäš§äŧĢ᠁äŧå‘åļƒå›žįŽŊ URL —— 断čĻ€įŽ°åœĻ同æ—ķé’‰ä―äš†äļĪåŠïžšį”Ÿäš§äŧĢ᠁čŊ·æą‚äŧ€äđˆïžˆtoHaveBeenCalledWith(43190, '0.0.0.0')čŊŧįš„æ˜ŊčŪ°å―•äĨįš„å‚æ•°ïž‰ïžŒäŧĨ及åŪƒå‘åļƒäŧ€äđˆïžˆhttp://127.0.0.1:<åŪžé™…įŧ‘åۚįŦŊåĢ>ïžŒč€Œčŋ™åŠæœ‰åœĻᜟåŪžįŧ‘åŪšäšŽé€šé…åœ°å€æ—ķ才成įŦ‹ïž‰ã€‚čŋ™äļĪį‚đæˆ‘éƒ―æ˜ŊåŊđį€ managed-runtime-attestation-worker.ts įŽŽ 292-295 行äļŽįŽŽ 313 行æ ļåŪžįš„ïžŒæēĄæœ‰é‡‡äŋĄįŽŽ 2 č―Ūæ€ŧįŧ“įš„čŊīæģ•。

æēĄæœ‰äļšäš†å˜įŧŋč€Œåˆ äļœčĨŋdiff äđŸæēĄæœ‰åĪđåļĶéĄšæ‰‹é‡æž„ã€‚å”Ŋäļ€įš„čŒƒå›īį–‘é—Ū —— 兄垟åĨ—äŧķäđŸčĒŦæ”đäš†ïžŒč€ŒåŪƒæœŽčšŦåđķäļæŠ–åŠĻ —— 我å·ēįŧįŧ™å‡šäš†åŊđč‡Šå·ąæœ‰čŊåŠ›įš„į­”æĄˆïžšåŒäļ€äļŠ mock įš„äļĪäŧ―å‰Ŋ朎č‹Ĩ行äļšäļåŒïžŒæ­Ģæ˜Ŋäļ‹äļ€äļŠäššé‡æ–°åž•å…Ĩčŋ™äļŠ bug įš„é€”åū„ïž›į”Ļ 2 行é˜ēæ­Ēčŋ™į§äš‹ïžŒæˆæœŽåūˆä―Žã€‚č€Œäļ”čŋ™æŽĄæ”đåŠĻæšč‡Šæˆ‘č‡Šå·ąįš„ R1-1č‹ĨäŧĨæ­Ī苛čīĢä―œč€…åđķäļäļ€č‡ī。

六äļŠæœˆåŽæˆ‘䞚感č°Ēä―œč€…čŋ˜æ˜Ŋå’’éŠ‚ä―œč€…ïžŸæ„Ÿč°Ē。helper ä–đé‚ĢæŪĩæģĻ释čŊŽäš†įŦŊåĢäļšäŧ€äđˆæ˜Ŋ故意äļįœŸåŪžįŧ‘åŪšįš„ã€äŧĨ及垚åˆķ回įŽŊäļšäŧ€äđˆäžšį ī坏 URL 见čŊ —— čŋ™æ­Ģæ˜Ŋ后æĨč€…æ‰€éœ€čĶįš„äŋĄæŊïžŒčƒ―é˜ēæ­Ēäŧ–äŧŽæŠŠåۃ"äŋŪ"回抖åŠĻįŠķ态。æŪ‹į•™æ˜ŊčŊšåŪžįš„ïžŒPR 里äđŸå†™æ˜Žäš†ïžšįްåœĻæēĄæœ‰æĩ‹čŊ•čƒ―čŊæ˜ŽåŪđå™Ļå†…įœŸåŪžįŧ‘åۚ 43190 äžšæˆåŠŸïžŒč€Œé‚ĢäļŠčŊæ˜ŽæœŽčšŦå°ąæ˜Ŋ抖åŠĻæĨ暐。č‹ĨæƒģčĄĨ回æĨ嚔æ”ūåœĻčƒ―äŋčŊįŦŊåĢįĐšé—ēįš„éš”įĶŧ通道äļ­ïžŒč€Œäļæ˜Ŋå…ąäšŦįš„å•å…ƒæĩ‹čŊ•åĨ—äŧķ里。æ‰ŋ担čŋ™äļŠäŧĢäŧ·æ˜Ŋæ­ĢįĄŪįš„å–čˆã€‚

é‚ĢäļŠäļé˜ŧåĄžįš„å°į‚đas AddressInfo 断čĻ€äļĒæŽ‰äš†åđē净åĪąčīĨč·Ŋåū„åœĻäļ€äļŠį”Ÿäš§äŧĢ᠁äļš 0 čĄŒįš„įšŊæĩ‹čŊ•æ”đåŠĻäļŠäļå€žåū—åΚčĩ°äļ€č―Ū。

驌čŊå§ŋ态čŊŽæļ…æĨšïžŒå…åū—有䚚需č́ጜčŋ™æŽĄčŋčĄŒåšäš†äŧ€äđˆã€æēĄåšäŧ€äđˆïžščŋ™æ˜Ŋ CI č·Ŋåū„įš„ re-run所äŧĨ我æēĄæœ‰æ‰§čĄŒäŧŧä―•äļœčĨŋ —— æēĄæœ‰æž„åŧšã€æēĄæœ‰č·‘æĩ‹čŊ•、æēĄæœ‰æĢ€å‡š PR。čŊæŪæ˜Ŋ朎 PR č‡Šå·ąåœĻ 39d9dd57 äļŠįš„ 25 äļŠ check-run22 成功、3 č·ģčŋ‡ã€0 åĪąčīĨ、0 åū…čŋčĄŒïž‰ïžŒå…ķäļ­ Test (ubuntu-latest, Node 22.x) —— æ­Ģæ˜ŊåœĻ main äļŠåĪąčīĨįš„é‚ĢäļŠä―œäļš â€”â€” äļšįŧŋ。äļĪäļŠæ–­čπ见čŊéƒ―æ˜Ŋ我静态æ ļåŪžįš„ïžŒæ–đ垏æ˜Ŋ阅čŊŧį”Ÿäš§äŧĢ᠁äļŽæ–­čĻ€ïžŒå› æ­Īæˆ‘įš„įŧ“čŪšäļäūčĩ–ä―œč€…č‡Ščŋ°įš„变垂æŽĒ针。äĄčĒŦč·ģčŋ‡įš„įŸĐé˜ĩ分æ”Ŋæ˜Ŋ朎äŧ“嚓针åŊđæ­Īįąŧæ”đåŠĻįš„æ­ĢåļļčĢå‰Šã€‚

æ‰đ准æŠĪ栏朊č§Ķ发。čŋ™æ˜Ŋ同äŧ“嚓分æ”ŊisCrossRepository: false标éǘæ˜Ŋ test(cli): 而非 refactor因æ­ĪæēĄæœ‰äŧŧä―•č§„åˆ™åŽ‹ä―Žåˆ†æ•°æˆ–é˜ŧæ­Ēæ‰đ准。Stage 0 äđŸæœŠæå‡šäŠĨ —— 无æ ļåŋƒč·Ŋåū„ïžŒį”Ÿäš§äŧĢ᠁ 0 čĄŒã€‚

äļŽäļŠäļ€č―ŪäļåŒïžŒčŋ™æŽĄæēĄæœ‰éœ€č́ᭉåū…įš„ CIïžščŊĨ提äšĪäļŠæēĄæœ‰äŧŧä―• event == "pull_request" įš„ workflow run åœĻéĢžčĄŒäļ­ïžŒæ‰€äŧĨæ‰đ准åœĻæ­Īį›īæŽĨįŧ™å‡šïžŒč€Œéžåŧķ后åđķ通čŋ‡ reviews API äļŽčĒŦåŪĄæäšĪįŧ‘åŪšã€‚æˆ‘äļŠäĄ Stage 3 čŊ„čŪšäļ­äļš 6991d18b 搚åļĶįš„åŧķ后标čŪ°å·ēį”ąæœŽæŽĄæ›ī新į§ŧé™Ī —— čŊĨ提äšĪå·ēäļæ˜Ŋ headäļ”分æ”ŊäŋæŠĪæ­Ī前å·ēįŧéĐģ回䚆附åœĻå…ķäļŠįš„æ‰đ准。

— Qwen Code · qwen3.8-max-2026-09-02

Reviewed at 39d9dd574a4101101fdb2f451ab0d18fdbf7a45b · re-run with @qwen-code /triage

@qwen-code-review-bot

qwen-code-review-bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

ðŸĐš serve daemon A/B

Built the PR base vs this PR head 39d9dd5, drove a fixed endpoint set against each, and diffed the JSON responses. Only fields that changed are shown.

health-deep-with-session

field PR base (before) this PR (after)
activeWorkStaleMs 6 5

— Qwen Code · serve A/B

yiliang114
yiliang114 previously approved these changes Oct 9, 2026

@yiliang114 yiliang114 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at head 6991d18 — LGTM.

The fix has the right shape for the #13775 flake: the spy keeps the requested (43190, '0.0.0.0') bind observable for the assertion while the real socket moves to an ephemeral loopback port, so a neighbor process holding 43190 on a shared CI host can no longer fail these tests.

Verified against the head source, not just the diff:

  • The production worker calls server.listen(port, host) with no callback and derives readiness from server.once('listening', â€Ķ) plus server.address(), so the mock forwarding only [0, '127.0.0.1'] cannot stall startup, and worker.ready.url reflects the actually bound address — matching the new derived-URL assertion.
  • Both container-mode tests issue their follow-up requests against worker.ready.url; no hard-coded 43190 remains anywhere in the file outside the call-argument assertion.
  • The existing afterEach runs vi.restoreAllMocks(), so the prototype spy cannot leak into sibling tests.
  • Same pattern the attestation-worker suite already established, so it stays consistent across the two files.

CI on this head shows no failures so far (a few lanes still running).

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at head 6991d18. Test-only, one file, +19/−6; I confirmed no production source is touched, then checked the four things that decide whether a flake fix like this is real or just quiets the symptom.

The mechanism is the one in the logs, and the fix removes it rather than tolerating it. Both container-mode tests bound a hard-coded 43190 on 0.0.0.0, so any neighbor holding that port on the shared ecs-qwen host fails them with EADDRINUSE while everything else passes — matching the #13775 signature. mockEphemeralListen() (:85-91) keeps the requested arguments observable and moves the real bind to (0, '127.0.0.1'), so the suite is now indifferent to whether 43190 is occupied. Nothing was skipped, gated on port availability, or wrapped in a retry — which is what would have made this a silenced flake instead of a fixed one.

The sibling-pattern claim checks out. managed-runtime-attestation-worker.test.ts:625-639 already does exactly this: same const nativeListen = Server.prototype.listen, same Reflect.apply(nativeListen, this, [0, '127.0.0.1']), same expect(listen).toHaveBeenCalledWith(43190, '0.0.0.0'). This PR converges on an existing in-repo pattern rather than inventing one.

The spy does not leak. The first call site (:147) discards the return value, which is safe because this file has afterEach(async () => { vi.restoreAllMocks(); ... }) at :63-64. Worth noting the two suites restore differently — the sibling calls listen.mockRestore() inline at :660 — but both are correct, and restoreAllMocks covers the discarded handle.

The behavioral witness survives, with one trade the PR discloses. The old assertion inspected the actually bound socket (address() matching {address: '0.0.0.0', port: 43190}); the new one asserts the requested arguments. That is inherent to not binding the port, and the port-number witness is preserved — mutating the production bind port still fails toHaveBeenCalledWith(43190, '0.0.0.0'). Two things I specifically checked rather than assumed:

  • expect(worker.ready.url).toBe(\http://127.0.0.1:${address.port}\`)` (:329) still pins the host rewrite, because 127.0.0.1 is literal in the expectation while only the port is derived. Had both sides been derived, the "ready URL reports loopback, not the wildcard bind address" contract would have become unfalsifiable.
  • The tests still do real HTTP against the real socket — fetch(worker.ready.url + route, ...) at :181 and the attest POST at :330 — so this is not a mock asserting its own return value. Only the port number is ephemeral.

The residual trade: neither container-mode test now witnesses a wildcard 0.0.0.0 bind actually succeeding. That coverage still exists in the sibling suite, which probes wildcard listeners separately at :279-288.

Not verified: I ran nothing locally — this box cannot hold the workspace (~1.2 GB free), so the EADDRINUSE-while-held reproduction and the 13/13 and 42/42 pass counts in the description are the author's, unreproduced by me. Test (ubuntu-latest, Node 22.x) and Lint & Static are green at this head; the Java lanes and web-shell E2E Smoke were still running, and cannot be affected by a CLI unit-test file.

Disclosure: this PR was authored by qwen-code-dev-bot and my review comes from qwen-code-review-bot — both accounts in the same automation family, so this approval is not an independent human check. Recording that as a fact rather than treating it as a blocker: the diff is test-only and I verified it line by line, but a maintainer's eyes remain the only independent review this PR will have had.

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no blockers. Suggestions are inline.

Test Plan (not a blocker): src/serve/managed-runtime-container.test.ts — no such file or directory; src/serve/managed-runtime-attestation-worker.test.ts — no such file or directory; 13 tests pass — this review observed 40057, 609 passed; 42 passed — this review observed 40057, 609 passed.

äļ­æ–‡čŊŽ

å·ēåŪĄæŸĨ——无é˜ŧ断é—ŪéĒ˜ã€‚ åŧščŪŪč§čĄŒå†…čŊ„čŪšã€‚

Test Plan非é˜ŧ断src/serve/managed-runtime-container.test.ts — no such file or directory; src/serve/managed-runtime-attestation-worker.test.ts — no such file or directory; 13 tests pass — this review observed 40057, 609 passed; 42 passed — this review observed 40057, 609 passed。

— qwen3.8-max via Qwen Code /review (v0.25.0)

Comment thread packages/cli/src/serve/managed-runtime-container.test.ts Outdated
@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator Author

🕐 Review received — an automatic review of the current head is still running, so this round is held until it lands (a push now would cancel it and discard its work, #8888). Your feedback stays queued for the next eligible round.

äļ­æ–‡čŊŽ

🕐 å·ēæ”ķ到čŊ„åŪĄ —— å―“å‰ head äļŠäŧæœ‰äļ€č―Ū臩åŠĻ review åœĻčŋčĄŒïžŒæœŽč―Ūæš‚įž“ïžˆįŽ°åœĻæŽĻ送䞚取æķˆčŊĨ review åđķäļĒ垃å…ķå·Ĩä―œïžŒ#8888。反é͈äŋæŒæŽ’é˜ŸïžŒį­‰åū…äļ‹äļ€æŽĄåŊčŋčĄŒįš„č―ŪæŽĄåĪ„į†ã€‚

@qwen-code-dev-bot

qwen-code-dev-bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator Author

✅ AutoFix round 2 finished — view run. See this round's report below.

äļ­æ–‡čŊŽ

✅ AutoFix įŽŽ 2 č―Ūå·ēåŪŒæˆ —— æŸĨįœ‹čŋčĄŒã€‚朎č―ŪæŠĨå‘Šč§ä–đ。

â€Ķ13775)

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator Author

ðŸĪ– Addressed the latest review feedback (round 1/10). What changed, and what I pushed back on: · å·ēåĪ„į†æœ€æ–°čŊ„åŪĄåéĶˆïžˆįŽŽ 1/10 č―Ū。æ”đåŠĻ内åŪđäļŽæˆ‘反éĐģäŋį•™äđ‹åĪ„åĶ‚äļ‹ïžš

Round summary

Addressed the single inline suggestion from the round-1 review. One commit: 410f707fdc test(cli): forward the requested bind host in ephemeral listen mocks (#13775).

Feedback dispositions

  • [rc:4234307856] R1-1 (Suggestion) — implemented. The mockEphemeralListen helper introduced by this PR replaced the caller's entire argument list with [0, '127.0.0.1'], so the container-mode test bound loopback instead of the requested wildcard address — silently stripping the rewritten ready.url assertion of its host witness (a worker publishing http://0.0.0.0:<port> would have stayed green). Both listen mocks now override only the port and forward the caller's own arguments ([0, ...args.slice(1)]), so the container worker really binds 0.0.0.0:<ephemeral> while the first test's non-container worker keeps 127.0.0.1. The fix was applied to both copies (managed-runtime-container.test.ts and the pattern's source in managed-runtime-attestation-worker.test.ts) so they cannot drift, and the helper comment now states why only the port is substituted. The substituted port stays 0, so the fixed-port EADDRINUSE collision this PR removed is not reintroduced. No production code changed.

Reproduction and mutation probes

  • Pre-fix probe (claim reproduction): mutated managed-runtime-attestation-worker.ts to derive the ready-URL host from the bound address (url: `http://${address.address}:${address.port}` ); managed-runtime-container.test.ts stayed green — 13/13 passed — confirming the mutant survives at the pre-round head and the witness was indeed lost.
  • Post-fix probe: with the same mutation re-applied, opens the explicit container port with authenticated attestation failed with expected 'http://0.0.0.0:39589' to be 'http://127.0.0.1:39589' — the witness is restored. The other 12 container tests and all 29 attestation-worker tests still passed under the mutation.
  • Production was then restored byte-identically (exact-string replacement, count-asserted both ways) and both suites re-run green (42/42).

Other feedback

  • The review-level "Test Plan" observations and the serve A/B activeWorkStaleMs 6→5 delta are informational timing noise, not findings; no action taken.
  • No failed checks were listed for this round.

Verification

  • npm run build — passed (exit 0). Required COREPACK_HOME=/tmp/corepack-cache because the sandbox denies corepack's default cache directory under $HOME (EACCES); with that override the full workspace build completed.
  • npm run typecheck — passed (exit 0).
  • npm run lint — passed (exit 0).
  • npx vitest run src/serve/managed-runtime-container.test.ts src/serve/managed-runtime-attestation-worker.test.ts (from packages/cli) — 2 files, 42 tests passed (13 + 29).
  • Mutation probes (described above): pre-fix mutant green → post-fix mutant red → production restored green.
  • Pre-commit hook (prettier + eslint --fix --max-warnings 0) ran on the staged files and produced no modifications.
äļ­æ–‡čŊŽ

朎č―Ūæ€ŧįŧ“

åĪ„į†äš†įŽŽ 1 č―ŪčŊ„åŪĄäļ­å”Ŋäļ€įš„äĄčĄŒå†…åŧščŪŪã€‚äš§į”Ÿäļ€äļŠæäšĪïžš410f707fdc test(cli): forward the requested bind host in ephemeral listen mocks (#13775)。

反é͈åĪ„į―Ū

  • [rc:4234307856] R1-1åŧščŪŪ— å·ēåŪžįŽ°ã€‚ 朎 PR åž•å…Ĩįš„ mockEphemeralListen čū…åŠĐå‡―æ•°æ­Ī前į”Ļ [0, '127.0.0.1'] æ•īä―“æ›ŋæĒ调į”Ļæ–đįš„å‚æ•°åˆ—čĄĻåŊžč‡īåŪđå™ĻæĻĄåžæĩ‹čŊ•åŪžé™…įŧ‘åŪšå›žįŽŊåœ°å€č€ŒéžčŊ·æą‚įš„é€šé…åœ°å€â€”â€”čŋ™æ‚„æ‚„ä―ŋæ”đå†™åŽįš„ ready.url 断čĻ€åĪąåŽŧ乆äļŧæœšč§čŊïžˆåģä―ŋ worker 发åļƒ http://0.0.0.0:<port> æĩ‹čŊ•äđŸäŧäļšįŧŋč‰ēïž‰ã€‚įŽ°åœĻäļĪåĪ„ listen mock éƒ―åŠč͆ᛖįŦŊåĢåđķč―Žå‘č°ƒį”Ļæ–đč‡Šå·ąįš„å‚æ•°ïžˆ[0, ...args.slice(1)]因æ­ĪåŪđå™Ļ worker ᜟåŪžįŧ‘åۚ 0.0.0.0:<äļīæ—ķįŦŊåĢ>ïžŒč€ŒįŽŽäļ€äļŠæĩ‹čŊ•äļ­įš„非åŪđå™Ļ worker äŧäŋæŒ 127.0.0.1。čŊĨäŋŪåĪåŒæ—ķåš”į”Ļ䚎äļĪäŧ―å‰Ŋ朎managed-runtime-container.test.ts äŧĨ及čŊĨæĻĄåžįš„æĨ暐 managed-runtime-attestation-worker.test.tsé˜ēæ­ĒäļĪåĪ„įŧ§įŧ­æž‚į§ŧïž›čū…åŠĐå‡―æ•°įš„æģĻ释äđŸå·ēæ›ī新čŊŽäļšäŧ€äđˆåŠæ›ŋæĒįŦŊåĢ。æ›ŋæĒåŽįš„įŦŊåĢäŋæŒäļš 0äļäžšé‡æ–°åž•å…Ĩ朎 PR 所æķˆé™Īįš„å›šåۚįŦŊåĢ EADDRINUSE å†ēįŠã€‚æœŠæ”đåŠĻäŧŧä―•į”Ÿäš§äŧĢį ã€‚

åĪįŽ°äļŽå˜åž‚æŽĒ针

  • äŋŪåĪå‰æŽĒ针åĪįŽ°čŊ„åŪĄæ–­čĻ€ïž‰ïžš 将 managed-runtime-attestation-worker.ts 变垂äļšäŧŽåŪžé™…įŧ‘åŪšåœ°å€æŽĻåŊž ready-URL äļŧ朚url: `http://${address.address}:${address.port}` managed-runtime-container.test.ts äŋæŒå…Ļįŧŋ——13/13 通čŋ‡â€”—čŊåŪžčŊĨå˜åž‚ä―“åœĻ朎č―Ūå‰įš„ head äļŠįĄŪåŪžå­˜æīŧäļŧæœšč§čŊįĄŪå·ēäļĒåĪąã€‚
  • äŋŪåĪåŽæŽĒ针 é‡æ–°æ–―åŠ åŒäļ€å˜åž‚后opens the explicit container port with authenticated attestation åĪąčīĨæŠĨ expected 'http://0.0.0.0:39589' to be 'http://127.0.0.1:39589'——见čŊå·ēæĒåĪã€‚åœĻ变垂存åœĻįš„æƒ…å†ĩäļ‹ïžŒå…ķä―™ 12 äļŠåŪđå™Ļæĩ‹čŊ•å’Œå…ĻéƒĻ 29 äļŠ attestation-worker æĩ‹čŊ•äŧį„ķ通čŋ‡ã€‚
  • éšåŽå°†į”Ÿäš§äŧĢį é€å­—čŠ‚čŋ˜åŽŸïžˆåŒå‘å‡äļšįēūįĄŪ字įŽĶäļēæ›ŋæĒåđķæ–­čĻ€æ›ŋæĒæŽĄæ•°ïž‰ïžŒäļĪåĨ—æĩ‹čŊ•重新čŋčĄŒå…Ļįŧŋ42/42。

å…ķäŧ–反é͈

  • čŊ„åŪĄįš§įš„ "Test Plan" 观åŊŸčŪ°å―•äŧĨ及 serve A/B äļ­ activeWorkStaleMs 6→5 įš„å·Ūå€žåąžäšŽäŋĄæŊæ€§įš„æ—ķ嚏噊åĢ°ïžŒåđķéžå‘įŽ°ïž›æœŠé‡‡å–čĄŒåŠĻ。
  • 朎č―ŪæēĄæœ‰åˆ—凚åĪąčīĨįš„æĢ€æŸĨ。

驌čŊ

  • npm run build — 通čŋ‡ïžˆé€€å‡šį  0ïž‰ã€‚į”ąäšŽæē™įŪąæ‹’įŧ corepack åœĻ $HOME äļ‹åˆ›åŧšéŧ˜čŪĪįž“å­˜į›Ūå―•ïžˆEACCES需č́čŪūį―Ū COREPACK_HOME=/tmp/corepack-cacheïž›ä―ŋį”ĻčŊĨčĶ†į›–åŽæ•īäļŠå·Ĩä―œåŒšæž„åŧšåŪŒæˆã€‚
  • npm run typecheck — 通čŋ‡ïžˆé€€å‡šį  0。
  • npm run lint — 通čŋ‡ïžˆé€€å‡šį  0。
  • npx vitest run src/serve/managed-runtime-container.test.ts src/serve/managed-runtime-attestation-worker.test.tsåœĻ packages/cli äļ‹čŋčĄŒïž‰â€” 2 äļŠæ–‡äŧķ42 äļŠæĩ‹čŊ•通čŋ‡ïžˆ13 + 29。
  • 变垂æŽĒ针åĶ‚ä‰€čŋ°ïž‰ïžšäŋŪåĪå‰å˜åž‚ä―“äļšįŧŋ → äŋŪåĪåŽå˜åž‚ä―“å˜įšĒ → čŋ˜åŽŸį”Ÿäš§äŧĢį åŽæĒåĪäļšįŧŋ。
  • pre-commit é’Đ子prettier + eslint --fix --max-warnings 0å·ēåœĻ暂存文äŧķäļŠčŋčĄŒïžŒæœŠäš§į”Ÿäŧŧä―•éĒåĪ–äŋŪæ”đ。

Base-conflict check · 埚分æ”Ŋå†ēįŠæĢ€æŸĨ: no conflict with main. · äļŽ main 无å†ēįŠã€‚

ðŸ§ĩ Resolved all 1 selected review thread(s). · å·ēå…ģ闭å…ĻéƒĻ选äļ­įš„ 1 æĄčŊ„åŪĄįšŋįĻ‹ã€‚

Re-review when you have a moment. After round 10 this bot stops and leaves the PR for a human. · 有įĐščŊ·åĪåŪĄïž›įŽŽ 10 č―Ū后朎 bot 停æ­Ēåđķ将 PR äšĪįŧ™äššå·Ĩ。


🧠 Handled by Qwen Code · model/æĻĄåž‹ kimi-k3 · CLI 0.25.0

@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator Author

ðŸĪ– Reviewed the latest feedback — no changes needed. Why, point by point: · å·ēåŪĄé˜…æœ€æ–°åéĶˆâ€”â€”æ— éœ€æ”đåŠĻ。逐į‚đčŊŽåŽŸå› åĶ‚äļ‹ïžš

No action this round — both failed checks are CI infrastructure flakes, not code defects

Feedback triaged

  • Failed check: Runtime Broker and Managed Agent MariaDB / Java 21 (SDK Java workflow)
  • Failed check: Hosted process fault gates / MySQL 8.4 / Java 21 (SDK Java workflow)
  • No reviews, inline comments, or issue-level comments were pending.

Diagnosis (from evidence, not guesswork)

Both jobs failed in the Initialize containers step — before Checkout ever ran, so zero lines of repository code (from this PR or otherwise) executed in either job. Step-level data from the GitHub Jobs API for run 37994110766 (head SHA 410f707fdc):

Job Failing step Step duration Checkout and all later steps
Runtime Broker and Managed Agent MariaDB / Java 21 (job 114035593410) Initialize containers → FAILURE 21:33:00 → 21:33:42 (~42 s) skipped
Hosted process fault gates / MySQL 8.4 / Java 21 (job 114035593507) Initialize containers → FAILURE 21:33:00 → 21:33:45 (~45 s) skipped

Corroborating evidence:

  • These jobs normally run for many minutes (their timeouts are 15 and 140 minutes); both died in under 50 seconds while pulling/starting the mariadb:10.11.18 / mysql:8.4.6 service containers.
  • They are the only two jobs in the SDK Java workflow that declare services: containers. Every sibling job in the same run on the same SHA succeeded: ubuntu/macos/windows × Java 11/17/21, Flyway migration version uniqueness, and Real daemon E2E / Java 11.
  • The six most recent SDK Java runs on main (latest 2026-10-09T16:18Z, SHA 5b1c701400) are all green, so the pinned images and the workflow definition are healthy — this is a transient runner/container-runtime failure, not a persistent breakage.
  • This PR's diff touches only two TypeScript test files (packages/cli/src/serve/managed-runtime-attestation-worker.test.ts, packages/cli/src/serve/managed-runtime-container.test.ts, +24/−8). Nothing in it can influence a Docker image pull on a GitHub-hosted runner, and the repository had not even been checked out when the failure occurred.

Why no code change

  • The failing surface is GitHub-hosted runner container infrastructure. The remedy for a transient container-init failure is re-running the failed jobs — a network write only the workflow or a maintainer can trigger.
  • Any durable hardening (e.g., image or workflow changes) would live in .github/workflows/sdk-java.yml, which is CI machinery outside this PR's footprint; the autofix loop is not permitted to modify it and must escalate such changes to a maintainer instead.
  • The PR's own test surface is green locally (see Verification), and the workflow's independent CI remains the final gate — a re-run of the two failed jobs should clear them.

Verification

  • git diff origin/main...HEAD — reviewed in full: 2 test files, +24/−8, test-only changes.
  • GitHub Jobs API for jobs 114035593410 and 114035593507 — both failed at Initialize containers; Checkout and every subsequent step skipped (evidence quoted above).
  • GitHub workflow-runs API for sdk-java.yml on main — 6/6 recent runs SUCCESS.
  • npm run build — passed (after setting COREPACK_HOME=/tmp/corepack-cache because the sandbox's default corepack cache path is read-only; the first attempt failed with EACCES: permission denied, mkdir '.../.cache/node/corepack/v1', which is an environment limitation, not a build defect).
  • npx vitest run src/serve/managed-runtime-attestation-worker.test.ts src/serve/managed-runtime-container.test.ts (packages/cli) — 42/42 tests passed.

No files were changed and no commit was made this round.

äļ­æ–‡čŊŽ

朎č―Ūæ— éœ€æ”đåŠĻ——äļĪäļŠåĪąčīĨįš„æĢ€æŸĨ均äļš CI åŸšįĄ€čŪūæ–―åķ发故障,而非äŧĢį įžšé™·

å·ē分įąŧįš„åé͈

  • åĪąčīĨįš„æĢ€æŸĨ: Runtime Broker and Managed Agent MariaDB / Java 21(SDK Java å·Ĩä―œæĩ)
  • åĪąčīĨįš„æĢ€æŸĨ: Hosted process fault gates / MySQL 8.4 / Java 21(SDK Java å·Ĩä―œæĩ)
  • æēĄæœ‰åū…åĪ„į†įš„ reviewã€čĄŒå†…čŊ„čŪšæˆ– issue įš§čŊ„čŪšã€‚

čŊŠæ–­(埚䚎čŊæŪ,č€ŒéžįŒœæĩ‹)

äļĪäļŠäŧŧåŠĄéƒ―åĪąčīĨåœĻ Initialize containers æ­ĨéŠĪ——Checkout å°šæœŠæ‰§čĄŒ,因æ­Īčŋ™äļĪäļŠäŧŧåŠĄäļ­æēĄæœ‰čŋčĄŒäŧŧä―•äŧ“åš“äŧĢ᠁(无čŪšæ˜Ŋ朎 PR įš„čŋ˜æ˜Ŋå…ķäŧ–įš„)。æĨ臩 GitHub Jobs API įš„čŋčĄŒ 37994110766(head SHA 410f707fdc)įš„æ­ĨéŠĪįš§æ•°æŪ:

äŧŧåŠĄ åĪąčīĨæ­ĨéŠĪ æ­ĨéŠĪ耗æ—ķ Checkout 及后įŧ­æ‰€æœ‰æ­ĨéŠĪ
Runtime Broker and Managed Agent MariaDB / Java 21(äŧŧåŠĄ 114035593410) Initialize containers → åĪąčīĨ 21:33:00 → 21:33:42(įšĶ 42 į§’) č·ģčŋ‡
Hosted process fault gates / MySQL 8.4 / Java 21(äŧŧåŠĄ 114035593507) Initialize containers → åĪąčīĨ 21:33:00 → 21:33:45(įšĶ 45 į§’) č·ģčŋ‡

ä―čŊ:

  • čŋ™äš›äŧŧåŠĄæ­ĢåļļčŋčĄŒéœ€čĶæ•°åˆ†é’Ÿ(čķ…æ—ķæ—ķé—ī分åˆŦäļš 15 分钟和 140 分钟);äļĪč€…éƒ―åœĻ拉取/åŊåŠĻ mariadb:10.11.18 / mysql:8.4.6 æœåŠĄåŪđå™Ļæ—ķ䚎 50 ᧒内åĪąčīĨ。
  • åۃäŧŽæ˜Ŋ SDK Java å·Ĩä―œæĩäļ­äŧ…æœ‰įš„äļĪäļŠåĢ°æ˜Žäš† services: åŪđå™Ļįš„äŧŧåŠĄã€‚åŒäļ€čŋčĄŒã€åŒäļ€ SHA äļŠįš„æ‰€æœ‰å…ķäŧ–äŧŧåŠĄå…ĻéƒĻ成功:ubuntu/macos/windows × Java 11/17/21、Flyway migration version uniqueness 和 Real daemon E2E / Java 11。
  • main 分æ”Ŋäœ€čŋ‘å…­æŽĄ SDK Java čŋčĄŒ(最čŋ‘äļ€æŽĄäļš 2026-10-09T16:18Z,SHA 5b1c701400)å…ĻéƒĻ通čŋ‡,čŊŽå›šåŪšįš„é•œåƒå’Œå·Ĩä―œæĩåۚäđ‰æ˜ŊåĨåš·įš„â€”â€”čŋ™æ˜Ŋäļ€æŽĄčŋčĄŒå™Ļ/åŪđå™ĻčŋčĄŒæ—ķįš„įžŽæ—ķ故障,č€ŒéžæŒįŧ­æ€§æŸåã€‚
  • 朎 PR įš„ diff 及æ”đåŠĻ乆äļĪäļŠ TypeScript æĩ‹čŊ•æ–‡äŧķ(packages/cli/src/serve/managed-runtime-attestation-worker.test.ts、packages/cli/src/serve/managed-runtime-container.test.ts,+24/−8)。å…ķäļ­æēĄæœ‰äŧŧä―•å†…åŪđčƒ―å―ąå“ GitHub 托įŪĄčŋčĄŒå™ĻäļŠįš„ Docker 镜像拉取,而ä•…éšœå‘į”Ÿæ—ķäŧ“åš“į”šč‡ģ尚朊čĒŦæĢ€å‡šã€‚

äļšäŧ€äđˆäļåšäŧĢ᠁æ”đåŠĻ

  • 故障éĒåœĻ GitHub 托įŪĄčŋčĄŒå™Ļįš„åŪđå™ĻåŸšįĄ€čŪūæ–―ã€‚åŊđįžŽæ—ķåŪđå™Ļåˆå§‹åŒ–æ•…éšœįš„čĄĨæ•‘æŽŠæ–―æ˜Ŋ重新čŋčĄŒåĪąčīĨįš„äŧŧåŠĄâ€”â€”čŋ™æ˜Ŋ及有å·Ĩä―œæĩæˆ–įŧĪč€…æ‰čƒ―č§Ķå‘įš„į―‘įŧœå†™æ“ä―œã€‚
  • äŧŧä―•æŒäđ…åŒ–įš„åŠ å›š(äū‹åĶ‚é•œåƒæˆ–å·Ĩä―œæĩå˜æ›ī)éƒ―å°†č―åœĻ .github/workflows/sdk-java.yml,čŋ™åąžäšŽæœŽ PR 范å›īäđ‹åĪ–įš„ CI åŸšįĄ€čŪūæ–―;autofix æĩįĻ‹äļå…čŪļäŋŪæ”đåۃ,æ­Īįąŧ变æ›īåŋ…éĄŧäŠĨįŧ™įŧĪč€…ã€‚
  • 朎 PR 臩čšŦįš„æĩ‹čŊ•éĒåœĻ朎地æ˜Ŋ通čŋ‡įš„(见ä–đ驌čŊ),å·Ĩä―œæĩįš„į‹ŽįŦ‹ CI äŧæ˜Ŋ最įŧˆé—ĻįĶâ€”â€”é‡æ–°čŋčĄŒčŋ™äļĪäļŠåĪąčīĨįš„äŧŧåŠĄåš”å―“åģåŊæĒåĪã€‚

驌čŊ

  • git diff origin/main...HEAD —— å·ēåیæ•īåŪĄæŸĨ:2 äļŠæĩ‹čŊ•æ–‡äŧķ,+24/−8,įšŊæĩ‹čŊ•æ”đåŠĻ。
  • GitHub Jobs API æŸĨčŊĒäŧŧåŠĄ 114035593410 和 114035593507 —— äļĪč€…å‡åĪąčīĨ䚎 Initialize containers;Checkout 及后įŧ­æ‰€æœ‰æ­ĨéŠĪ均čĒŦč·ģčŋ‡(čŊæŪåĶ‚äļŠ)。
  • GitHub workflow-runs API æŸĨčŊĒ main 分æ”Ŋįš„ sdk-java.yml —— 最čŋ‘ 6 æŽĄčŋčĄŒå…ĻéƒĻ成功。
  • npm run build —— 通čŋ‡(åœĻčŪūį―Ū COREPACK_HOME=/tmp/corepack-cache äđ‹åŽ,因äļšæē™įŪąéŧ˜čŪĪįš„ corepack įž“å­˜č·Ŋåū„æ˜Ŋ及čŊŧįš„;éĶ–æŽĄå°čŊ•åĪąčīĨ䚎 EACCES: permission denied, mkdir '.../.cache/node/corepack/v1',čŋ™æ˜ŊįŽŊåĒƒé™åˆķ,äļæ˜Ŋ构åŧšįžšé™·)。
  • npx vitest run src/serve/managed-runtime-attestation-worker.test.ts src/serve/managed-runtime-container.test.ts(packages/cli)—— 42/42 äļŠæĩ‹čŊ•å…ĻéƒĻ通čŋ‡ã€‚

朎č―ŪæœŠæ”đåŠĻäŧŧä―•æ–‡äŧķ,äđŸæœŠåˆ›åŧšæäšĪ。

Base-conflict check · 埚分æ”Ŋå†ēįŠæĢ€æŸĨ: no conflict with main. · äļŽ main 无å†ēįŠã€‚

ðŸĐļ Regression charged to round 1: that round pushed onto a head whose checks were all green and left them red. It no longer counts as progress for the consecutive-failure brake. · å·ēå°†å›žå―’čŪ°åœĻįŽŽ 1 č―ŪïžščŊĨč―ŪåœĻæĢ€æŸĨå…Ļįŧŋįš„ head äŽĻ送后æĢ€æŸĨč―ŽįšĒ因æ­Īäļå†čŪĄå…Ĩčŋžįŧ­åĪąčīĨį†”æ–­įš„æœ‰čŋ›åą•åˆĪåŪšã€‚


🧠 Handled by Qwen Code · model/æĻĄåž‹ kimi-k3 · CLI 0.25.0

@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator Author

🔀 Base updated: red check(s) [Runtime Broker and Managed Agent MariaDB / Java 21, Hosted process fault gates / MySQL 8.4 / Java 21] pass on current main — merged current main via update-branch; CI will re-run.

äļ­æ–‡čŊŽ

🔀 å·ēæ›ī新 baseïžšįšĒč‰ēæĢ€æŸĨ [Runtime Broker and Managed Agent MariaDB / Java 21, Hosted process fault gates / MySQL 8.4 / Java 21] åœĻå―“å‰ main äļŠé€ščŋ‡ —— å·ē通čŋ‡ update-branch 合å…Ĩå―“å‰ mainCI 将重新čŋčĄŒã€‚

@wenshao

wenshao commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

@qwen-code /triage

@qwen-code-review-bot

qwen-code-review-bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Sandboxed verification: ✅ passed — merge-ready (agent verdict) - workflow run

Ran the PR in an isolated, token-free container: A/B against the base build, mock-free harness assertions, targeted gates. Advisory evidence for human reviewers — not a review, an approval, or a CI check.

Scripted assertions: 110 passed · 0 failed · 110 total

Flakiness gate: ✅ 2 changed test file(s) x 5 identical rounds, no divergence

äļ­æ–‡ — åˆĪåŪšïžšâœ… 通čŋ‡ · åŊ合å…Ĩagent åˆĪåŪšïž‰

æē™įŪąéŠŒčŊåœĻ隔įĶŧ、无凭čŊįš„åŪđå™Ļäļ­æ‰§čĄŒäš†čŊĨ PR įš„äŧĢį ïžˆäļŽ base 构åŧš A/B åŊđį…§ã€æ—  mock harness 断čĻ€ã€åŪšå‘é—ĻįĶïž‰ã€‚äŧ…ä―œäļščŊ„åŪĄčŊæŪäļæž„成čŊ„åŪĄã€æ‰đ准或 CI æĢ€æŸĨ。

č„šæœŽæ–­čĻ€ïžš110 通čŋ‡ · 0 åĪąčīĨ · 110 æ€ŧčŪĄ

抖åŠĻé—Ļ✅ 2 changed test file(s) x 5 identical rounds, no divergence

Verification report

Verdict: merge-ready — 110 scripted assertions executed, 110 passed, 0 failed.
Verified head 39d9dd574a4101101fdb2f451ab0d18fdbf7a45b (git rev-parse HEAD^2), base c0c697c8a3d7d0460d37c497b76d52968c9216f7 (HEAD^1), merge commit under test 6537f1e1e036637398807baf5d7d144e5a6b8c19.

äļ­æ–‡æ‘˜č́

įŧ“čŪšïžšmerge-ready —— 朎č―Ūå…ąæ‰§čĄŒ 110 æĄč„šæœŽåŒ–æ–­čĻ€ïžŒå…ĻéƒĻ通čŋ‡ïžŒ0 æĄåĪąčīĨ。

A/B įŧ“čŪšïžˆäļ­åŋƒäļŧ垠成įŦ‹ã€ä˜Ŋ load-bearing įš„ïž‰ïžšåœĻ CI åŪđå™Ļäļ­į”Ļäļ€äļŠæ— å…ģčŋ›įĻ‹å į”Ļ 0.0.0.0:43190åŊđ baseHEAD^1 įš„į‹ŽįŦ‹ worktreeäļŽ head č·‘åŒäļ€åĨ—äŧķ。base åĪįŽ° issue #13775ïžšmanaged-runtime-container.test.ts 11/13 通čŋ‡ã€2 äļŠåĪąčīĨåĪąčīĨäŋĄæŊæ­Ģæ˜Ŋ listen EADDRINUSE: address already in use 0.0.0.0:43190äļ”åĪąčīĨįš„æ°åĨ―æ˜ŊäļĪäļŠåŪđå™ĻæĻĄåžį”Ļäū‹ïž›head åœĻįŦŊåĢčĒŦ占į”Ļæ—ķ 13/13 å…ĻįŧŋįŦŊåĢįĐšé—ēæ—ķäđŸ 13/13。兄垟åĨ—äŧķ managed-runtime-attestation-worker.test.ts åœĻäļĪäū§å‡ 29/29。čŊĶ见ä–‡ A/B cell matrix äļŽ 01-ab-port-collision-base-vs-head.png。

Findingsïžšæ— é˜ŧåĄžéĄđ。äļĪæĄ Suggestion įš§č§‚åŊŸïžˆæ–­čĻ€æœŠæŒ‰č°ƒį”ĻæŽĄåšé™åŪšïž›commit 2 įš„ host 透侠åœĻ兄垟åĨ—äŧķäļ­æ— æĩ‹čŊ•åŊ观æĩ‹æ”ķį›ŠïžŒåđķæŠŠčŊĨåĨ—äŧķåŪđå™ĻæĻĄåžįŧ‘åŪšįš„į―‘åĄäŧŽ 127.0.0.1 æ”ūåŪ―åˆ° 0.0.0.0。均å·ēåŪžæĩ‹į•ŒåŪšïžŒäļå―ąå“åˆåđķ。

变垂įŸĐé˜ĩïžš11 äļŠå˜åž‚ä―“å…ĻéƒĻäļŽéĒ„æĩ‹äļ€č‡īåŦ 1 äļŠæ­ĢåŊđį…§ïž‰ã€‚å…ģé”Ūįŧ“æžœâ€”â€”į”Ÿäš§įŦŊ把 43190 æ”đ成 43191M1或把 '0.0.0.0' æ”đ成 '127.0.0.1'M2ïž‰éƒ―äžščŪĐ opens the explicit container portâ€Ķ åœĻ toHaveBeenCalledWith(43190, '0.0.0.0') åĪ„å˜įšĒPR åĢ°į§°įš„čĄŒäļšč§čŊæˆįŦ‹ïž›åˆ æŽ‰äŧŧäļ€ mockEphemeralListen()M6/M7åœĻįŦŊåĢčĒŦ占į”Ļæ—ķįŦ‹åˆŧäŧĨ EADDRINUSE 变įšĒčŊæ˜ŽäļĪäļŠ hunk éƒ―æ˜Ŋ load-bearing。įŧ„合变垂 M10 æ˜Ŋ朎č―Ūæœ€æœ‰äŧ·å€žįš„äĄïžšå•į‹Žå›žé€€ commit 2 įš„ host 透䞠M3/M4存æīŧïžŒä―†æŠŠ host 透侠äļŽ"į”Ÿäš§įŦŊæ”đį”Ļ address.address 拞 ready.url"äļ€čĩ·æ”đæ—ķM9 įš„å‡ŧ杀æķˆåĪąïžˆ42/42 å…Ļįŧŋ——čŋ™åŪžæĩ‹čŊæ˜Žäš†æĩ‹čŊ•æ–‡äŧķ里é‚ĢåĨæģĻé‡Šįš„į†į”ąïžˆåžšåˆķ loopback 侚čŪĐ ready.url įš„ host 断čĻ€å˜æˆč‡ŠčŊïž‰æ˜Ŋæ­ĢįĄŪįš„ã€‚čŊĶ见 Mutation matrix äļŽ 02-mutation-matrix-kills-and-survivors.png。

朊čĶ†į›–čŒƒå›īïžšpackages/cli å…Ļ量单æĩ‹ïžˆ1234 äļŠæĩ‹čŊ•æ–‡äŧķïž‰æœŠč·‘ïžŒåŠč·‘äš†å—å―ąå“į›Ūå―• src/serve310 文äŧķ / 13602 通čŋ‡ / 0 åĪąčīĨdepth-2 æĢ€å‡šäļ‹ 3 äļŠæäšĪ及有 1 äļŠåŊčūū无æģ•逐提äšĪå―’å› ïž›æ—  GitHub token无æģ•æ ļåŊđæœŽ PR 臩čšŦ CI įĐķįŦŸč·‘䚆äŧ€äđˆïž›macOS / Windows 朊æĩ‹ïž›åŪđå™Ļå†…įœŸåŪžįŧ‘åۚ 43190 įš„į”Ÿäš§č·Ŋåū„朊æĩ‹ïžˆPR å·ēåĢ°æ˜Žčķ…čŒƒå›īsdk-java äū§åŒæ ·åž•į”Ļ 43190ïžŒä―† QWEN_VERIFY_JAVA 朊čŪūį―Ū、åŪđå™Ļ内无 JDKïžŒæœŠæ‰§čĄŒã€‚"äŧ“嚓内æēĄæœ‰åˆŦįš„æĩ‹čŊ•įœŸįŧ‘ 43190" čŋ™äĄæ˜Ŋ静态æ™ŪæŸĨįŧ“čŪšïžŒäļæ˜ŊåœĻ占į”ĻįŦŊåĢäļ‹č·‘å…Ļ量åĨ—äŧķåū—åˆ°įš„ïž›æ™ŪæŸĨč͆ᛖäŧ“åš“æšį äļ­å…ĻéƒĻ 224 åĪ„ .listen(<数字字éĒ量>)é™Ī scripts/tests/managed-agent-dev.test.js:335 囚åۚįŧ‘åۚ 5174åœĻ packages/cli äđ‹åĪ–ïžŒæœŽč―ŪæœŠčŋ›ä­ĨåŪĄčŪĄïž‰åĪ–å…ĻéƒĻä―ŋį”Ļ 0äļīæ—ķįŦŊåĢ。

Scope

The diff is test-only — 2 files, +24/−8, no production code:

file change
packages/cli/src/serve/managed-runtime-container.test.ts new test-local mockEphemeralListen() helper; used by the two container-mode tests; the explicit-port test now asserts toHaveBeenCalledWith(43190, '0.0.0.0') and derives the expected ready.url from the actually-bound port
packages/cli/src/serve/managed-runtime-attestation-worker.test.ts its pre-existing ephemeral-listen mock widened from forcing '127.0.0.1' to forwarding the requested host

Central claim: the two container-mode tests stop binding hard-coded 0.0.0.0:43190 for real, so the suite passes whether or not a neighbour holds that port — while still pinning that production requests (43190, '0.0.0.0').

Secondary claims: (1) the retained behavioural witness — mutating the production bind port still reddens the explicit-port test at toHaveBeenCalledWith(43190, '0.0.0.0'); (2) the host forwarding in the new mock is what keeps the ready.url host assertion from becoming self-referential (the new code comment's stated rationale).

Because the PR is test-only, the method is a mutation A/B across test files plus a port-collision A/B against a real base control, not a behaviour A/B against production.

A/B cell matrix — the central claim is load-bearing

Control: git worktree add tmp/base-tree HEAD^1 (c0c697c8), with the root and per-package node_modules plus every packages/*/dist hardlinked in via cp -al (0.8 s), and npm run generate run inside the base tree so it carries its own git-commit.ts (c0c697c8, not head's 6537f1e1). The PR touches no manifest or lockfile, so reusing the installed tree is a clean control.

Internal-link confound checked, not assumed — from inside the base worktree every @qwen-code/* resolves into the base tree:

qwen-code-core -> /__w/qwen-code/qwen-code/tmp/base-tree/packages/core
qwen-code      -> /__w/qwen-code/qwen-code/tmp/base-tree/packages/cli
acp-bridge     -> /__w/qwen-code/qwen-code/tmp/base-tree/packages/acp-bridge
web-templates  -> /__w/qwen-code/qwen-code/tmp/base-tree/packages/web-templates

Comparator proven with a positive control: diff -r --brief over packages/cli/src/serve reports only the two changed test files, and after a one-token edit to managed-runtime-attestation-worker.ts (43190 → 43191) the same comparator additionally reports that file. So "production byte-identical" is a measurement, not an absence of output.

Port holder: an in-process Node net server bound to 0.0.0.0:43190 — the same mechanism as the node -e one-liner in the Reviewer Test Plan. Its state was confirmed by an independent TCP probe before every cell (listening when held, ECONNREFUSED when free), never inferred from listen() returning.

cell arm port 43190 suite oracle result
A1 base free container vitest JSON counts 13/13 passed, 0 failed, exit 0
A2 base held container vitest JSON counts + failure text 11/13 passed, 2 failed, exit 1 — listen EADDRINUSE: address already in use 0.0.0.0:43190
A3 head free container vitest JSON counts 13/13 passed, 0 failed, exit 0
A4 head held container vitest JSON counts 13/13 passed, 0 failed, exit 0
B1 base held attestation-worker vitest JSON counts 29/29 passed, 0 failed
B2 head held attestation-worker vitest JSON counts 29/29 passed, 0 failed

The 2 base reds are exactly the two container-mode tests (wires the gate in the actual boot3 startupâ€Ķ and opens the explicit container port with authenticated attestation), asserted by name, and head runs the same 13 tests as the base control (no test silently lost). One cell pair flips — A2 red, A4 green — and the other four cells are the controls that pin that flip to the port collision rather than to the arm. Witness: 01-ab-port-collision-base-vs-head.png.

B1 is a control worth reading: the sibling suite was already immune on base, because it already had the ephemeral-listen mock. That is the pattern this PR copies, and it confirms the mechanism rather than merely asserting it.

Mutation matrix — does the suite still hold down what it claims to?

Every mutant runs with port 43190 held, i.e. in the environment where head is known-green (A4/B2), so any red is attributable to the mutation. Runner hygiene: unmutated baseline green through the identical runner (42/42, exit 0); every anchor dry-run for exactly one occurrence; a process.stderr.write marker proving each mutant executed (v1 of this harness used console.error, which vitest's console interception swallows whole — measured 0 occurrences, while process.stderr.write passed through 3/3); every kill attributed to a named test and an expected message token; per-mutant wall-clock cap; file hashes verified restored after each mutant; tree clean and zero orphaned ppid=1 processes at the end. Witness: 02-mutation-matrix-kills-and-survivors.png.

mutant target what it changes predicted observed counts
CTRL production INVALID_BOOT_MESSAGE text KILLED KILLED 22/42
M1-port production container bind port 43190 → 43191 KILLED KILLED 39/42
M2-host production container bind host '0.0.0.0' → '127.0.0.1' KILLED KILLED 39/42
M5-urlport production ready.url port hard-coded to 43190 KILLED KILLED 36/42
M9-urlhost production ready.url host from address.address KILLED KILLED 41/42
M3-test-host-fwd container test mock forces '127.0.0.1' again SURVIVED SURVIVED 42/42
M4-test-host-fwd attestation test mock forces '127.0.0.1' again SURVIVED SURVIVED 42/42
M10-combo-container container test + production M3 and M9 together SURVIVED SURVIVED 42/42
M11-combo-attest attestation test + production M4 and M9 together KILLED KILLED 41/42
M6-drop-mock-gate-test container test delete mockEphemeralListen() from the gate test KILLED KILLED 41/42
M7-drop-mock-port-test container test revert the explicit-port test to a plain spy KILLED KILLED 41/42

Kill attribution (named assertion, expected token present):

  • M1-port and M2-host both redden Managed Runtime container entry opens the explicit container port with authenticated attestation with expected "spy" to be called with arguments: [ 43190, '0.0.0.0' ], plus the two it.each ACK cases in the sibling suite. This is the PR's own claimed behavioural witness, and it holds.
  • M5-urlport reddens the same test at expected 'http://127.0.0.1:43190' to be 'http://127.0.0.1:38443' — so the rewritten ready.url assertion is not vacuous: it still pins that production derives the port from the bound socket rather than a constant.
  • M6/M7 each redden exactly the test whose mock was removed, with listen EADDRINUSE: address already in use 0.0.0.0:43190. Both hunks of the fix are individually load-bearing.

The combination row is the interesting one

M3 and M4 survived alone, which a one-row-per-guard matrix would file as two coverage gaps. They are not. M9 (production derives ready.url's host from address.address) is killed by the container test — but kill it again with the container mock also forced back to loopback (M10) and it survives at 42/42. Forcing loopback in only the sibling file (M11) leaves the kill intact.

So the host forwarding in managed-runtime-container.test.ts is load-bearing precisely as the new comment says: when the socket binds 127.0.0.1, production's hard-coded http://127.0.0.1: and http://${address.address}: are indistinguishable, and the host assertion loses its teeth. The forwarding in managed-runtime-attestation-worker.test.ts contributes no kill (M4 survived; M11 killed without it).

Upgraded from inferred to measured with a bind-host witness (bind-host-witness.mjs, 13/13): instrumenting each mock with a 'listening' listener that reports the kernel-bound address, without changing its behaviour —

variant requested kernel-bound address
head as shipped [43190,"0.0.0.0"] 0.0.0.0 on ephemeral ports 43427 / 36413 / 44843 / 41905
forced loopback (pre-commit-2) [43190,"0.0.0.0"] 127.0.0.1 on ephemeral ports 39213 / 45615 / 39049 / 39965

Both variants stay 42/42 green while instrumented, and the non-container workers in the same suites correctly bind 127.0.0.1:0 in both (4 of 5 recorded binds request 43190). The mock's host argument really does control the bound interface, and the port is ephemeral either way — which is the whole fix.

Reading the M5 row correctly

M5 shows 6 reds, but only one is the intended witness. Hard-coding ready.url to port 43190 sends other tests' fetch(worker.ready.url) at my port holder rather than at their worker, which is what reddens does not accept connections on other local addresses and the four STACK_TRACE_ERROR rows. That is an artefact of combining this particular mutant with a held 43190, not a property of the PR. The intended kill — the container test at line 332 — fired with the expected token.

Reviewer Test Plan, step by step

plan step performed? result
hold 43190 with a throwaway listener, run the container suite, expect 2 EADDRINUSE failures before the change yes cell A2: 11/13, 2 failed, exact message listen EADDRINUSE: address already in use 0.0.0.0:43190, and the two reds are exactly the two container-mode tests
â€Ķall 13 pass after the change yes cell A4: 13/13, exit 0
run the file normally with the port free — 13 pass yes cells A1 (base) and A3 (head): 13/13 both
run the pair of container-mode suites — 42 passed yes mutation-matrix baseline, same runner: 42/42 passed, exit 0
mutating the source bind port away from 43190 reddens opens the explicit container portâ€Ķ at toHaveBeenCalledWith(43190, '0.0.0.0') yes M1-port: that test red with expected "spy" to be called with arguments: [ 43190, '0.0.0.0' ]

Every step was performable; none was structurally unreachable. One deviation: the port holder was an in-process net server inside the harness rather than a separate node -e process — same bind, and its state was TCP-probed before each cell instead of assumed.

Findings

No blocking findings. Two Suggestion-level observations, both measured and bounded.

S1 — the port/host assertion is no longer scoped to the first listen call

expect(listen).toHaveBeenCalledWith(43190, '0.0.0.0') passes if any recorded call carried those arguments. The base assertion read listen.mock.results[0]?.value?.address(), i.e. the first call specifically. Today the explicit-port test starts exactly one worker, so the two forms are equivalent and M1/M2 confirm the assertion has teeth. If a future edit starts a second server in that test, the unscoped form could pass on the wrong one. expect(listen.mock.calls[0]).toEqual([43190, '0.0.0.0']) would keep the same strength and the scoping. Not a defect as shipped, and it matches the sibling suite's pre-existing style, so consistency argues the other way.

S2 — commit 2's host forwarding is inert in the sibling suite and widens its bind interface there

Measured: M4 (revert the forwarding in managed-runtime-attestation-worker.test.ts) survives 42/42, and M11 shows the container test still kills the production mutation without it — so that file's forwarding buys no detection power. The bind witness shows what it does change: that suite's container-mode ACK worker bound 127.0.0.1:<ephemeral> before and binds 0.0.0.0:<ephemeral> now. On a shared CI host that is a wider interface for the lifetime of the test. Ephemeral port, test-scoped, authenticated routes, and identical to what production does in container mode — so this is a note, not a risk finding. Worth knowing because the forwarding is load-bearing in the container file (M10) and merely stylistic in this one; if a reviewer ever "simplifies" the pair back to forced loopback, only the container file's copy would regress, and only against a ready.url-host mutation.

Accepted tradeoff, correctly described by the PR

Head no longer proves a real bind on 43190 itself — base asserted the kernel-accepted {address: '0.0.0.0', port: 43190}. What survives: the requested (43190, '0.0.0.0') (M1, M2 kill it), a real kernel bind on the requested host at an ephemeral port (bind witness), and real HTTP against it (the test still asserts 401 unauthenticated then 200 authenticated, and M6/M7 show the mock is a thin port override over a real bind, not a stub). The lost piece is exactly what made the tests flaky, and the PR's Risk & Scope section says so plainly.

Not covered

  • Full packages/cli unit suite (1234 test files). Ran the affected directory src/serve instead: 310 files passed / 310, 13602 tests passed, 0 failed, 59 pending (pre-existing skips), exit 0, and both changed files are among the 310 collected. 03-serve-gate-and-results-ledger.png.
  • Per-commit attribution. The snapshot lists 3 commits (6991d18b, 410f707f, 39d9dd57); the depth-2 checkout makes only the merge reachable, so git rev-list HEAD^1..HEAD^2 returns 1. Everything above verifies the aggregate HEAD^1..HEAD diff. Commit 2's effect is still isolated behaviourally, via M3/M4/M10/M11.
  • What this PR's own CI actually executed. No GitHub token in this job, so no check-run logs: whether the failing lane was reproduced, whether any -t filter matched zero tests, and whether the lane checked out the branch or the merge ref are all unverified here. The merge-ref question is settled locally — HEAD's parents are exactly the snapshot's baseRefOid and headRefOid, so every cell above ran on the trial merge; no separate merge arm was needed. Depth 2 does prevent listing what main added since the PR's own merge-base.
  • macOS and Windows. The PR marks both ⚠ïļ and this container is Linux only. Note the process.platform !== 'linux' branch in decodes boot v3 only through the container fileâ€Ķ is therefore not exercised here either.
  • The real 43190 bind in production container startup — unchanged by this PR and untested here, as the PR states.
  • packages/sdk-java, which also references 43190 (WorkspaceCsiRuntimeIdentity, KubernetesRuntimeProvisioner, the broker README). QWEN_VERIFY_JAVA is unset and the container has no JDK, so nothing Java was compiled or run.
  • "No other test binds a hard-coded port" is a static census, not an empirical one. Measured over repo source with node_modules excluded: 224 .listen(<numeric literal>) call sites, and every one passes 0 (ephemeral) except scripts/tests/managed-agent-dev.test.js:335, which binds a Vite stand-in on fixed 5174 — the one live sibling of this bug class the census found, outside packages/cli and not audited further here. The 43190 site is invisible to that grep because it is a ternary (containerMode ? 43190 : 0), which is why it was censused separately: 43190 appears in exactly one production file and two cli test files, and both test files now mock listen. The only other fixed-port listen in the repo is oauth-provider.ts's OAUTH_REDIRECT_PORT (7777), whose test asserts expect(mockHttpServer.listen).toHaveBeenCalledWith({port: 7777, â€Ķ}) against a mock; daemon-update-restart.test.ts's 48123 is a stubbed getPort() return value asserted in spawned argv, and that file's only real bind is server.listen(0, '127.0.0.1', â€Ķ). I did not run the full cli suite under a held 43190 to confirm any of this empirically, and the PR itself scopes the audit out.

Methodology

All work ran in the CI verify container (node:22-bookworm, /__w/qwen-code/qwen-code, no credentials) against the pre-built merge ref, with the base arm in a scratch worktree at tmp/base-tree (HEAD^1) whose node_modules and dist were hardlinked from head and whose internal @qwen-code/* links were realpath-asserted into the base tree; npm run generate gave it its own git-commit.ts. Four harnesses drove the code, all mock-free with respect to the unit under test — real vitest workers, real node:http servers, real kernel binds, real loopback fetch, and a real TCP port holder probed independently before every cell: ab-port-collision.mjs (6 cells, 16 assertions), mutation-matrix-v2.mjs (baseline + 11 mutants, 69 assertions), bind-host-witness.mjs (2 variants, 13 assertions), gates.mjs + gate-serve-assert.mjs (12 assertions). Gates: prettier --check and eslint clean on both changed files, each proven live by planting a violation in the reviewed file and watching it be reported (unusedGateProbe named by no-unused-vars; Code style issues found), then restoring; tsc --noEmit for packages/cli clean; src/serve suite green. Raw per-cell stdout/stderr, per-mutant logs, the vitest JSON reports, and the gate logs are in raw-logs/; harnesses are .mjs files in this directory and rerun as-is. Two harness defects found and fixed mid-round, both preserved on disk rather than overwritten: mutation run 1 deadlocked in teardown (holder.close() awaited before closeAllConnections(), Node exit 13, hygiene rows lost — mutation-run1-incomplete-teardown-bug.log) and reported one spurious FAIL because its control token exceeded vitest's â€Ķ truncation; gate-serve-assert-run1-ansi-bug.log matched ANSI-coloured bytes literally and called a 310/310 pass a failure. Run 2 of each is authoritative and every number above is generated from those files. The worktree was removed after the cells were captured and git status --porcelain is empty.

Flakiness gate log

rounds=5 files=2 skipped=0
file packages/cli/src/serve/managed-runtime-attestation-worker.test.ts: (cd packages/cli) npx --no-install vitest run ./src/serve/managed-runtime-attestation-worker.test.ts
file packages/cli/src/serve/managed-runtime-container.test.ts: (cd packages/cli) npx --no-install vitest run ./src/serve/managed-runtime-container.test.ts


per-file results (P=pass F=fail I=infra-exit, one letter per run):
  packages/cli/src/serve/managed-runtime-attestation-worker.test.ts: PPPPP
  packages/cli/src/serve/managed-runtime-container.test.ts: PPPPP

verdict: pass
summary: 2 changed test file(s) x 5 identical rounds, no divergence

--- per-invocation detail (full copy in the artifact) ---
round 1 · packages/cli/src/serve/managed-runtime-attestation-worker.test.ts: P (exit 0)
round 1 · packages/cli/src/serve/managed-runtime-container.test.ts: P (exit 0)
round 2 · packages/cli/src/serve/managed-runtime-attestation-worker.test.ts: P (exit 0)
round 2 · packages/cli/src/serve/managed-runtime-container.test.ts: P (exit 0)
round 3 · packages/cli/src/serve/managed-runtime-attestation-worker.test.ts: P (exit 0)
round 3 · packages/cli/src/serve/managed-runtime-container.test.ts: P (exit 0)
round 4 · packages/cli/src/serve/managed-runtime-attestation-worker.test.ts: P (exit 0)
round 4 · packages/cli/src/serve/managed-runtime-container.test.ts: P (exit 0)
round 5 · packages/cli/src/serve/managed-runtime-attestation-worker.test.ts: P (exit 0)
round 5 · packages/cli/src/serve/managed-runtime-container.test.ts: P (exit 0)

Evidence images

01-ab-port-collision-base-vs-head

02-mutation-matrix-kills-and-survivors

03-serve-gate-and-results-ledger

Harness scripts and raw logs are in the workflow run artifacts (7-day retention).

— Qwen Code · sandboxed verification

@qwen-code-review-bot qwen-code-review-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, looks ready to ship. ✅

wenshao added a commit to wenshao/qwen-code that referenced this pull request Oct 10, 2026
wenshao added a commit to wenshao/qwen-code that referenced this pull request Oct 10, 2026
wenshao added a commit to wenshao/qwen-code that referenced this pull request Oct 10, 2026
wenshao added a commit to wenshao/qwen-code that referenced this pull request Oct 10, 2026
@wenshao

wenshao commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

🔍 Local maintainer verification — verdict: merge-ready ✅

14,102 assertions checked (tally in Methodology), 0 unexpected failures.
Verified head: 39d9dd574a4101101fdb2f451ab0d18fdbf7a45b against merge-base c0c697c8a3d7d0460d37c497b76d52968c9216f7 (freshly fetched origin/main).
Environment: macOS 15.7.7 (arm64), Node.js v22.23.1.

ðŸ‡ĻðŸ‡ģ äļ­æ–‡æ‘˜č́

įŧ“čŪš:åŊäŧĨ合åđķ。

  • čŋ™æ˜Ŋäļ€äļŠįšŊæĩ‹čŊ• PR(äŧ… 2 äļŠæĩ‹čŊ•æ–‡äŧķ,+24/−8,æ— į”Ÿäš§äŧĢ᠁æ”đåŠĻ),äŋŪåĪ issue Main CI failed: Qwen Code CI — src/serve/managed-runtime-container.test.ts > â€Ķ > wires the gate in the actual boot3 startup while preservingâ€Ķ (+1 more) #13775 įš„ CI 抖åŠĻ:äļĪäļŠ container-mode æĩ‹čŊ•åœĻå…ąäšŦ CI äļŧ朚äļŠįœŸåŪžįŧ‘åŪšå›šåۚįŦŊåĢ 43190,é‚ŧåą…čŋ›įĻ‹å į”Ļæ—ķäŧĨ EADDRINUSE åĪąčīĨ。
  • A/B åŪžčŊ:åœĻ占į”Ļ 43190 įš„čŋ›įĻ‹å­˜æīŧæ—ķ,base į‰ˆæĩ‹čŊ•æ–‡äŧķåĪįŽ°äš†äļŽ CI run 37925143593 åیå…Ļäļ€č‡īįš„åĪąčīĨį­ū名(2 åĪąčīĨ / 11 通čŋ‡,listen EADDRINUSE: address already in use 0.0.0.0:43190,åĪąčīĨæĩ‹čŊ•名逐äļŠį›ļįŽĶ);同äļ€å į”Ļčŋ›įĻ‹äļ‹,PR į‰ˆ 13/13 å…ĻéƒĻ通čŋ‡ã€‚įŦŊåĢįĐšé—ēæ—ķäļĪåĨ—äŧķ 42/42 通čŋ‡ã€‚
  • å˜åž‚č§čŊ:å°†į”Ÿäš§äŧĢ᠁įŧ‘åۚįŦŊåĢ 43190→43199,opens the explicit container port with authenticated attestation åĶ‚æœŸåœĻ toHaveBeenCalledWith(43190, '0.0.0.0') 断čĻ€åĪ„åĪąčīĨ——čŊæ˜Žæ”đåŽįš„æĩ‹čŊ•äŧåœĻåۈåŦčŊ·æą‚įŦŊåĢ,቙é―ŋčŋ˜åœĻ。
  • é—Ļį́:构åŧš ✅、typecheck 0 错čŊŊ ✅、eslint åŊđäļĪäļŠæ”đåŠĻ文äŧķ ✅(先į”ĻæĪå…Ĩįš„ debugger; čŊæ˜Žäš† lint é—Ļį́存æīŧ)、src/serve/ å…Ļį›Ūå―•čŋžåļĶå›žå―’ 13,599 通čŋ‡ / 3 äļŠåĪąčīĨ——3 äļŠåĪąčīĨå‡ä―äšŽæœŽ PR 朊č§ĶįĒ°įš„æ–‡äŧķ(无äŧŧä―•å›šåۚįŦŊåĢåž•į”Ļ),å•į‹Žé‡č·‘ 443/443 å…Ļįŧŋ,į­ū名äļščķ…æ—ķ/äļīæ—ķį›Ūå―•įŦžæ€,äļŽæœŽ PR 无å…ģ。
  • éĒåĪ–äŧ·å€ž:ä―œč€…č‡Šæĩ‹įŸĐé˜ĩäļ­ macOS äļš âš ïļ æœŠæĩ‹,CI įš„ macOS æĩ‹čŊ•ä―œäļšåœĻ朎 PR äļŠčĒŦč·ģčŋ‡;æœŽæŽĄéŠŒčŊåœĻ macOS 15.7.7 (arm64) äļŠåŪŒæˆ,čĄĨäļŠäš†čŊĨåđģ台įĐšį™―ã€‚
  • 朊č͆ᛖ:Windows åđģ台;į”Ÿäš§įŽŊåǃᜟåŪž 43190 įŧ‘åۚ(朊æ”đåŠĻ,按čŪūčŪĄäļåœĻ朎 PR æĩ‹čŊ•čŒƒå›ī);å…ķäŧ–æĩ‹čŊ•åĨ—äŧķįš„å›šåۚįŦŊåĢä―ŋį”Ļ朊åŪĄčŪĄã€‚

What the PR changes

Two test files only, no production code (+24/−8): packages/cli/src/serve/managed-runtime-container.test.ts gains a mockEphemeralListen() helper that spies Server.prototype.listen, keeps the requested (43190, '0.0.0.0') arguments observable for assertions, but binds port 0 (kernel-assigned ephemeral) with the remaining arguments forwarded; the two container-mode tests use it instead of really binding 43190. packages/cli/src/serve/managed-runtime-attestation-worker.test.ts updates its pre-existing ephemeral-listen mock from a hard-coded [0, '127.0.0.1'] to [0, ...args.slice(1)], forwarding the requested host — the same faithful-mock pattern.

A/B proof (port 43190 held by a throwaway node process on 0.0.0.0)

Run Result Signature
Base test files (merge-base c0c697c8a3), port held ❌ 2 failed / 11 passed listen EADDRINUSE: address already in use 0.0.0.0:43190 — byte-identical to the CI failure in run 37925143593 (confirmed in that run's logs), failing tests exactly the two named in #13775
PR head, port held ✅ 13/13 passed flake mechanism removed
PR head, port free ✅ 13/13; pair with attestation-worker suite 42/42 no regression on the normal path

The A/B used one built worktree at the PR head with only the two test files swapped to their base versions in place; git status verified clean after each swap/restore.

Mutation witness (the modified test still has teeth)

Mutating the production bind in managed-runtime-attestation-worker.ts (containerMode ? 43190 : 0 → 43199) is killed by opens the explicit container port with authenticated attestation failing at expect(listen).toHaveBeenCalledWith(43190, '0.0.0.0') (line 330) — 1 mutant, 1 kill. The requested-port guard survives the move from "assert the real bind" to "spy the request".

Gates

Gate Result
npm run build (worktree) ✅ all packages
npm run typecheck ✅ 0 errors
eslint on the 2 changed files ✅ clean; gate liveness proven first (planted debugger; fired no-debugger)
Collateral sweep: all of packages/cli/src/serve/ (310 files) 13,599 passed / 3 failed in 3 files untouched by this PR — hosted-harness-session (409-vs-204), hosted-hook-session (15 s test timeout), orchestrator (ENOTEMPTY tmpdir race). None bind fixed ports; all 3 pass on an isolated re-run (443/443), i.e. load/parallelism flakes unrelated to this change

Code review notes

  • The helper mirrors the sibling attestation-worker suite's established pattern (the PR description's claim checks out in the diff).
  • Production container-mode bind (containerMode ? 43190 : 0, containerMode ? '0.0.0.0' : '127.0.0.1', managed-runtime-attestation-worker.ts:292-295) is unchanged — only the tests stop really binding the fixed port.
  • The new ready.url assertion derives the expected port from the actually bound address while production hard-codes the 127.0.0.1 host (managed-runtime-attestation-worker.ts:313); the attest round-trip in the test still exercises the real listener over the ephemeral port. The helper's comment correctly explains why only the port is overridden (forcing loopback would weaken the host dimension).
  • [0, ...args.slice(1)] faithfully forwards host/backlog/callback arguments in both suites.

Not covered

  • Windows (CI skipped Test (windows-latest, Node 22.x) on this PR; not run locally). macOS is covered by this report; the author's own matrix had macOS untested and CI skipped Test (macos-latest, Node 22.x) as well, so this run fills that gap.
  • The real production 43190 bind in container startup — unchanged and intentionally untested here.
  • Other suites' fixed-port usage — not audited (out of scope, as the PR states).

Methodology

Worktree at 39d9dd574a (installed with the shared pnpm store, built, workspace symlink verified to resolve inside the tree — no cross-tree leak). A/B by in-place swap of the two test files to their merge-base versions and back, with the port collision produced by node -e "require('node:net').createServer().listen(43190, '0.0.0.0', ...)" held throughout. CI signature cross-checked against run 37925143593 logs. Assertion tally: 14,097 unit-gate passes (42 focused + 13 head-under-contention + 13,599 collateral + 443 isolation re-run) + 4 harness assertions (2 predicted red signatures, 1 CI signature match, 1 lint-liveness plant) + 1 mutation kill = 14,102.

Evidence captures

A-side: base test files, port held — 2 failed with EADDRINUSE 0.0.0.0:43190 (CI signature), holder visible in lsof:
A-side base red

B-side: PR head, same port still held — 13/13 passed:
B-side head green

Mutation: production 43190 → 43199 killed by the spy assertion, then restored:
Mutation kill

Full terminal flow of all three arms:
Full flow


Local verification performed and posted by @wenshao's maintainer tooling; artifacts (logs, assertions.json, verdict.txt) retained locally under tmp/pr13778-verify-20261010-092223/.

@yiliang114 yiliang114 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at head 39d9dd5 after the branch picked up main. The only new in-PR commit is 410f707: the ephemeral-listen mock now overrides only the port and forwards the requested host, so the ready.url host assertion is no longer self-referential while the EADDRINUSE fix is preserved. No blocking findings.

@yiliang114
yiliang114 added this pull request to the merge queue Oct 10, 2026
Merged via the queue into main with commit ad91df5 Oct 10, 2026
61 checks passed
@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator Author

ðŸĪ– Reviewed the latest feedback — no changes needed. Why, point by point: · å·ēåŪĄé˜…æœ€æ–°åéĶˆâ€”â€”æ— éœ€æ”đåŠĻ。逐į‚đčŊŽåŽŸå› åĶ‚äļ‹ïžš

Autofix round: no action required

No actionable feedback arrived since the last evaluation (2026-10-09T21:33:47Z), so this round made no code changes.

What the feedback contained

  • Inline comments: none.
  • Reviews: none.
  • Issue-level comments: two, neither requesting changes:
    • An automated qwen-triage:verify status notice that sandboxed verification is running — informational only.
    • A local maintainer verification report by @wenshao with verdict merge-ready ✅ (14,102 assertions checked, 0 unexpected failures against head 39d9dd574a). It confirms the A/B reproduction of the original EADDRINUSE 0.0.0.0:43190 flake on the base test files, the fix under port contention, the mutation witness proving the requested-port assertion still has teeth, and green build/typecheck/lint gates. No changes were requested.
  • Failed checks: none. Still-red checks: none.
  • Base conflict: none flagged (--conflict false); the branch already merges cleanly with origin/main.

Disposition

With no Required findings, no Optional suggestions, no failed checks, and no conflict to resolve, there was nothing to implement, decline, defer, or escalate. The PR remains as verified: a test-only change (+24/−8 across packages/cli/src/serve/managed-runtime-container.test.ts and packages/cli/src/serve/managed-runtime-attestation-worker.test.ts) that stops the two container-mode tests from really binding fixed port 43190 while keeping the requested-bind assertions observable via a Server.prototype.listen spy.

Verification

No code changed this round, so no verification commands were run. Existing state relied upon:

  • Maintainer local verification on head 39d9dd574a (see the PR comment): build ✅, typecheck ✅ (0 errors), eslint on both changed files ✅, focused suites 13/13 under port contention and 42/42 uncontended, 1/1 mutation killed.
äļ­æ–‡čŊŽ

Autofix 朎č―Ū:无需å΄ᐆ

臩äļŠæŽĄčŊ„äž°(2026-10-09T21:33:47Z)äŧĨæĨæēĄæœ‰æ”ķ到åŊæ“ä―œįš„åé͈,因æ­Ī朎č―ŪæœŠåšäŧŧä―•äŧĢ᠁æ”đåŠĻ。

反éĶˆå†…åŪđ

  • čĄŒå†…čŊ„čŪš: 无。
  • Review: 无。
  • Issue įš§čŊ„čŪš: äļĪæĄ,均朊čĶæą‚äŋŪæ”đ:
    • äĄč‡ŠåŠĻåŒ–įš„ qwen-triage:verify įŠķ态通įŸĨ,čĄĻįĪšæē™įŪąéŠŒčŊæ­ĢåœĻčŋčĄŒâ€”—äŧ…äļšäŋĄæŊ性通įŸĨ。
    • @wenshao 发åļƒįš„æœŽåœ° maintainer 驌čŊæŠĨ告,įŧ“čŪšäļš merge-ready ✅(埚䚎 head 39d9dd574a å…ąæĢ€æŸĨ 14,102 æĄæ–­čĻ€,0 äļŠæ„åĪ–åĪąčīĨ)。æŠĨ告įĄŪčŪĪ乆:åœĻ base į‰ˆæĩ‹čŊ•æ–‡äŧķäļŠ A/B åĪįŽ°äš†åŽŸå§‹įš„ EADDRINUSE 0.0.0.0:43190 抖åŠĻ;įŦŊåĢčĒŦ占į”Ļæ—ķäŋŪåĪåŽæĩ‹čŊ•å…ĻéƒĻ通čŋ‡;å˜åž‚č§čŊčŊæ˜ŽčŊ·æą‚įŦŊåĢįš„æ–­čĻ€äŧį„ķæœ‰į‰™é―ŋ;构åŧš/typecheck/lint é—Ļį́å…Ļįŧŋ。朊提凚äŧŧä―•äŋŪæ”đčĶæą‚ã€‚
  • åĪąčīĨįš„æĢ€æŸĨ: 无。持įŧ­åĪąčīĨįš„æĢ€æŸĨ: 无。
  • äļŽ base įš„å†ēįŠ: 朊标čŪ°(--conflict false);分æ”Ŋå―“å‰åŊäļŽ origin/main åđē净合åđķ。

å΄ᐆįŧ“čŪš

æēĄæœ‰ Required å‘įŽ°ã€æēĄæœ‰ Optional åŧščŪŪ、æēĄæœ‰åĪąčīĨįš„æĢ€æŸĨ、äđŸæēĄæœ‰éœ€č́č§Ģå†ģįš„å†ēįŠ,因æ­Ī朎č―ŪæēĄæœ‰äŧŧä―•éœ€č́åŪžįŽ°ã€æ‹’įŧã€åŧķåŽæˆ–å‡įš§įš„äš‹éĄđ。PR įŧå·ē驌čŊįš„įŠķ态:äļ€äļŠįšŊæĩ‹čŊ•æ”đåŠĻ(č·Ļ packages/cli/src/serve/managed-runtime-container.test.ts äļŽ packages/cli/src/serve/managed-runtime-attestation-worker.test.ts å…ą +24/−8),通čŋ‡ Server.prototype.listen é—ī谍čŪĐäļĪäļŠ container-mode æĩ‹čŊ•äļå†įœŸåŪžįŧ‘åŪšå›šåۚįŦŊåĢ 43190,同æ—ķäŋæŒåŊđčŊ·æą‚įŧ‘åŪšå‚æ•°įš„æ–­čĻ€åŊ观æĩ‹ã€‚

驌čŊ

朎č―ŪæēĄæœ‰äŧĢ᠁æ”đåŠĻ,因æ­Ī朊čŋčĄŒäŧŧä―•éŠŒčŊå‘―äŧĪ。所äūæŪįš„įŽ°æœ‰įŠķ态:

  • 埚䚎 head 39d9dd574a įš„ maintainer 朎地銌čŊ(见 PR čŊ„čŪš):构åŧš ✅、typecheck ✅(0 错čŊŊ)、åŊđäļĪäļŠæ”đåŠĻ文äŧķįš„ eslint ✅、įŦŊåĢ占į”Ļäļ‹čšį„ĶåĨ—äŧķ 13/13 通čŋ‡ã€æ— å į”Ļæ—ķ 42/42 通čŋ‡ã€1/1 变垂čĒŦ杀æ­ŧ。

Base-conflict check · 埚分æ”Ŋå†ēįŠæĢ€æŸĨ: no conflict with main. · äļŽ main 无å†ēįŠã€‚


🧠 Handled by Qwen Code · model/æĻĄåž‹ kimi-k3 · CLI 0.25.0

yiliang114 added a commit to zonemeen/qwen-code that referenced this pull request Oct 10, 2026
Resolve the managed-runtime-container.test.ts overlap with QwenLM#13778
(merged): both PRs add an ephemeral-listen mock for the same port
conflict. Keep main's mockEphemeralListen (host-forwarding shape) and
drop this PR's duplicate listenOnEphemeralPort; the remaining delta is
the boot3 test now also asserting the requested (43190, '0.0.0.0')
bind arguments.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Released in v0.25.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review/self-reported The linked issue was opened by the PR author (self-reported)

Projects

None yet

4 participants