Repository navigation
fix(managed-agent): refuse every URL fetch refuses and say why a health probe failed - #16110
Conversation
…th probe failed start and verify refused a listener URL only when URL.canParse rejected it, so a --server-url without a scheme (proxy.test:8443), with a user name or password, or on a port the Fetch standard blocks (6000, 10080) passed the check and then failed every probe until --timeout. They now refuse each of those before anything runs, and a test checks that the runtime's fetch rejects every URL the check refuses. A probe that is sent and still fails now says what it got: start's timeout names the last probe's answer and verify's health row names its own, such as "HTTP 503, status DOWN", "self-signed certificate" or ECONNREFUSED, where both said only "not UP". The listeners() comment names the reachesHarness option verify passes.
|
|
|
Thanks for the PR — this closes a gap that the verify-pr round on #16051 explicitly measured and deliberately left open, which is the right way to do a follow-up. Template looks good ✓ — all sections present, both languages, Problem: observed and measured, not theoretical. The round-2 report on #16051 recorded Direction: aligned. This is diagnosability for a deployment command that merged twenty minutes before this PR was opened, it adds no dependency and touches no public contract, and it moves a failure from "silent until timeout" to "refused before any unit starts". No CHANGELOG reference — this is an internal distribution script, not a shipped CLI surface — but the area is plainly relevant. Size: core-module protection does not apply. Nothing here matches a core path: Approach: the scope feels right, and the two halves are load-bearing for each other rather than two unrelated fixes. Hardcoding the blocked-port list is the part I'd normally push back on, and it's the part that's handled best: the agreement test walks every port in 1–65535 and asserts the real runtime I checked the blast radius rather than taking the title's word for it. The command has exactly two Risk: no elevated risk signals — none of the six files match the revert-correlated paths. The one residual risk is the port list going stale against a future Node, and the PR names it accurately rather than hiding it: such a port falls back to the new probe answer ( Moving on to code review. 🔍 中文说明感谢贡献!这个 PR 补上了 #16051 的 verify-pr 第 2 轮实测出来、并有意留到后续的缺口——这是 follow-up 该有的做法。 模板完整 ✓ ——各节齐全、中英文都有, 问题: 已观测并实测,不是理论性加固。#16051 的第 2 轮报告记录了 方向: 对齐。这是一个在本 PR 提交前 20 分钟才合入的部署命令的可诊断性改进,不引入依赖、不改公共契约,并把失败从"静默直到超时"变成"在启动任何 unit 之前拒绝"。CHANGELOG 没有相关记录——这是内部分发脚本,不是对外的 CLI 表面——但该领域显然相关。 规模: 核心模块保护不适用。这里没有命中任何核心路径: 方案: 范围合理,而且两半互相支撑,不是两个无关的修改拼在一起。硬编码屏蔽端口列表本来是最该被质疑的部分,结果恰恰是处理得最好的部分:一致性测试遍历 1–65535 的每个端口,断言真实运行时的 影响面我是查过的,没有只信标题。整个命令只有两处 风险: 无升级风险信号——六个文件都没有命中与 revert 相关的路径。唯一的残留风险是端口列表相对未来 Node 版本过时,而 PR 对此描述准确、没有回避:那样的端口会退回到超时时报出探测应答( 进入代码审查 🔍 — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
Code reviewNo critical blockers, and no AGENTS.md violations. I read the diff against the reviewed commit rather than against the description, and the central claim holds up: the command has exactly two What I verified rather than assumed:
Two non-blocking observations, neither worth holding the PR for:
Test evidenceThis is an unattended CI run, so per the gate rules I did not build, run, or execute anything from this PR's tree — no No check has failed. 13 succeeded, 23 skipped, 6 still in flight. The two most relevant gates for a distribution-script change are already green — Not verified, and why:
Sandboxed verification would settle this: Final CI results for
One row per check name (latest run); skipped checks omitted; failures sort first. / 每个检查名一行(取最新一次运行),省略 skipped,失败项排在最前。 中文说明代码审查没有阻塞性问题,也没有违反 AGENTS.md 的地方。我是按被审查的那个 commit 读 diff 的,不是照着描述读,而 PR 的核心主张站得住:整个命令只有两处 以下是我实际查证、而非默认接受的部分:
两条非阻塞观察,都不值得为此卡住 PR:
测试证据这是无人值守的 CI 运行,因此按门禁规则,我没有构建、运行或执行本 PR 树里的任何东西——没有 没有任何检查失败。 13 项通过、23 项跳过、6 项仍在进行。对一个改动分发脚本的 PR 来说,最相关的两道门已经是绿的—— 未验证的部分及原因:
沙箱验证可以补上这一块: — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
|
Confidence: 4/5 — the code is clean and I could not find a way to break it; the missing point is evidence, not implementation: the CI job that runs this PR's own suite had not finished, and the six probe wordings are pinned against synthetic error objects rather than real failures. Stepping back: this is what a good follow-up looks like. A verification round on #16051 measured a gap, wrote it down, said "not applied", and this PR closes exactly that gap twenty minutes after the merge — no scope drift, no drive-by refactor, nothing opportunistic riding along. The diff is 100 production lines in one script, 8 lines of docs, and 180 lines of test, and every one of them is in service of the stated goal. The part I would normally push back on is the hardcoded 82-port list — a copied constant that silently rots when the platform moves. It's the best-defended thing in the PR. The agreement test walks every port from 1 to 65535 and asserts the real runtime On the claim I cared most about: I did not take the title's word for it. There are exactly two Nothing here is a reason to hold the PR. Both of my observations are non-blocking: one is a cosmetic tail (a Two honest caveats on what I could and could not confirm, since they're the difference between 4 and 5. I ran nothing from this tree — the gate forbids executing PR-derived code on an unattended run, so the evidence is the PR's own CI plus static reading. At fetch time Verdict is approve. CI is still running on this commit, so I'm not posting an approval in this run — approving now would attest to a suite result that does not exist yet. Approval is deferred until CI lands green on 中文说明Confidence: 4/5 —— 代码是干净的,我没能找到把它弄坏的办法;差的那一分在于证据而不在实现:跑本 PR 自己那套测试的 CI 任务当时还没结束,而六种探测措辞是拿合成的错误对象固定的,不是拿真实失败固定的。 退一步看整体:这是一个 follow-up 该有的样子。#16051 上的一轮验证实测出一个缺口,把它写了下来、注明"未修",然后本 PR 在合入后二十分钟精确地补上这一个缺口——没有范围漂移、没有顺手重构、没有夹带任何机会主义的改动。diff 是单个脚本里 100 行生产代码、8 行文档、180 行测试,每一行都在为既定目标服务。 我通常会质疑的部分是那份硬编码的 82 个端口列表——一份抄来的常量,平台一变就会悄悄过时。结果它恰恰是全 PR 里防守最严密的部分。一致性测试遍历 1 到 65535 的每个端口,断言真实运行时的 关于我最在意的那条主张:我没有只信标题。整个命令只有两处 这里没有任何一条足以卡住这个 PR。我的两条观察都是非阻塞的:一条是外观上的尾巴( 关于我能确认和不能确认的部分,有两条需要如实说明,因为这就是 4 分和 5 分之间的差别。我没有运行这个代码树里的任何东西——门禁规则禁止在无人值守运行中执行 PR 衍生的代码,所以证据来自 PR 自己的 CI 加静态阅读。取数时 结论是通过。CI 在这个 commit 上仍在运行,所以本次不提交批准——现在批准等于为一个尚不存在的套件结果背书。批准将推迟到 CI 在 — Qwen Code · qwen3.8-max-2026-09-02 Reviewed at |
… upgrade start start checked the Harness URL with new URL() alone, so an opaque value such as proxy.test:8443 parsed with no host and no port: start then waited out --timeout for the Harness to listen on port 80 of an empty host. It now refuses any Harness URL that is not http or https before it starts a unit, as the preflight would fail it later anyway. The probe-answer test also runs the runtime's own fetch against a port nothing listens on, so the ECONNREFUSED wording comes from a real error rather than a constructed one.
|
Thanks for the review. Pushed
Two more mutants killed (19/19 in total); the suite passes 60/60. 🤖 Generated with Claude Code — Claude Opus 5.5 |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the listener-validation and health-probe diagnostic changes.
No open issues 🎉
What changed in this PR
This follow-up to #16051 strengthens the Managed Agent upgrade command’s listener validation and makes failed health probes easier to diagnose. The separate preflight configuration gap in #16057 remains out of scope.
Changes:
- Reject malformed URLs, unsupported schemes, embedded credentials, and Fetch-blocked ports before starting units; also reject non-HTTP(S) Harness URLs.
- Include HTTP status or underlying connection errors in
starttimeout messages andverifyhealth results, with regression coverage. - Update English and Chinese documentation with refusal behavior and certificate-trust guidance.
| File | Description |
|---|---|
scripts/tests/managed-agent-upgrade.test.mjs |
Covers URL refusals and detailed health-probe failures. |
packages/managed-agent-server/distribution/bin/qwen-managed-agent-upgrade.mjs |
Adds URL validation and actionable probe diagnostics. |
docs/users/managed-agent-reference-deployment.zh-CN.md |
Updates Chinese deployment and certificate-trust guidance. |
docs/users/managed-agent-reference-deployment.md |
Updates English deployment and certificate-trust guidance. |
docs/design/2026-10-25-managed-agent-upgrade-command.zh-CN.md |
Documents validation and diagnostic behavior in Chinese. |
docs/design/2026-10-25-managed-agent-upgrade-command.md |
Documents validation and diagnostic behavior in English. |
Review effort: Balanced
|
评审提交: 结论:未发现需要修改的新增缺陷(C=0)。 已检查全部 6 个变更文件及相关调用方:URL 校验同时覆盖配置解析结果和 上一轮意见已对照当前提交复核:不带 HTTP(S) scheme 的 Harness URL 现在会在启动 unit 前拒绝;真实 验证证据:
验证边界:本地没有执行真实 Linux/systemd 升级;上述网络补测使用模拟 systemd 环境。这份评论不把该路径视为已经完成真实部署验收。 — Codex review |
|
PR 16110 round 1 verification — Verdict: findings — 47/49 scripted assertions passed, 2 failed. Verified head: 中文摘要
Central claim and A/BThe claim: before this PR, The A/B uses the repository's own upgrade rig (a fake
Every start base cell started both units before discovering the probes could not be sent; every head cell refused with zero units started. Carried forward from #16051This PR exists because of the round-2 report on #16051. That finding, re-measured at this head:
The blocked-port list is the runtime's listThe PR copies 82 ports from the Fetch standard. The suite's agreement test proves that every URL Mutation matrix21 single-point mutants of the head production file, each run against the unmodified 60-test head suite. A mutant is killed when the suite exits non-zero. Baseline first: 60/60, exit 0. The author's 17-in-the-body / 19-in-the-comment matrix is consistent; this round adds both halves of the credentials check, a positive control, and the zone-regex narrowing. 20/21 killed. The survivor is finding 2. The matrix is in FindingsFinding 1 — Medium:
|
… start's last probe short start's last health probe gets the 1 ms the deadline leaves it, so against a real endpoint it times out before any answer arrives, and the timeout message reported that abort instead of what the endpoint had been answering, such as HTTP 503, status DOWN. A probe that times out on a budget the deadline cut below the per-probe cap no longer replaces an earlier answer; one that runs out of its own 5 seconds still does, since the endpoint stopped answering. The test rig's fake fetch now awaits a response function, so a test can model an endpoint that answers late and honours the abort signal. Also pins the IPv6-zone diagnosis to a percent inside the brackets.
|
Round-1 verification: both findings are fixed in
Mutants. Seven more, all killed: the guard removed, the cap clause dropped, the cap boundary as Tests. The suite passes 61/61 on Node 22.22.2 (x86_64) and Node 24.14.0 (aarch64). The design doc now says that The Codex pass at 🤖 Generated with Claude Code — Claude Opus 5.5 |
There was a problem hiding this comment.
🔵 Needs a closer look
A stalled response body can time out without setting timedOut, causing phaseStart to overwrite an earlier health answer with an abort message; timeout-state handling and a regression test are needed.
No open issues 🎉
Review effort: Balanced
|
PR 16110 round 2 verification — Verdict: findings — 47/50 scripted assertions passed, 3 failed. Verified head: 中文摘要
Previous findings at this head
The round-1 suggested patch ( Central claim and A/BThe claim is unchanged from round 1: The A/B uses the repository's own upgrade rig (a fake
The full 18-row capture, including every The blocked-port list was re-enumerated at this head through the real Mutation matrix12 single-point mutants of the head production file, each run against the unmodified 61-test head suite. Baseline first (61/61, exit 0), then one expression per row. 11/12 killed; the survivor is finding 2. The matrix as it printed, with the failing test named for every kill, is FindingsFinding 1 — Medium: a response body that stalls after its headers overwrites the earlier answerReproduce with the live-socket cell (an endpoint that answers 503 DOWN to the first probe, then sends cd tmp/pr16110-verify-20261102-203752
ARM=head node --test --test-name-pattern 'live body that stalls' arm-head/scripts/tests/ab.mjsThe command exits 1 with The endpoint had answered Cause: Blast radius: The review at Suggested fix (measured): mark the body-read timeout too } catch (error) {
// A proxy's error page is no JSON, and its status says enough.
return {
up: false,
answer: response.ok ? `${status}, ${error.message}` : status,
+ // A body the signal ended, as it ends a stalled one, is no answer.
+ timedOut: error.name === 'TimeoutError',
};
}Applied in a scratch copy and driven through the same instruments: head unit suite 61/61, A/B 76/76, and both stalled-body cells now print Finding 2 — Suggestion: the
|
| Cell | Budget | Result |
|---|---|---|
start --timeout 6, endpoint answers once then hangs |
≈4999ms | keeps HTTP 503, status DOWN |
start --timeout 7, same endpoint |
≈5999ms | names The operation was aborted due to timeout |
The code's rule (budget < PROBE_TIMEOUT_MS ⇒ deadline-cut) is defensible, but the design doc says "one that runs out of its own 5 seconds does", which a reader will not see at --timeout 6. Either say "a probe whose own timeout fires before the deadline", or pin the documented case at --timeout 7. Non-blocking.
Not covered
- Real systemd hosts, macOS and Windows: the rig's
systemctlis a simulated layer; units, files, sockets, clocks and TLS are real. - A full 65,536-port enumeration on Node 22: this round ran on Node 24.22.1; the CI Node 22 suite carries the suite's own agreement test, and the PR's blocked list is unchanged from round 1.
- The
--checkconfiguration gap tracked in Managed Agent --check ignores the configuration files the server reads from its working directory #16057, which the PR explicitly leaves out of scope. - CI lanes still pending at the time of writing:
Test (ubuntu-latest, Node 22.x),web-shell E2E Smoke,SDK Java (fast) / ubuntu-latest / Java 21.Lint & Static,Integration Tests (no-AK),Build and verify reference distribution,TUI parity snapshotsandReal daemon E2E / Java 11had passed. - How often the stalled-body shape occurs in production: the live cell shows it is reachable, but no telemetry on its frequency is available here.
Methodology
Each arm is a directory with the revision's production file and the same appended instruments; the production file is the only difference between the arms. The head and base suites were run with node --test on this host; the mutation runner rewrites one production expression at a time in a separate mut/ tree, checks each anchor matches exactly once, runs the unmutated baseline first, and records the failing test names. Raw logs and harness scripts are in tmp/pr16110-verify-20261102-203752/ (logs/, harness/, mutations.json).
— DeepSeek-V4.1-Flash-1017@fda99a87 via Qwen Code /verify-pr (v0.26.5; skill e02c61466216)
…short probe too A health endpoint that sends its headers and then stalls the body made response.json() reject with the signal's TimeoutError. That branch did not report timedOut, so start's guard took the probe for an answer, and a probe the deadline cut short replaced an earlier HTTP 503, status DOWN with "HTTP 200, The operation was aborted due to timeout". The body-read branch now reports timedOut as well. The last-answer test gains two real-socket cases: a body that stalls after its headers keeps the earlier answer, and a refused connection after an answer replaces it, which pins the timedOut half of the guard. The design doc says when the 5-second limit counts as the probe's own, and that any other failure replaces an earlier answer.
|
Round-2 verification: all three findings are handled in
Mutants. Three more, all killed: the body-read branch without Tests. The suite passes 61/61 on Node 22.22.2 (x86_64) and Node 24.14.0 (aarch64). 🤖 Generated with Claude Code — Claude Opus 5.5 |
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
Reviewed — no blockers. Suggestions are inline.
中文说明
已审查——无阻断问题。 建议见行内评论。
— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.5)
Address review R1-1..R1-5 on the upgrade URL/health change: - R1-1: neutralize terminal control bytes (C0/DEL/C1 -> U+FFFD) in the endpoint-derived health answer before it is interpolated into start's timeout refusal and verify's health row, so a queryable endpoint cannot move the cursor, split a row, or write the clipboard (OSC-52). - R1-2: the Harness URL refusal reuses fetchRefusal when the value does not parse, naming an IPv6 zone exactly as --server-url does. - R1-3: start's timeout labels the retained value 'the last answer', matching the design doc, since a deadline-cut probe keeps an earlier answer. - R1-4: pin verify's URL refusal (listeners runs it with reachesHarness:false) with a test asserting it refuses before any probe. - R1-5: tear down the 'closes' test server via t.after so a failing assertion cannot hang node --test to the job ceiling. Tests: 63 pass; R1-1/R1-2/R1-4 mutation-witnessed (printable no-op, refusal gated on reachesHarness, zone reason reverted each redden their pin). Prettier and ESLint clean. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
|
Qwen Code review never started. The job ended before a runner picked it up, so no review ran for this head. This can happen when a queued run is cancelled or expires; this step cannot determine the cause. See workflow logs. Check the latest |
Add a real-scenario pin for R1-1: a local HTTP server serves a status field carrying cursor moves, a newline and an OSC-52 clipboard write, and verify runs against it through the runtime's own fetch — the real health() -> printable() -> row() -> out() path, not the rig's fake. Asserts the printed health row keeps no control byte while the readable text survives. 64 tests pass. Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
…'s API reads failed Found on a real systemd deployment (real control plane, Harness, MySQL, TLS and nginx): - A refused --server-url was printed as typed, so a URL with a password, which fetch refuses, put that password in the output. The refusal now prints it as ***. - verify's session and turn rows still said only "fetch failed" where the health row above them named the cause, such as "self-signed certificate in certificate chain". API reads now take the same cause. - Text the API hands back (an error reason, a body that fails to parse, a Session ID, an event type) reached the session and turn rows with its control bytes; it is now neutralized as the health answer is. The design doc says the probe answer's control characters show as U+FFFD.
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
Deferred under the convergence posture (round 4, not a blocker) — recorded, not requested in this round:
packages/managed-agent-server/distribution/bin/qwen-managed-agent-upgrade.mjs:2865 — [review] the ApiError label is unsanitized, so the session and turn FAIL rows carry the endpoint's Session id unbounded
Convergence: round 4 posted 4 inline comment(s), 2 of them reported for the first time; the previous round posted 6 (2 new). Findings keep coming back to the same files: packages/managed-agent-server/distribution/bin/qwen-managed-agent-upgrade.mjs (findings in rounds 1, 2, 3; 2 more now). The rate of new findings is not falling. A cluster that keeps producing siblings usually means the fixes are treating instances of a shared root cause — triaging that cause before the next round, or splitting an independent cluster into its own pull request, tends to end the loop faster than fixing them one at a time. Batching the remaining fixes and verifying them before the next push, or dropping this PR's reviews to --severity-floor critical, keeps the loop from re-deriving the same set. (Observation only — nothing was withheld from this review because of this observation.)
中文说明
收敛姿态下延后(第 4 轮,非阻断)——已记录,本轮不要求修改:共 1 条(原文未翻译,列表见上方英文部分)。
收敛情况:第 4 轮发布了 4 条行内评论,其中 2 条是首次提出;上一轮发布了 6 条(其中 2 条首次提出)。发现反复回到同一批文件:packages/managed-agent-server/distribution/bin/qwen-managed-agent-upgrade.mjs(第 1、2、3 轮已出过发现,本轮又有 2 条)。新发现的产出速度没有下降。一个不断再生兄弟发现的簇,通常意味着逐条修复只在处理同一根因的实例——先定位并处理该根因,或把独立的簇拆成单独的 PR,通常比逐条修复更快结束循环。把剩余修复攒成一批、验证后再推送,或将本 PR 的评审降到 --severity-floor critical,可以避免循环反复推导同一组发现。(仅为观察——本轮评审未因此扣留任何内容。)
— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.6)
…heck the API URL only when verify reads it - verify decides whether its session row reads the API before it checks the listeners, so a signed deployment, or --actor without a trusted actor header, is no longer refused over an API URL it never dials. - The configuration resolver now prints the preflight's own verdict on the Harness URL, read untrimmed as java.net.URI reads it, and start refuses on it before restarting the Harness: a host with an underscore, an empty user name or a padded value no longer restart the Harness only to fail the preflight. - withoutCredentials masks everything up to the last @ of a value the parser rejects, so a password holding / ? or # stays hidden. - printable counts code points in one pass and keeps only the head, so a huge endpoint answer costs no copy of itself. - The request an API error names is bounded like the rest of the row.
…rses it A padded qwen.managed-agent.harness.base-url fails the preflight, and the start refusal now shows the padding instead of a value that looks valid.
|
About the item round 4 deferred ( I reproduced it on the rig with an endpoint that lists such an ID and returns 404 for its read. Round 6 is in the PR body, along with the real-rig table: alpha.101 was packaged from 🤖 Generated with Claude Code — Claude Opus 5.5 |
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
Not explored to full depth (tool budget reached): "agent reverse-audit (round 1)": chunk 1's users zh-CN twin ( docs/users/managed-agent-reference-deployment.zh-CN.md:231 ) was read only as the translated copy of the same claim while locating ….
Deferred under the convergence posture (round 5, not a blocker) — recorded, not requested in this round:
scripts/tests/managed-agent-upgrade.test.mjs:2572 — [review] the password-leak assertion runs after the loop, so it only inspects the last iteration's password-free outputpackages/managed-agent-server/distribution/bin/qwen-managed-agent-upgrade.mjs:3011 — [review] the added printable(terminal.type) cannot see a non-string: the classification regex coerces the value first and throws
Convergence: round 5 posted 1 inline comment(s), 1 of them reported for the first time; the previous round posted 4 (2 new). Findings keep coming back to the same files: packages/managed-agent-server/distribution/bin/qwen-managed-agent-upgrade.mjs (findings in rounds 2, 3, 4; 1 more now). A cluster that keeps producing siblings usually means the fixes are treating instances of a shared root cause — triaging that cause before the next round, or splitting an independent cluster into its own pull request, tends to end the loop faster than fixing them one at a time. (Observation only — nothing was withheld from this review because of this observation.)
中文说明
未探索到全部深度(达到工具调用预算):"agent reverse-audit (round 1)":chunk 1's users zh-CN twin ( docs/users/managed-agent-reference-deployment.zh-CN.md:231 ) was read only as the translated copy of the same claim while locating …。
收敛姿态下延后(第 5 轮,非阻断)——已记录,本轮不要求修改:共 2 条(原文未翻译,列表见上方英文部分)。
收敛情况:第 5 轮发布了 1 条行内评论,其中 1 条是首次提出;上一轮发布了 4 条(其中 2 条首次提出)。发现反复回到同一批文件:packages/managed-agent-server/distribution/bin/qwen-managed-agent-upgrade.mjs(第 2、3、4 轮已出过发现,本轮又有 1 条)。一个不断再生兄弟发现的簇,通常意味着逐条修复只在处理同一根因的实例——先定位并处理该根因,或把独立的簇拆成单独的 PR,通常比逐条修复更快结束循环。(仅为观察——本轮评审未因此扣留任何内容。)
— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.7)
The resolver passed on the preflight's verdict on the Harness base URL
with no regard to the Harness's state, so start refused a value that a
disabled or pooled Harness leaves unread: the preflight skips its
harness row before reading it, and the server never dials it. The
verdict is now "skip" there. start refuses on the preflight's grounds
(user information, a query, a fragment, or anything java.net.URI reads
differently) only on a "false" verdict, and its own reasons only word
that verdict. It still refuses a URL that is not http or https, since it
waits for the Harness there. Without a verdict, as when the
configuration does not resolve, the preflight judges the URL once the
Harness is up.
verify now checks the type of the values the API chose before using
them. Building a route from a Session id, matching an event type, or
reading an event sequence coerced the value first, and that throws on
an object such as {"toString":1} or on an array nested deeper than the
stack, so printable() never got to show what came back. A Session
without a string id fails its row with that value, an event type that
is not a string fails the turn row, and a sequence counts only as a
number or a numeric string.
The start tests now check every run's output for the password, not
only the last run's.
…rom the API The previous commit gave "skip" for a pooled Harness as well as a disabled one, since the preflight skips its harness row in both before reading the base URL. A pooled server still reads that URL, though: each member's QwenHostedHarnessConnector is built from it and refuses it by the same rule as the preflight. The pool's refresh drops a member whose connector refuses it, so such a pool accepts no Session while the server reports UP. Only a disabled Harness gets "skip" now. A test pins the verdict to whether the connector builds, for a single Harness and for a pool. Since the verdict is now the server's rather than only the preflight's, the refusal says "the server does not take". verify reads Sessions, items and events only as lists. Data that is not a list fails its row and says what came back: iterating it would throw, or walk a string, and its length could be any value. A listed entry of 0, "", false or null fails the session row instead of being reported as no Session. An event sequence moves the cursor only as a whole number, and only forward: Number() reads "Infinity", "0x10" or " 4 " as numbers. The user guide now says that, when the configuration does not resolve, the preflight judges the Harness URL after the Harness starts.
When the configuration does not resolve there is no verdict. The previous commits then let start accept any http(s) Harness URL and left the URL to the preflight. A pooled preflight never reads it, though, and every pool member's connector refuses user information, a query or a fragment, so the pool would start and accept no Session. Without a verdict, start refuses those itself again, since the server refuses them wherever it reads the value. A "true" or "skip" verdict still asks nothing more, and the generic wording is kept for a "false" verdict. HarnessConfigurationTest now builds a pool through the real member factory and shows that the single base URL decides whether a member is accepted. The pooled half of the agreement test checked nothing the single half did not, so it is gone. verify now requires every page to carry its data as a list: a body that is no object, or one whose data is null or missing, fails the row instead of reading as no Session. A Session id of "", "." or ".." fails, since fetch resolves dot segments and an empty id reads the list. Only terminal: true ends a turn. The docs no longer say the server takes only an origin, since a path is fine. They say which component refuses the URL, and they word the sequence rule as the code applies it.
|
About the two items round 5 deferred: both are fixed in this round, together with what they turned out to share.
On the rig, with a fake API behind
The happy path, 🤖 Generated with Claude Code — Claude Opus 5.5 |
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
Partially reviewed — gaps disclosed.
Not reviewed: build-and-test — SDK Java (fast) / Runtime Broker and Managed Agent MySQL / Java 21 was skipped in CI, and only the two changed Java test classes ran locally.
Deferred under the convergence posture (round 6, not a blocker) — recorded, not requested in this round:
packages/managed-agent-server/distribution/bin/qwen-managed-agent-upgrade.mjs:2931 — [review] sessionRoute prints (undefined) for an object entry that carries no idpackages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/preflight/ManagedAgentPreflight.java:1752 — [review] harnessUrlVerdict does not model the preflight's plaintext-transport rulescripts/tests/managed-agent-upgrade.test.mjs:2628 — [review] the --server-url refusal battery omits a query or fragment, which swallows the health pathscripts/tests/managed-agent-upgrade.test.mjs:2878 — [review] no test pins printable() on the health row's JSON-parse-error path
中文说明
仅完成部分审查,审查缺口已披露。
未审查(原文为英文):build-and-test — SDK Java (fast) / Runtime Broker and Managed Agent MySQL / Java 21 was skipped in CI, and only the two changed Java test classes ran locally.
收敛姿态下延后(第 6 轮,非阻断)——已记录,本轮不要求修改:共 4 条(原文未翻译,列表见上方英文部分)。
— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.7)
yiliang114
left a comment
There was a problem hiding this comment.
One Critical finding (static import ordering, carried forward from the bot's round 6 at 8529a68 — the head moved only by a merge of main, so the PR's own files are unchanged).
[Critical] R6-1 — packages/managed-agent-server/verification/src/test/java/com/alibaba/qwen/code/managedagent/preflight/ResolvedConfigurationTest.java: the added static assertThrows import breaks the module's sorted static-import block. The verification module runs maven-checkstyle-plugin with includeTestSourceDirectory=true and qwen-code-checks.xml's ImportOrder (sortStaticImportsAlphabetically=true, option=bottom). The current order (assertEquals, mock, assertThrows, assertTrue) fails checkstyle:check.
Fix: reorder to assertEquals, assertThrows, assertTrue, then mock:
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;Verification: cd packages/managed-agent-server && mvn -o -B -pl server,verification checkstyle:check must be green.
The bot's CHANGES_REQUESTED at 8529a681e is stale (head has since advanced to 814b121). All other findings from the 7 review rounds appear addressed in the PR body's own evidence; the 72/72 mutant kills, real-rig scenarios, and API type-safety guards are solid. This one Checkstyle gate is the sole remaining blocker.
中文说明
一条 Critical 发现(静态 import 排序,从 bot 第 6 轮 at 8529a68 继承——head 仅因 merge main 前进,PR 自身文件未变)。
R6-1(Critical):ResolvedConfigurationTest.java 新增的 assertThrows 静态导入打乱了按字母排序的 static import 块,导致 Checkstyle 关失败。修复:重排为 assertEquals、assertThrows、assertTrue,再放 mock。验收:cd packages/managed-agent-server && mvn -o -B -pl server,verification checkstyle:check 必须变绿。
bot 在 8529a681e 的 CHANGES_REQUESTED 已过期(head 已推进至 814b121),7 轮审查中其余发现均已闭环;72/72 变异体全杀、真机场景与 API 类型安全守卫都很扎实。仅此一个 Checkstyle 关是剩余阻塞项。
qqqys
left a comment
There was a problem hiding this comment.
Reviewed at head 814b121014fc2ed2cb6a3109d918f0614284ade3 (base main). Commenting: one Critical is confirmed still present at this head. I verified it end to end in source, checkstyle config, the pom hierarchy and the CI invocation rather than taking it from the threads, and the fix is a four-line reorder.
Confirmed standing: static-import order fails the Checkstyle gate
packages/managed-agent-server/verification/src/test/java/.../preflight/ResolvedConfigurationTest.java at this head:
28: import static org.junit.jupiter.api.Assertions.assertEquals;
29: import static org.mockito.Mockito.mock;
30: import static org.junit.jupiter.api.Assertions.assertThrows;
31: import static org.junit.jupiter.api.Assertions.assertTrue;Alphabetically org.junit.jupiter.api.Assertions.assertThrows sorts before org.mockito.Mockito.mock, so line 30 is out of order. Each link in the chain that makes this a gate failure, checked at this head:
- The rule exists and sorts.
packages/sdk-java/qwencode/qwen-code-checks.xml:99-104—ImportOrderwithoption=bottomandsortStaticImportsAlphabetically=true. - Test sources are linted.
packages/managed-agent-server/pom.xml:180-184setsincludeTestSourceDirectory=truewithconfigLocationpointing at that file, and excludes onlycom/alibaba/qwen/code/runtimebroker/**— sopreflight/is in scope.verification/pom.xml:168declares the plugin and inherits this configuration. - The
includeTestSourceDirectory=falseoverride does not apply here. It sits inside the execution withid=runtime-broker-checkstyle(pom.xml:191-201), which usescombine.self="override"with a different config file andincludesscoped toruntimebroker/**/*.java. That execution never sees this test file. I checked this specifically because it is the one thing that could have made the finding wrong. - CI runs the goal that uses the default configuration.
sdk-java.ymlinvokesmvn --batch-mode --no-transfer-progress checkstyle:check(:509,:516) andclean verify checkstyle:check(:1000,:1348,:1416,:1442).
The base file had no such import, so this diff introduced it. Fix — reorder so the JUnit assertions are contiguous and alphabetical, with Mockito last:
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;Then cd packages/managed-agent-server && mvn -o -B -pl server,verification checkstyle:check should be green.
This is the same finding the bot filed in round 6 at 8529a681 and that @yiliang114 carried forward in a CHANGES_REQUESTED against this exact head two minutes before I started. The head has since moved only by a merge of main, so the PR's own files did not change and the violation came through untouched. We agree it is the sole blocker.
Earlier Criticals: closed by the round progression, not re-read by me
Five Criticals were filed across six rounds: R1-1 and R3-1, R4-1, R3-2, R6-1. None carries a qwen-review-fixed-ruling marker on this PR, so I read the ledger progression instead — a round that re-verifies carries a still-standing finding forward under its original id, so an id that disappears was assessed as fixed:
| Round | Head | Criticals filed |
|---|---|---|
| 2 | 8ee2ce3b |
R1-1 |
| 3 | 8ee2ce3b |
R1-1, R3-1 |
| 4 | 13cd5450 |
R4-1 — R1-1 and R3-1 gone |
| 5 | aa53b983 |
R3-2 — R4-1 gone |
| 6 | 8529a681 |
R6-1 — R3-2 gone |
So R1-1 and R3-1 closed by round 4, R4-1 by round 5 and R3-2 by round 6, and the maintainer's review independently concurs that everything besides R6-1 is addressed. I did not re-read those four closures in source myself, and I am not filing anything against them — the finding that matters is the one I can prove is still there.
Also noting without gating on it: round 6 disclosed it had not run the build, and deferred four non-blocking observations, including that harnessUrlVerdict does not model the preflight's plaintext-transport rule and that the --server-url refusal battery omits a query-or-fragment case. Those are marked non-blocking and the diff has grown 3.3× since the review first measured it, which is worth a maintainer's judgement on shape but is not mine to block on.
CI
The 15:57 merge re-triggered everything: at this head no lane has completed — 22 queued, 39 skipped, 0 succeeded, 0 failed. So there is no red run at 814b1210 to cite and no green one to lean on; the finding above rests on the source and configuration, which is firmer evidence than a lane would have been. Once the Java lane runs it should reproduce the Checkstyle failure, and it is the lane to watch after the reorder.
…rver-url query The Mockito static import sat between two JUnit ones, so the verification module's ImportOrder check failed. The static block is now sorted. start and verify append /actuator/health and the API paths to --server-url, so a query or a fragment there took the paths in. With http://proxy.test/?a the command probed /?a/actuator/health, and fetch dropped a fragment along with the path after it. Such a URL is now refused up front. A listed Session entry with no id is now shown as itself rather than as "undefined". A health answer whose JSON parse error quotes control bytes is pinned to come out sanitized.
|
Round 6, at
The four items round 6 deferred:
Tests:
🤖 Generated with Claude Code — Claude Opus 5.5 |
qwen-code-review-bot
left a comment
There was a problem hiding this comment.
Partially reviewed — gaps disclosed.
Not explored to full depth (tool budget reached): "agent reverse-audit (round 2)": did not run the API row assertions in sessionRow / turnRow to verify the same added paragraph's claims about terminal: true , event sequence advance, page d…; chunk 4: did not run the Java suites (Maven build prohibited in this shared worktree), so the two Java test files' greenness is argued from the production code paths abo…; "agent reverse-audit (round 4)": could not execute ResolvedConfigurationTest and HarnessConfigurationTest — mvn -o cannot resolve the sibling module jars from the local repo, and a full r….
Not reviewed: reverse audit — did not converge within the reverse-audit round cap of 5.
Deferred under the convergence posture (round 7, not a blocker) — recorded, not requested in this round:
docs/users/managed-agent-reference-deployment.md:231 — [probe] the user deployment guide omits the trusted-actor condition on verify --tenant's API readpackages/managed-agent-server/distribution/bin/qwen-managed-agent-upgrade.mjs:2956 — [probe] a lone-surrogate Session id turns the row into FAIL URI malformedpackages/managed-agent-server/distribution/bin/qwen-managed-agent-upgrade.mjs:2774 — [probe] an empty user name escapes the pre-restart Harness URL check when there is no verdictdocs/design/2026-10-25-managed-agent-upgrade-command.md:126 — [probe] the design docs overstate how much of a refused URL is maskedpackages/managed-agent-server/distribution/bin/qwen-managed-agent-upgrade.mjs:3162 — [probe] the health URL reaches the rows without the new control-byte neutralizerdocs/design/2026-10-25-managed-agent-upgrade-command.md:126 — [probe] the connector's plaintext-remote rule is missing from the documented verdict
中文说明
仅完成部分审查,审查缺口已披露。
未探索到全部深度(达到工具调用预算):"agent reverse-audit (round 2)":did not run the API row assertions in sessionRow / turnRow to verify the same added paragraph's claims about terminal: true , event sequence advance, page d…;chunk 4:did not run the Java suites (Maven build prohibited in this shared worktree), so the two Java test files' greenness is argued from the production code paths abo…;"agent reverse-audit (round 4)":could not execute ResolvedConfigurationTest and HarnessConfigurationTest — mvn -o cannot resolve the sibling module jars from the local repo, and a full r…。
未审查:反向审计——在 5 轮的反审轮数上限内未收敛。
收敛姿态下延后(第 7 轮,非阻断)——已记录,本轮不要求修改:共 6 条(原文未翻译,列表见上方英文部分)。
— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.26.7)
yiliang114
left a comment
There was a problem hiding this comment.
Delta APPROVE from head 814b121 → 3b67b6e.
Fixed: The static import ordering in ResolvedConfigurationTest.java is now assertEquals, assertThrows, assertTrue, mock — the verification module checkstyle gate passes (Managed Agent fast tier is green at head).
Delta (3b67b6e):
--server-urlwith a query or fragment is now refused up front inlisteners(), since/actuator/healthand API paths are appended to it and would land in either. Tests cover?tenant=acme,?(query-only), and#ingress.sessionRoute()now checks'id' in sessionbefore accessingsession.id, so a listed entry without an id (e.g.{ name: 's1' }) is shown as its printed form instead of "undefined". Verified by the parameterized test entry[{ name: 's1' }, '{"name":"s1"}'].- Health text sanitization test pins control bytes through
JSON.parse('x\u001b[2K\u001b]52;c;')to verify they come out as ``. - Design docs and deployment reference updated with the query/fragment refusal sentence.
No P0/P1 findings. APPROVE.
qqqys
left a comment
There was a problem hiding this comment.
Re-reviewed at head 3b67b6ec1d8c323c603287c8c7ae15ba1b061675 (base main). This supersedes my comment on 814b1210. The single Critical I filed there is verified fixed, and I found no new blocking defect.
R6-1 — the static-import order: fixed
The block I named as failing ImportOrder now reads, at this head:
28: import static org.junit.jupiter.api.Assertions.assertEquals;
29: import static org.junit.jupiter.api.Assertions.assertThrows;
30: import static org.junit.jupiter.api.Assertions.assertTrue;
31: import static org.mockito.Mockito.mock;That satisfies the rule I traced last time — qwen-code-checks.xml sets ImportOrder with option=bottom and sortStaticImportsAlphabetically=true, and org.junit.jupiter.api.Assertions.assertThrows now precedes org.mockito.Mockito.mock instead of following it. The static block is still last. The four-link chain I verified at the previous head still governs unchanged: test sources are linted (includeTestSourceDirectory=true at plugin level in managed-agent-server/pom.xml), the runtime-broker-checkstyle execution that sets it false is scoped to runtimebroker/** and never sees this file, and CI invokes checkstyle:check directly.
I verified this by reading the file at head rather than from the fix's commit message. The SDK Java (full) tier was still running when I published, so the lane has not itself reported green on this head yet — but an ordering violation is decidable by inspection against the rule, and the order is now correct.
The rest of the new commit
3b67b6ec is a direct child of the head I reviewed, not a merge, and beyond the one-line reorder it carries two changes. I read both.
A --server-url carrying a query or fragment is now refused. The paths are appended to that URL, so http://proxy.test/?a would probe /?a/actuator/health and a fragment would swallow the appended path entirely, since fetch drops it. The guard is /[?#]/ on the option, placed after the earlier userinfo refusal — which is what makes the simple character class sound, because past that point a ? or # can only begin a real query or fragment rather than sitting inside credentials. The change is additive in the safe direction: it refuses strictly more inputs and never fewer, and no legitimate value is caught, since the only places those characters could legally appear were already refused.
sessionRoute no longer prints (undefined) for an object entry with no id. The condition gained && 'id' in session, so an entry that is an object but carries no id is shown as it came rather than as its missing property. The in operator cannot throw here because the same expression has already established the value is a non-null object. Diagnostics only — no behavioural surface.
Both close items the previous round had deferred as non-blocking probes, which is why round 7 at this head reports zero Criticals and zero Suggestions — a fully clean round on the exact commit I am approving.
Earlier Criticals
Five Criticals were filed across seven rounds: R1-1, R3-1, R4-1, R3-2 and R6-1. None carries a fixed-ruling marker on this PR, so I read the ledger progression, where a round that re-verifies carries a still-standing finding forward under its original id:
| Round | Head | Criticals |
|---|---|---|
| 2-3 | 8ee2ce3b |
R1-1, R3-1 |
| 4 | 13cd5450 |
R4-1 — both earlier ones gone |
| 5 | aa53b983 |
R3-2 — R4-1 gone |
| 6 | 8529a681 |
R6-1 — R3-2 gone |
| 7 | 3b67b6ec |
none — R6-1 gone |
So R1-1 and R3-1 closed by round 4, R4-1 by round 5, R3-2 by round 6, and R6-1 by round 7 — the last one confirmed by my own read above rather than by the ledger alone. The maintainer who filed R6-1 as a CHANGES_REQUESTED against the previous head has approved this one.
Round 7 disclosed its own gaps, which I pass on rather than adopt: it could not execute the two Java test classes in its worktree, and its reverse-audit did not converge inside the round cap. Its deferred probe list is marked non-blocking, and two of its entries are what this commit fixed.
CI
35 checks pass and 0 fail at this head, with 7 running and 4 queued, 39 skipped. The approval promoted the head from the fast tier to SDK Java (full), so the Java lanes including the Checkstyle gate and the MySQL and RocketMQ tiers are in progress rather than complete — there is no green Checkstyle run to cite yet, and per this channel's rules I did not wait on it. Nothing red is attributable to this diff.
Scope
I read the changed Java test file's import block, the whole production delta of 3b67b6ec in the upgrade script, and re-confirmed the Checkstyle chain from the previous head still governs. I did not re-read the rest of the PR's ~700 source lines, which four clean-or-superseded rounds and the maintainer's approval cover, and I did not run the Java suites myself.
|
PR 16110 round 3 verification — Verdict: findings — 209/210 scripted assertions passed, 1 failed. Verified head: 中文摘要
Full English reportPrevious findings at this head
Re-measured here, not read off the previous report. The round-2 suggested patch for finding 1 is still superseded by the author’s Two reviews arrived while this round ran, both APPROVED at the verified head and neither carrying a blocking item: Central claim and A/BThe claim is unchanged: The A/B uses the repository’s own upgrade rig (fake
The full cell printout is The blocked-port list was re-enumerated at this head through the runtime’s own Mutation matrix23 single-point mutants, all killed. The JS rows rewrite one production expression at a time in a separate scratch tree, run the unmodified 67-test head suite, and restore the pristine bytes (checked by sha256) after every row; the unmutated baseline ran 67/67 first. The Java rows do the same for
The matrix as it printed is The matrix is per-guard, not per-commit. This round does not claim per-commit coverage: the 12 production commits since FindingsFinding 1 — Suggestion: a falsy JSON status is not shown as its JSON, as the new doc saysReproduce with the head arm probe (a fake health endpoint answering docker exec -w /work/arms/head -e VERIFY_ARM=head pr16110-verify \
node --test --test-name-pattern 'VP7' scripts/tests/probe.test.mjsThe assertion fails with: The same happens for Suggested fix (measured)- answer: body?.status
+ answer:
+ body?.status !== undefined && body?.status !== null
? `${status}, status ${printable(body.status)}`
: status,Applied in a scratch copy: the head suite plus the 7 probes runs 74/74, and the four rows become Not covered
MethodologyThe round ran inside a credential-free — DeepSeek-V4.1-Flash-1017@fda99a87 via Qwen Code /verify-pr (v0.26.6; skill c5273cc80df5) |
|
|
|
The items that arrived after this PR settled are followed up in #16352. Verification round 3, Finding 1. A falsy JSON status was shown as a bare
Bot round 7, deferred probes.
On the masking probe: a password that starts with digits and holds a #16352 has an A/B on the systemd rig against main for each of these. Its suite passes 68/68 on Node 22 and Node 24, and all 17 mutants are killed.
🤖 Generated with Claude Code — Claude Opus 5.5 |
|
Released in v0.26.8. |
…ess user info in the upgrade command (#16352) * fix(managed-agent): mask digit-led passwords and refuse an empty Harness user info Follow-ups to the review items deferred on #16110 and #16175: - A refusal hides everything up to a URL's last @, also when the URL parses: a password that starts with digits and holds a / ? or # reads as a port to both the URL parser and java.net.URI, so http://svc:2024#Secret@harness:4170 printed whole. The --server-url query refusal masks too. - Without the server's verdict, start refuses an @ before the Harness host (http://@host, http://:@host), which java.net.URI reads as user information and the connector refuses, instead of restarting the Harness for it. - The health row and start show a status of 0, false or "" instead of dropping it, and print the URLs they dial through the control-byte neutralizer. - A Session id with a lone surrogate fails its row by name instead of "URI malformed". - The Flyway reader test covers a path two modules both ship; the user guide names verify --tenant's --actor condition, and the design docs state the masking, status and id rules as applied. * fix(managed-agent): neutralize the DEL and C1 bytes a quoted value keeps JSON.stringify escapes C0 controls but not DEL or C1 bytes, so a refused URL or a Session id the verify row echoes could carry U+009B, an 8-bit CSI introducer, to the terminal, and the id was not bounded. The four refusals that quote a URL and the id row now go through printable() after JSON.stringify: C0 controls keep their escapes, DEL and C1 bytes show as U+FFFD, and the quoted text stops at 200 code points. * fix(managed-agent): print no password a --server-url carries, and stop predicting java.net.URI Review round 2 on #16352. - A --server-url with an @ left after the URL parser reads no user information is refused: it is the rest of a password that starts with digits, which the parser reads as a host and a port, so the phase would dial the wrong host and print the password. check judges --server-url the same way, since its plan repeats it. - start's three outcomes and verify's health row print every URL with its user information masked. - With the server's verdict false, the refusal names a reason only where the value shows one the server gives too: a user name or password, a query or a fragment, or an @ in an authority after //. - Without a verdict, start takes only a plain http(s) URL, a rule of its own and narrower than the server's, instead of modelling how java.net.URI reads user information: http:/@host, a backslash, a tab, an underscore or a space no longer reach the Harness restart, and an @ in a path still does. - The design record and the deployment guide say so. * fix(managed-agent): correct upgrade URL guards and plan output * fix(managed-agent): keep refusing an @ in --server-url, and spell plan words affe6c5 dropped the refusal of a --server-url with an @ left after the URL parser read no user information, to let a path hold one. That is the shape of a password that starts with digits: for https://svc:12/s3cret@cp.example.com the parser reads host svc and port 12, so start and verify dialled svc with the password in the path. The refusal is back; an @ a path holds is written %40, which the docs now say, and a test pins a proxy prefix spelled that way. The plan printed --server-url through shown(), which turns a control character into U+FFFD and masks the text before an @, so the printed command was not the one to run. check refuses such a value before the plan, and shellWord now spells any control character in any plan word as the escapes of its UTF-8 bytes inside $'...', which bash reads back to the value, instead of leaving it raw inside quotes. The Harness rule start applies without the server's verdict follows java.net.URI's host grammar: no empty label, no label that ends in a hyphen, a last label that starts with a letter, a dotted-quad IPv4 address, and an IPv6 address of the standard forms. A differential run of 2,000,000 generated URLs found none the rule takes that java.net.URI refuses. The usage line says what check does with --server-url without suggesting it dials it. * fix(managed-agent): accept trailing-dot Harness hostnames Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(managed-agent): take the IPv6 Harness hosts that end in IPv4 when the configuration does not resolve The plain-URL rule start falls back to refused an IPv6 address that ends in an IPv4 one, such as http://[::ffff:127.0.0.1]:4170, which the server's Harness connector accepts, so the same Harness URL was refused while the configuration did not resolve and taken once it did; the previous commit took the final dot of a fully qualified name for the same reason. The rule stays narrower than java.net.URI's, never wider: it still refuses a one-label name that starts with a digit and an octet with a leading zero, which the URL parser fetch uses reads as another address, and an empty port. The refusal of an @ in --server-url now names its remedy, %40, as its sibling refusals do, and the comment that describes quoted() sits above it. * fix(managed-agent): tighten upgrade URL and plan handling Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(managed-agent): harden upgrade rows and Harness URL checks Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com> * fix(managed-agent): take the digit-led Harness hosts fetch reads alike, and refuse an empty --server-url The no-verdict Harness rule refused a one-label name that starts with a digit, such as a container's 4harness, which java.net.URI and fetch both read as that host. It now refuses only what the URL parser fetch uses reads as another address: a one-label number, in decimal or 0x hex, and an octet with a leading zero. The last label of a longer name still starts with a letter, as java.net.URI requires, so harness.1b stays refused, and an empty port is taken. The refusal says what the rule needs instead of "a host and port with a path". check, start and verify test whether --server-url was given rather than whether it is truthy, so the empty value an unset variable leaves is refused instead of printed into the plan and then ignored. A plan's control bytes are written as three-digit octal escapes inside $'...', which bash, zsh and ksh all read back; ksh read a \x escape on through a hex digit after it. --------- Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>











What this PR does
Follow-up to #16051, from the review notes that arrived around its merge.
fetchrefuses is refused up front.startandverifyused to refuse a listener URL only whenURL.canParserejected it. A--server-urlwithout a scheme (proxy.test:8443, which parses as an opaqueproxy.test:URL), with a user name or password, or on a port the Fetch standard blocks (6000, 10080 and 80 others) passed that check and then failed every probe until--timeout. The newfetchRefusal()refuses all four shapes before any unit starts, for the resolver's URLs and for--server-urlalike, and says which one it is (--server-url "proxy.test:8443" is not an http or https URL.).start's timeout used to say only "did not report UP … within Ns", andverify's health row only "is not UP". Now the timeout names the endpoint's last answer and the row names its own:HTTP 503, status DOWN,HTTP 502(a proxy's error page),self-signed certificate,ECONNREFUSED, orThe operation was aborted due to timeout.fetchitself words every failure as "fetch failed", so the answer comes from itscause.verify's session and turn rows (from the API's error reasons, Session IDs and event types) show asU+FFFD. A refused--server-urlprints its password as***.verify's API reads name thefetchcause as the health probe does.ResolvedConfiguration) now printsharnessOrigin, the server's own verdict on the Harness URL:skipfor a disabled Harness, which nothing reads, and otherwise whether the Harness connector, single or pooled, takes the value. It prints that URL untrimmed, as the server parses it.startrefuses on the verdict before it restarts the Harness, so the script keeps no copy ofjava.net.URI's rules.verifychecks the type of what the API answers before it uses it. A page without a data list, a Session id that is no string or names no route segment, an event type that is no string, or a sequence that is no whole number fails its row with what came back, instead of throwing inside a coercion.listeners()comment now names thereachesHarness: falseoptionverifypasses.NODE_EXTRA_CA_CERTSat the CA when the certificate is not one this host trusts.Why it's needed
The verify-pr round 2 report on #16051 measured
URL.canParse('proxy.test:8443')as true andfetchrejecting it immediately, sostart --server-url proxy.test:8443waits out--timeoutand then reports a server that is in fact UP. Checking the same path showed two more shapes with the same result: credentials in the URL (Request cannot be constructed from a URL that includes credentials) and the Fetch standard's blocked ports (bad port). A blocked port can come from the resolver's own output, for exampleserver.port=6000. In every case the oldhealth()swallowed the error, so the operator saw only a timeout. A certificate the host does not trust (self-signed certificate) failed the same silent way.Reviewer Test Plan
How to verify
node --test scripts/tests/managed-agent-upgrade.test.mjs→ 67/67.refuses only the URLs fetch refusespins each refusal and its wording, and keeps the list honest: every URLfetchRefusal()refuses (the 82 blocked ports out of 1–65535, two schemes, two credential forms) must be rejected by the runtime's realfetchwithbad port,unknown schemeor the credentialsTypeError. All of those rejections happen before any connection is made.start refuses listeners it cannot reach before it starts anythingadds the resolver at port 6000 and--server-urlvaluesproxy.test:8443,http://admin:secret@…andhttp://…:10080/. All of them are refused with both units still inactive.verify says what the health endpoint answered instead of UPcoversHTTP 404,HTTP 503, status UP,HTTP 502with an HTML body,HTTP 200, terminated,self-signed certificate, and anAggregateErrorthat carries onlyECONNREFUSED.Evidence (Before & After)
How
fetchtreats each shape, measured on Node 22.22.2 (/actuator/healthappended):URL.canParse(old check)fetchrejects withproxy.test:8443unknown scheme--timeout, "did not report UP"is not an http or https URLhttp://u:p@127.0.0.1:…Request cannot be constructed from a URL that includes credentials--timeoutcarries a user name or password, so fetch refuses ithttp://127.0.0.1:6000bad port--timeoutis on port 6000, so fetch refuses to dial ithttps://…(self-signed)self-signed certificate… (the last answer: self-signed certificate)http://localhost:39999(closed)AggregateError, codeECONNREFUSED, empty messageis not UP: ECONNREFUSEDThe 82 blocked ports were read from the
badPortslist in the Node 22 binary's bundled undici and match the Fetch standard.NODE_EXTRA_CA_CERTS=<the CA>turned the self-signed failure into200 {"status":"UP"}in the same probe.Mutation matrix (17 single-point mutants,
scripts/tests/managed-agent-upgrade.test.mjs): 17/17 killed. The mutants drop or alter, one at a time:causefallback;statusdetail, the JSON-failure branches for success and non-success, and the success-status guard on UP (unpinned until now);start's timeout and inverify's row;Review round 1 (
13157b7c96).startcheckedqwen.managed-agent.harness.base-urlwithnew URL()alone, so an opaque value such asproxy.test:8443parsed with an empty host and port, andstartwaited out--timeoutfor the Harness to listen on port 80 of an empty host.startnow refuses a Harness URL that is nothttporhttpsbefore it starts a unit, as the server's preflightharnessrow would fail it later anyway.fetchRefusal()does not apply here: the Harness is reached by a TCP connect, where a portfetchblocks connects fine.fetchagainst a port nothing listens on and expectsconnect ECONNREFUSED 127.0.0.1:<port>, so thecause.messagethe fallback reads comes from a real error. The self-signed and multi-addressECONNREFUSEDshapes stay constructed in the suite (a real certificate would need a key in the repository); both were measured on Node 22.22.2, see the table above.causewith neither message nor code (triage note 1). Kept. Every realfetchfailure measured here carries one or the other; a cause with neither has nothing more to say thanfetch failed, which is what is printed.Review round 2 (
a25a76d2a6).start's last answer (verification finding 1).waitForgives the last probe theMath.max(deadline - now, 1)the deadline leaves, which is 1 ms once the deadline has passed, so against a real endpoint that probe times out before any answer arrives, andstart's timeout reportedThe operation was aborted due to timeoutinstead of theHTTP 503, status DOWNthe endpoint had been answering. The suite missed it because the rig'sfetchignored the signal. Now a probe that times out on a budget the deadline cut below the 5-second cap does not replace an earlier answer; one that runs out of its own 5 seconds still does, since then the endpoint has stopped answering.verifyis unchanged: it makes one probe with the whole budget.fetchnow awaits a response function, so a test can model an endpoint that answers in 50 ms on the real clock and honours the abort signal: of four probes the last one times out, and the message keepsHTTP 200, status DOWN. A second case answers once and then times out at the cap, and the message names the timeout.503 {"status":"DOWN"}, realfetchand the real clock,start --server-url … --timeout 1and2, eight runs per arm: before, 6/8 messages named the abort; after, 8/8 nameHTTP 503, status DOWN.http://127.0.0.1:70000/%isis not a URLwith no zone note, so reverting the regex to/%/now fails.<=, the earlier-answer clause removed,timedOutnever set,timedOutkeyed onAbortError, and the zone regex reverted. 26/26 in all.Review round 3 (
80d7e70e3d).fetchresolves once the headers arrive, so a body the deadline stalls rejects inresponse.json(), with the sameTimeoutError(measured on a real socket, Node 22.22.2). That branch did not reporttimedOut, so a probe the deadline cut short replaced an earlierHTTP 503, status DOWNwithHTTP 200, The operation was aborted due to timeout. The body-read branch now reportstimedOuttoo. On the real clock, with a live endpoint that answers 503 once and then sends200headers and stalls (--timeout 3, four runs per arm), the last answer was the abort 4/4 before and isHTTP 503, status DOWN4/4 after.timedOuthalf of the guard (verification finding 2). It is now pinned. The last-answer test has two real-socket cases: the stalled body, and an endpoint that answers 503 and then closes, so the next probe'sconnect ECONNREFUSED 127.0.0.1:<port>replaces the earlier answer even though the deadline cut that probe's time as well. Droppingprobe.timedOut &&now fails the test. The test, with both real-socket cases, passed 20/20 in repeats.--timeout 6on the real clock, the second probe has about 4,999 ms left, so the deadline is what ends it. The rule is unchanged; the test's fake clock pins the exact 5,000 ms boundary.timedOut, withtimedOutalways false, and the guard withoutprobe.timedOut. The six round-2 guard mutants and the zone mutant were rerun and are still killed. 29/29 in all.Review round 4 (
d8e6c1bb5f,5c18f44efa,0d44ff8455,8ee2ce3b26).80d7e70e3d(R1-1 to R1-5), fixed ind8e6c1bb5fand5c18f44efa.U+FFFD, so an endpoint cannot move the cursor, split the row or write the clipboard. This is pinned over a real socket.--server-urldoes.startlabels the kept valuethe last answer.verify's URL refusal is pinned.closestest server is torn down int.after.qma-e2e-*units under a service account, MySQL 8.4.6, and the Hosted Harness on a fake model. Each cell ran once withmain's upgrade script and once with this branch's:mainstartandverify --turnserver.port: 6000inapplication.yml(Spring serves it)verifyrefuses too--server-url localhost:<port>--server-url http://ops:secret@…verifyprints the password in its session row***localhost:<port>http://[fe80::1%eth0]:<port>{"status":"DOWN"})(the last answer: HTTP 503, status DOWN)at--timeout10, 13 and 17; "is not UP: HTTP 503, status DOWN"NODE_EXTRA_CA_CERTS,startandverify --turnpassNODE_EXTRA_CA_CERTS,startandverify --turnpass(the last answer: HTTP 502); "is not UP: HTTP 502"startandverify --turnpass through nginx0d44ff8455.--server-urlwith a password printed the password. It now printshttp://ops:***@127.0.0.1:<port>/.verify's session and turn rows said only "fetch failed", under a health row that named the cause. API reads now take the same cause.0d44ff8455swapped in: P0 passes, both credential refusals are masked and no output holds the password, and the TLS session rows name the certificate error.0d44ff8455), fixed in8ee2ce3b26.printable()ranString()on the endpoint's value.String()throws on a valid JSON object whose owntoStringis no function, such as{"status":{"toString":1}}, andhealth()is not inside a try. On the rig,verifyexited withCannot convert object to primitive valuebefore printing its health row, andstartstopped at its first probe. Such a value is now shown as its JSON. On the same rig,verifyprintsis not UP: HTTP 200, status {"toString":1}, andstartwaits out--timeoutwith that as its last answer. A test pins both, plus an API error reason of that shape, and reverting toString()fails two tests.check's database row WARNs "cannot compare the Flyway scripts (no Flyway script found in …)" on every archive. The scripts moved intoBOOT-INF/lib/qwen-managed-agent-persistence-*.jar, and the scan reads onlyBOOT-INF/classes/. Fixed separately in fix(managed-agent): find the Flyway scripts in the module jar the server ships them in #16175.withoutPasswordas a no-op; the refusal without it; API reads without the cause; the cause unsanitized (killed once a case with control bytes in the cause was added); the API reason, the unreadable-body message, the Session ID, and the passing and failing turn rows each unsanitized; and the autofix's sanitization and zone reason reverted. Withprintable()back onString(), 41/41 in all.Review round 5 (
13cd545086). The bot's rounds 2 and 3 at8ee2ce3b26raised six findings, all in two shared causes. They are fixed at the source:printable()no longer throws on any parsed JSON value. A status nested deeper thanJSON.stringify()recurses shows as[unprintable].… (N characters), cut after the control bytes are replaced and never inside a surrogate pair.withoutCredentials()masks the whole user information, so a token in the user-name position is masked. It also masks textually when the URL does not parse, and the Harness refusal uses it.startandverifycheck the health endpoint, and onlyverify --tenant, which reads the API, checks the API URL. An API on a port fetch refuses, behind a separate management port, no longer stopsstart.harnessOriginchecks it, an http(s) origin without user information, a query or a fragment, sostartrefuses it before restarting a running Harness.8ee2ce3b26against this one:8ee2ce3b2613cd545086server.port: 6000with a separatemanagement.server.portstartrefused in 0.9 sstartUP on the management port;verifypasses;verify --tenantrefuses over the API portbase-url…/?tenant=acme--server-url http://admin:secret@127.0.0.1:70000"http://***@127.0.0.1:70000" is not a URLverify: onlyMaximum call stack size exceeded;start: the same, server left runningis not UP: HTTP 200, status [unprintable];startreports the last answer and that the server keeps running… (100000 characters)verify --turnReview round 6 (
c80d768a42,e51f95f2e2). The bot's round 4 at13cd545086raised four findings and deferred one. Two of them, R4-1 and R3-2, came from the script deciding again what the server already decides, so the script now takes the server's answer:verifydecides its session row before it checks the listeners, from the resolver runlisteners()takes anyway. It checks the API URL only when that row reads the API:--tenantis given, the auth mode isopen, and--actor, when given, has a trusted actor header. It always checks the health URL.ResolvedConfigurationprintsharnessOrigin: whatManagedAgentPreflight.harnessOrigin, now package-private, makes of the value the server parses, untrimmed. It also prints that value untrimmed.startrefuses on that verdict before it restarts the Harness. That covers a host with an underscore, an empty user name, a padded value, and anything elsejava.net.URIrejects. When the configuration does not resolve, only the reasons the script names itself apply.@is masked, and a leading//keeps its place. A value that parses with an authority comes back unchanged.printable()counts code points in one pass and keeps only the head. The output is byte-identical.printable()too, so a long Session ID cannot stretch the row.e51f95f2e2and installed over alpha.100 throughcheck,stop,backupandinstall. The previous head's script was swapped into a copy of the same release:13cd545086e51f95f2e2verify --tenant e2everify --tenant e2e --actor alice--actor needs a trusted actor headerbase-urlset to' http://…:54787 ',http://@…:54787orhttp://qwen_harness:54787qwen_harness, waited out 10 s)--server-url https://svc:Pa/ss@…,…:Pa?ss@…,//svc:s3cret@…https://***@…,//***@…--max-old-space-size=160FATAL ERROR: … heap out of memoryverifyandstartcrash,startafter starting the serververify --turn, before and after the scenariosResolvedConfigurationTestpasses 14/14 andManagedAgentPreflightTest82/82, with checkstyle.Review round 7 (
3a556b9ab5,9b8a548e3c,948e7484b5). The bot's round 5 ataa53b9833eraised one Critical finding and deferred two. Two independent reviews of the fix then found more. All of it is fixed:ManagedAgentPreflight.harnessUrlVerdictsits next toharnessCheck.ResolvedConfigurationprints its verdict asharnessOrigin.skipwith the Harness disabled, the default. The harness row returns before it readsbase-url,BrokerSecurityreturns early, and the connector bean is conditional onenabled, so nothing reads the value.skipthere too, and the first commit followed it. ButHarnessConfigurationbuilds every pool member'sQwenHostedHarnessConnectorfrom the singlebase-url. That connector refuses anything but an http(s) URL with a host and without user information, a query or a fragment.HarnessPoolConnector.refresh()drops a member whose connector throws. So such a pool reports UP and accepts no Session.startasks nothing more oftrueorskip. Onfalseit words the reason. The user-information and query/fragment rungs, copies of the same rule, now only word that verdict.startwaits on that host and port.startrefusal loops check each run's output for the password, not only the last run's.verifychecks the type of every value the API chose before it uses one. The regex,encodeURIComponent(),Number(), iteration and.lengthall coerced first, and{"toString":1}or a 20 000-deep array made them throw beforeprintable()could say what came back. Now:.or..).terminal: trueends a turn.check,stop,backupandinstall. Each arm ran while its own release was installed. The database was recreated empty once, because main's refactor(managed-agent): align shared MySQL schema conventions #16143 rewroteV1__managed_schema.sqlin place.3a556b9ab5(alpha.102)base-url' http://…:54787 'or…/?tenant=acme:startskip;SKIP harness disabled; UPbase-urlorhttp://qwen_harness:54787qwen_harnessbase-url"harnessOrigin":"true"; UPbase-urljavaonserver.env'sPATH),…/?tenant=acmeorhttp://svc:s3cret@…{"toString":1}/ 20 000 deepFAIL … Cannot convert object to primitive value/Maximum call stack size exceededFAIL the API answered a Session without a string id ({"toString":1})/([unprintable])7; anullevent firstPASS … ended with 7;Cannot read properties of nullFAIL … ended with 7;PASS{"data":[0]}; items{"data":{"length":2}}; events{"data":{}}WARN … no Session;PASS … 2 item(s);object is not iterableFAIL … without a string id (0);FAIL … answered no data list ({"length":2});… ({})[{"id":"s1"}]; Session id..;"terminal":"false"WARN … no Session; a 404 from/v1/agents;PASSFAIL … answered no data list (…);FAIL … whose id ".." names no route;FAIL … no terminal event within 5sverify --tenant e2e --turnResolvedConfigurationTest15/15,ManagedAgentPreflightTest82/82 andHarnessConfigurationTest2/2, also on the tree merged with main.judgesTheHarnessUrlAsTheConnectorThatDialsItDoeschecks that, for 13 URLs, the verdict is whether the real connector builds.buildsEachPoolMembersConnectorFromTheSingleBaseUrlbuilds a pool through the real factory: one member for a cleanbase-url, none for a padded or underscore one. It fails when the connector stops checking the URL.nullevent, the error prefix,terminal, and the dot ids. Five are in the Java: the enabled guard dropped, the pool guard dropped and added back,skipread astrue, and the connector's URL check dropped.Review round 8 (
3b67b6ec1d). The bot's round 6 at8529a681e8raised one Critical item, and a maintainer review on814b121014carried it forward. The bot also deferred four.ImportOrdercheck; the block is sorted now.mvn -o -B -pl server,verification checkstyle:checkpasses.--server-urlwith a query or a fragment is refused. The paths are appended to it, sohttp://…/?qprobed/?q/actuator/health(seen on a real listener), and a fragment lost the path.idis shown as itself, and the health row's parse-error path is pinned to come out sanitized.harnessUrlVerdictdoes not modelBrokerSecurity's plaintext-transport policy. That is a startup policy the preflight'svalidationrow reports, not a URL-shape rule.ResolvedConfigurationTest15,ManagedAgentPreflightTest82,HarnessConfigurationTest2 andClassSizeRatchetTest1, all passing, plus checkstyle. Four more mutants, all killed, 107/107 in all.Tested on
Linux x86_64 with Node 22.22.2, and Linux aarch64 with Node 24.14.0 (the suite also passes 67/67 there, so the blocked-port list matches both runtimes).
Environment (optional)
Rounds 4 to 7 also ran on a real systemd host. That host has systemd 257 units for the control plane and the Harness, MySQL 8.4.6, nginx and a scripted model, and its reference archives are packaged from the branch. The upgrade command runs under systemd, which is Linux-only.
Risk & Scope
bad port) at the timeout instead of an up-front refusal. If a port were dropped from the standard, the agreement test would fail.ResolvedConfigurationprints one more key and the Harness URL untrimmed, andManagedAgentPreflightgains the package-privateharnessUrlVerdictandharnessOrigin. The verdict leans on two server facts that tests now pin: the connector's URL rule (ResolvedConfigurationTest) and the pool building each member from the singlebase-url(HarnessConfigurationTest). PR CI runs no Java tests, so the three Java test classes above ran locally. Main'sClassSizeRatchetTestfailure onJournalCommit(886 lines over its 880 ceiling) is fixed by fix(managed-agent): restore JournalCommit under its class-size ratchet #16323, merged here; it passes on this head.port != 0clause the mutation report calls dead mirrors Spring Boot'sManagementPortTypecondition word for word, so it stays for the reader.serverBaseUrl()is still theserver.envfallback insidelisteners()and has its own tests, so it is not unused. The--checkgap stays in Managed Agent --check ignores the configuration files the server reads from its working directory #16057.Linked Issues
Follow-up to #16051. Related: #16057 (not addressed here).
中文说明
这个 PR 做了什么
#16051 合入前后收到几条评审意见,本 PR 是它们的 follow-up。
fetch会拒绝的 URL,一律在开始前拒绝。 以前start和verify只在URL.canParse不通过时拒绝监听 URL。下面几种--server-url都能通过这项检查,随后每次探测都失败,直到--timeout:没有 scheme 的(proxy.test:8443会被解析成 scheme 为proxy.test:的不透明 URL)、带用户名或密码的、端口在 Fetch 标准屏蔽列表里的(6000、10080 等共 82 个)。新增的fetchRefusal()在启动任何 unit 之前拒绝这四种情况,对解析器给出的 URL 和--server-url一视同仁,并说明属于哪种(--server-url "proxy.test:8443" is not an http or https URL.)。start超时只说 "did not report UP … within Ns",verify的 health 行只说 "is not UP"。现在超时提示给出端点最后一次的应答,health 行给出本次探测的结果,例如HTTP 503, status DOWN、HTTP 502(代理的错误页)、self-signed certificate、ECONNREFUSED、The operation was aborted due to timeout。fetch自己对所有失败都只报 "fetch failed",所以原因取自它的cause。verify的 session 和 turn 行(来自 API 的错误原因、Session ID 和事件类型)中的控制字符显示为U+FFFD。被拒绝的--server-url把密码显示为***。verify读取 API 失败时,与健康探测一样给出fetch的 cause。ResolvedConfiguration)现在输出harnessOrigin,即服务端自己对 Harness URL 的判定:Harness 被禁用时为skip(没有任何地方读取它),否则为 Harness 连接器(单实例或 pool)是否接受该取值;并且按服务端的解析方式输出未经 trim 的 URL。start在重启 Harness 之前依据该判定拒绝执行,因此脚本不再保留一份java.net.URI规则的副本。verify先检查 API 返回值的类型再使用。 页面没有 data 列表、Session id 不是字符串或不能作为路由中的一段、事件类型不是字符串、序号不是整数时,该行判失败并写出实际返回的值,而不是在隐式转换中抛错。listeners()的注释写明了verify传入的reachesHarness: false选项。NODE_EXTRA_CA_CERTS指向其 CA。为什么需要
#16051 的 verify-pr 第 2 轮报告实测:
URL.canParse('proxy.test:8443')返回 true,而fetch会立即拒绝这个 URL。结果start --server-url proxy.test:8443会等满--timeout,然后报告一个实际已经 UP 的服务没有起来。顺着同一条路径排查,又发现两种结果相同的情况:URL 带凭据(Request cannot be constructed from a URL that includes credentials),以及 Fetch 标准屏蔽的端口(bad port)。屏蔽端口也可能来自解析器本身的输出,例如server.port=6000。这几种情况下旧的health()都把错误吞掉了,运维只能看到超时。证书不受本机信任(self-signed certificate)时,同样是这样无声地失败。评审测试计划
如何验证
node --test scripts/tests/managed-agent-upgrade.test.mjs→ 67/67。refuses only the URLs fetch refuses固定了每种拒绝及其措辞,并保证列表与实际一致:fetchRefusal()拒绝的每个 URL(1–65535 中的 82 个屏蔽端口、两种 scheme、两种凭据写法),真实fetch都必须以bad port、unknown scheme或凭据TypeError拒绝。这些拒绝都发生在建立连接之前。start refuses listeners it cannot reach before it starts anything新增了解析器给出端口 6000 的情况,以及--server-url取proxy.test:8443、http://admin:secret@…、http://…:10080/的情况。这些都会被拒绝,两个 unit 均保持 inactive。verify says what the health endpoint answered instead of UP覆盖了HTTP 404、HTTP 503, status UP、带 HTML 正文的HTTP 502、HTTP 200, terminated、self-signed certificate,以及只带ECONNREFUSED代码的AggregateError。证据(修改前后)
在 Node 22.22.2 上实测
fetch对每种 URL 的处理(URL 后拼接/actuator/health):URL.canParse(旧检查)fetch的拒绝原因proxy.test:8443unknown scheme--timeout,报 "did not report UP"is not an http or https URLhttp://u:p@127.0.0.1:…Request cannot be constructed from a URL that includes credentials--timeoutcarries a user name or password, so fetch refuses ithttp://127.0.0.1:6000bad port--timeoutis on port 6000, so fetch refuses to dial ithttps://…(自签名)self-signed certificate… (the last answer: self-signed certificate)http://localhost:39999(端口未监听)AggregateError,code 为ECONNREFUSED,message 为空is not UP: ECONNREFUSED这 82 个屏蔽端口取自 Node 22 二进制所带 undici 中的
badPorts列表,与 Fetch 标准一致。设置NODE_EXTRA_CA_CERTS=<该 CA>后,同一次探测的自签名失败变为200 {"status":"UP"}。变异矩阵(17 个单点变异,
scripts/tests/managed-agent-upgrade.test.mjs):17/17 被测试拦住。每个变异单独去掉或改动以下一处:cause回退链的两段;status详情、成功与非成功状态下 JSON 解析失败的两个分支,以及 UP 必须伴随成功状态码的判断(此前没有测试守住);start超时提示和verify行中的探测结果;评审第 1 轮(
13157b7c96)。start以前只用new URL()检查qwen.managed-agent.harness.base-url,所以proxy.test:8443这类不透明取值会被解析成主机和端口都为空的 URL,start随后等满--timeout,等一个空主机的 80 端口开始监听。现在start在启动任何 unit 之前,就拒绝不是http或https的 Harness URL;反正服务端 preflight 的harness行之后也会判它失败。这里不适用fetchRefusal():Harness 是通过 TCP connect 访问的,fetch屏蔽的端口照样能连上。fetch去访问一个没有监听的端口,期望得到connect ECONNREFUSED 127.0.0.1:<port>,因此回退链读取的cause.message来自真实错误。自签名证书和多地址ECONNREFUSED两种形状在套件里仍是构造出来的(真实证书需要把私钥放进仓库);这两种都已在 Node 22.22.2 上实测,见上表。cause既无 message 也无 code(triage 意见 1)。 保持不变。这里实测过的真实fetch失败都至少带其中之一;两者都没有时,除了fetch failed也没有别的可说,而打印的正是这句。评审第 2 轮(
a25a76d2a6)。start的最后一次应答(验证发现 1)。waitFor给最后一次探测的预算是截止时间剩下的Math.max(deadline - now, 1),过了截止时间就只有 1 毫秒,所以面对真实端点时,这次探测在任何应答到达之前就会超时,start的超时提示于是报告The operation was aborted due to timeout,而不是端点一直在返回的HTTP 503, status DOWN。套件没发现,是因为夹具里的fetch忽略了 signal。现在,预算被截止时间截到 5 秒上限以下、并因此超时的探测,不再覆盖之前的应答;用满自身 5 秒才超时的探测仍会覆盖,因为这时端点确实不再应答。verify不变:它只用全部预算探测一次。fetch现在会 await 应答函数,因此测试可以模拟一个按真实时钟 50 毫秒后才应答、并遵守 abort signal 的端点:四次探测中最后一次超时,提示仍是HTTP 200, status DOWN。第二个用例先应答一次,之后在 5 秒上限处超时,提示给出的是超时。503 {"status":"DOWN"},用真实fetch和真实时钟运行start --server-url … --timeout 1和2,每组 8 次:修复前 6/8 次提示的是 abort;修复后 8/8 次都是HTTP 503, status DOWN。http://127.0.0.1:70000/%给出is not a URL,不带 zone 提示,因此把正则改回/%/现在会失败。<=、去掉"已有应答"条件、timedOut恒为假、timedOut改按AbortError判断,以及把 zone 正则改回旧版。合计 26/26。评审第 3 轮(
80d7e70e3d)。fetch就会 resolve。所以响应体被截止时间卡住时,是response.json()抛出同样的TimeoutError(已在真实 socket 上实测,Node 22.22.2)。这个分支以前没有给出timedOut,于是一个被截止时间截短的探测,会把之前的HTTP 503, status DOWN覆盖成HTTP 200, The operation was aborted due to timeout。现在读取响应体的分支也会给出timedOut。真实时钟实测:真实端点第一次返回 503,之后发出200响应头再卡住(--timeout 3,每组 4 次)。修复前最后的应答 4/4 次是 abort,修复后 4/4 次是HTTP 503, status DOWN。timedOut这一半(验证发现 2)。 已用测试守住。"最后应答"测试新增两个真实 socket 用例。一个是响应体卡住。另一个是端点先返回 503 再关闭:下一次探测得到connect ECONNREFUSED 127.0.0.1:<port>,即使这次探测的时间也被截止时间截短了,它仍会覆盖之前的应答。去掉probe.timedOut &&现在会让测试失败。含这两个用例的测试重复跑了 20 次,全部通过。--timeout 6的第二次探测只剩约 4999 毫秒,先到的是截止时间。规则本身不变,测试用的假时钟钉住了恰好 5000 毫秒这个边界。timedOut、timedOut恒为假,以及判断条件去掉probe.timedOut。第 2 轮的 6 个判断条件变异和 zone 变异重跑后,仍全部被拦住。合计 29/29。评审第 4 轮(
d8e6c1bb5f、5c18f44efa、0d44ff8455、8ee2ce3b26)。80d7e70e3d的评审(R1-1 至 R1-5),已在d8e6c1bb5f和5c18f44efa中修复。U+FFFD,端点无法移动光标、拆开一行或写剪贴板。已在真实 socket 上用测试钉住。--server-url一样点明 IPv6 zone。start把保留的值标为the last answer。verify的 URL 拒绝已用测试钉住。closes在t.after中关闭。qma-e2e-*unit、MySQL 8.4.6,以及接假模型的 Hosted Harness。每个场景分别用main的升级脚本和本分支的脚本各跑一次:mainstart、verify --turnapplication.yml中server.port: 6000(Spring 正常监听)verify同样拒绝--server-url localhost:<port>--server-url http://ops:secret@…verify在 session 行打印出密码***localhost:<port>http://[fe80::1%eth0]:<port>{"status":"DOWN"})--timeout取 10、13、17 时都给出(the last answer: HTTP 503, status DOWN);"is not UP: HTTP 503, status DOWN"NODE_EXTRA_CA_CERTS后start和verify --turn通过NODE_EXTRA_CA_CERTS后start和verify --turn通过(the last answer: HTTP 502);"is not UP: HTTP 502"start和verify --turn都通过0d44ff8455中修复。--server-url带密码时,会把密码打印出来。现在显示为http://ops:***@127.0.0.1:<port>/。verify的 session 和 turn 行只说 "fetch failed",而上面的 health 行已给出原因。现在 API 读取失败时给出同样的 cause。0d44ff8455换进同一环境后重跑:P0 通过,两处凭据拒绝都已遮蔽,所有输出中都没有密码,TLS 场景的 session 行给出证书错误。0d44ff8455的概览),已在8ee2ce3b26中修复。printable()对端点返回的值调用String()。对于自带不可调用toString的合法 JSON 对象,例如{"status":{"toString":1}},String()会抛错,而health()不在 try 中。在测试环境上,verify还没打印 health 行就以Cannot convert object to primitive value退出,start在第一次探测时就停止了。现在这类值显示为它的 JSON。在同一环境上,verify打印is not UP: HTTP 200, status {"toString":1},start等满--timeout后把它作为最后一次的应答。测试钉住了这两处,以及同样形状的 API 错误原因;改回String()会让两个测试失败。check的 database 行都会 WARN "cannot compare the Flyway scripts (no Flyway script found in …)"。迁移脚本挪进了BOOT-INF/lib/qwen-managed-agent-persistence-*.jar,而扫描只读BOOT-INF/classes/。已在 fix(managed-agent): find the Flyway scripts in the module jar the server ships them in #16175 中单独修复。withoutPassword改为空操作;拒绝提示不再调用它;API 读取不取 cause;cause 不净化(补了一个 cause 带控制字节的用例后被拦住);API 的错误原因、无法读取响应体的信息、Session ID,以及通过和失败的 turn 行各自不净化;以及把自动修复的净化和 zone 原因还原。加上把printable()改回String()的变异,合计 41/41。评审第 5 轮(
13cd545086)。 bot 第 2、3 轮针对8ee2ce3b26提出 6 条发现,都归结为两个共同根因,已从根源修复:printable()对任何解析出的 JSON 值都不再抛错,嵌套深到JSON.stringify()无法递归的 status 显示为[unprintable]。… (N characters);先替换控制字节再截断,且不会截在代理对中间。withoutCredentials()遮蔽整个用户信息,因此用户名位置上的 token 也会被遮蔽;URL 无法解析时按文本遮蔽;Harness 的拒绝提示也用它。start和verify检查健康端点,只有读取 API 的verify --tenant才检查 API 的 URL。API 在 fetch 拒绝的端口上、健康端点在独立 management 端口时,不再挡住start。harnessOrigin检查,即不带用户信息、query 或 fragment 的 http(s) origin,因此start会在重启正在运行的 Harness 之前就拒绝。8ee2ce3b26对比本版:8ee2ce3b2613cd545086server.port: 6000,另设management.server.portstart0.9 秒拒绝start在 management 端口上报告 UP;verify通过;verify --tenant因 API 端口拒绝base-url为…/?tenant=acme--server-url http://admin:secret@127.0.0.1:70000"http://***@127.0.0.1:70000" is not a URLverify只打印Maximum call stack size exceeded;start同样,且控制面留在运行状态is not UP: HTTP 200, status [unprintable];start给出最后一次的应答,并说明控制面保持运行… (100000 characters)verify --turn评审第 6 轮(
c80d768a42、e51f95f2e2)。 bot 第 4 轮针对13cd545086提出 4 条发现,并延后 1 条。其中 R4-1 和 R3-2 都源于脚本把服务端已经做出的判断又重做了一遍,所以脚本改为直接采用服务端的结论:verify先确定 session 行,再检查监听地址,所用的解析结果来自listeners()本来就会跑的那次解析器。只有当该行确实要读 API 时才检查 API URL,条件是:给了--tenant、auth mode 为open,并且给了--actor时服务端配置了可信 actor header。health URL 始终会检查。ResolvedConfiguration输出harnessOrigin,即ManagedAgentPreflight.harnessOrigin(现为包级可见)对服务端所解析的、未经 trim 的取值给出的判定;同时也原样输出这个取值。start在重启 Harness 之前依据该判定拒绝执行,覆盖了带下划线的主机名、空用户名、带首尾空白的取值,以及java.net.URI拒绝的其他任何形式。无法解析配置时,只适用脚本自己能说明的原因。@之前的内容全部遮蔽,开头的//保留在原位。能解析且带 authority 的取值原样返回。printable()单次遍历计数码点,只保留开头部分,输出逐字节不变。printable(),所以很长的 Session ID 不会把这一行撑长。e51f95f2e2打包 alpha.101,经check、stop、backup、install安装在 alpha.100 之上;把上一个 head 的脚本换进同一发行包的副本作对照:13cd545086e51f95f2e2verify --tenant e2everify --tenant e2e --actor alice--actor needs a trusted actor headerbase-url为' http://…:54787 '、http://@…:54787或http://qwen_harness:54787qwen_harness则等满 10 秒)--server-url https://svc:Pa/ss@…、…:Pa?ss@…、//svc:s3cret@…https://***@…、//***@…--max-old-space-size=160FATAL ERROR: … heap out of memoryverify和start都崩溃,start是在启动服务端之后崩溃的verify --turnResolvedConfigurationTest14/14,ManagedAgentPreflightTest82/82,checkstyle 通过。评审第 7 轮(
3a556b9ab5、9b8a548e3c、948e7484b5)。 bot 第 5 轮针对aa53b9833e提出 1 条 Critical,并延后 2 条;之后两轮独立审查又发现了更多问题。全部已修复:ManagedAgentPreflight.harnessUrlVerdict与harnessCheck放在一起,ResolvedConfiguration把它的判定作为harnessOrigin输出。skip:此时 harness 行在读取base-url之前就返回,BrokerSecurity提前返回,连接器 bean 以enabled为条件,所以没有任何地方读取这个值。skip,第一个提交照做了。但HarnessConfiguration用同一个base-url构造每个 pool 成员的QwenHostedHarnessConnector,这个连接器只接受带主机名、且不带用户信息、query 或 fragment 的 http(s) URL;连接器抛错的成员会被HarnessPoolConnector.refresh()丢弃。于是这样的 pool 报告 UP,却不接收任何 Session。true或skip,start不再提其他要求;对false,它写明原因。用户信息和 query/fragment 两条规则本是同一规则的副本,现在只用来说明false判定的具体原因。start要在这个主机和端口上等待。start拒绝场景的循环中,每次运行的输出都检查是否泄露密码,而不只是最后一次。verify在使用 API 返回的任何值之前先检查类型。正则、encodeURIComponent()、Number()、遍历和.length都会先做隐式转换,遇到{"toString":1}或嵌套 20000 层的数组就会抛错,printable()来不及说明实际返回了什么。现在:.或..)。terminal: true才结束 turn。check、stop、backup、install安装在上一个版本之上;每一臂在其版本处于已安装状态时运行。因为 main 的 refactor(managed-agent): align shared MySQL schema conventions #16143 原地改写了V1__managed_schema.sql,数据库重建过一次空库。3a556b9ab5(alpha.102)base-url为' http://…:54787 '或…/?tenant=acme:startskip;SKIP harness disabled;UPbase-url带首尾空白或为http://qwen_harness:54787qwen_harness上等满 30 秒base-url"harnessOrigin":"true";UPbase-url带首尾空白server.env的PATH中没有java),…/?tenant=acme或http://svc:s3cret@…{"toString":1}/ 嵌套 20000 层FAIL … Cannot convert object to primitive value/Maximum call stack size exceededFAIL the API answered a Session without a string id ({"toString":1})/([unprintable])7;之前先有一个null事件PASS … ended with 7;Cannot read properties of nullFAIL … ended with 7;PASS{"data":[0]};items 为{"data":{"length":2}};events 为{"data":{}}WARN … no Session;PASS … 2 item(s);object is not iterableFAIL … without a string id (0);FAIL … answered no data list ({"length":2});… ({})[{"id":"s1"}];Session id 为..;"terminal":"false"WARN … no Session;/v1/agents返回 404;PASSFAIL … answered no data list (…);FAIL … whose id ".." names no route;FAIL … no terminal event within 5sverify --tenant e2e --turnResolvedConfigurationTest15/15、ManagedAgentPreflightTest82/82、HarnessConfigurationTest2/2,在合入 main 后的代码上同样通过。judgesTheHarnessUrlAsTheConnectorThatDialsItDoes检查 13 个 URL 的判定是否与真实连接器能否构造一致。buildsEachPoolMembersConnectorFromTheSingleBaseUrl经由真实工厂构造 pool:base-url正常时接收 1 个成员,带首尾空白或带下划线时为 0;连接器不再检查 URL 时,该测试失败。null事件、报错前缀、terminal、点号 id。Java 有 5 个:去掉 enabled 判断、去掉又加回 pool 判断、把skip当作true、去掉连接器的 URL 校验。评审第 8 轮(
3b67b6ec1d)。 bot 第 6 轮针对8529a681e8提出 1 条 Critical,维护者对814b121014的评审沿用了这一条;bot 另外延后了 4 条。ImportOrder检查,现已排好序;mvn -o -B -pl server,verification checkstyle:check通过。--server-url。 路径是拼接在它后面的,http://…/?q实际探测的是/?q/actuator/health(在真实 listener 上看到);带 fragment 时路径整个丢失。id的 Session 条目按原样显示;health 行在 JSON 解析出错路径上的净化已有测试钉住。harnessUrlVerdict没有纳入BrokerSecurity的明文传输策略。那是由 preflight 的validation行报告的启动策略,而不是 URL 形态规则。ResolvedConfigurationTest15、ManagedAgentPreflightTest82、HarnessConfigurationTest2、ClassSizeRatchetTest1 全部通过,checkstyle 通过;新增 4 个变异,全部被拦住,合计 107/107。测试平台
Linux x86_64 + Node 22.22.2;Linux aarch64 + Node 24.14.0(套件同样 67/67,说明屏蔽端口列表与两个运行时一致)。
环境(可选)
第 4 到第 7 轮还在真实的 systemd 主机上运行过。该主机有控制面和 Harness 的 systemd 257 unit、MySQL 8.4.6、nginx 和一个脚本化模型,所用的 reference 发行包由本分支打包。升级命令运行在 systemd 下,只支持 Linux。
风险与范围
bad port),而不是事先拒绝。如果标准删掉某个端口,一致性测试会失败。ResolvedConfiguration多输出一个键,并原样输出 Harness URL;ManagedAgentPreflight新增包级可见的harnessUrlVerdict,harnessOrigin也改为包级可见。这个判定依赖服务端的两个事实,现在都有测试钉住:连接器的 URL 规则(ResolvedConfigurationTest),以及 pool 用同一个base-url构造每个成员(HarnessConfigurationTest)。PR CI 不跑 Java 测试,所以上面三个 Java 测试类是在本地跑的。main 上ClassSizeRatchetTest因JournalCommit(886 行,超过上限 880)失败的问题已由 fix(managed-agent): restore JournalCommit under its class-size ratchet #16323 修复并已合入本分支,在当前 head 上通过。port != 0子句是死代码,但它逐字对应 Spring Boot 的ManagementPortType条件,留着方便读者对照。另一条认为serverBaseUrl()已无人调用,但它仍是listeners()里读server.env的回退,并有自己的测试。--check的问题继续由 Managed Agent --check ignores the configuration files the server reads from its working directory #16057 跟踪。关联 Issue
#16051 的 follow-up。相关:#16057(本 PR 未处理)。