Skip to content

fix(managed-agent): verify ambiguous Linux workspace birth times - #14505

Draft
yiliang114 wants to merge 5 commits into
mainfrom
codex/fix-14453-native-birth-time
Draft

yiliang114 wants to merge 5 commits into
mainfrom
codex/fix-14453-native-birth-time

Conversation

@yiliang114

@yiliang114 yiliang114 commented Oct 17, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does

Allows a newly created Linux Workspace root to register when its storage marker is published in the same filesystem clock tick. Ambiguous creation timestamps are accepted only when GNU stat confirms the same device, inode and full nanosecond birth time.

Why it's needed

The JDK can substitute mtime when birth time is unavailable, so the existing guard rejects equal creation and modification times. A real birth time can also equal mtime immediately after directory creation. The marker publication can therefore reject a valid production Workspace. This change preserves refusal when native birth evidence is missing or inconsistent, without sleeps or timestamp mutation in the identity reader.

Reviewer Test Plan

How to verify

On Linux with JDK 21 and filesystem birth-time support, verify that a registered root remains valid when its mtime is explicitly restored to its real birth time, including after constructing a second guard. Later mtime changes must remain valid, while marker tampering and a replacement directory carrying a copied marker must still be refused. Exercise public Workspace creation, a bounded Turn and close on the same build before accepting the user-facing fix.

Evidence (Before & After)

The issue's original Linux failures are reporter evidence. The added native regression forces and reads back an equal birth-time/mtime pair: the previous guard rejects that state, while the candidate requests exact native evidence. The complete regression has not been executed in this worktree.

A remote Linux filesystem probe observed a real new directory with equal birth time and mtime, retained that equality after marker publication, and supplied its actual GNU stat output to the candidate's verbatim extracted parser on remote Darwin JDK 21. The parser harness passed 10/10 cases, including device/inode/nanosecond mismatches, unknown birth time, malformed output, invalid calendar date and epoch refusal. A separate actual Linux x86_64 Temurin 21.0.12.1 run then executed the exact candidate birth-time methods: 8/8 assertions passed, including natural and forced equal timestamps, Java NIO/GNU stat nanosecond agreement, real ProcessBuilder execution and mismatched device/inode refusal. The temporary JDK archive was verified against its official SHA256 before execution. Full JDBC registration, public-flow verification and screenshots remain unverified.

Completed static review of this exact candidate found no blocking issue. Formatting and whitespace checks passed for the changed documents and patch. No local Java/Maven/npm build was run, as requested. Full module, Linux/MySQL and Hosted acceptance are pending.

Tested on

OS Status
🍏 macOS Remote OpenJDK 21.0.12.1: extracted parser only, 10/10 passed; full module unverified
🪟 Windows Not tested; native Linux branch only
🐧 Linux Remote Linux JDK 21 exact native methods: 8/8 passed; full registration and MySQL unverified

Environment (optional)

Existing remote Linux host with a temporary checksum-verified official Temurin 21 JDK, plus remote macmini JDK 21. Temporary probe directories were removed; the verified named Linux JDK cache is retained for this active acceptance work. No services or deployment were modified.

Risk & Scope

  • Main risk or tradeoff: only ambiguous Linux timestamps invoke GNU stat at /usr/bin/stat, with a five-second process budget and a 256-byte output limit. Missing executables or unavailable birth time continue to fail closed. Some identity checks run while authority locks are held, as with existing filesystem/marker reads and the macOS helper; the additional ambiguous-Linux probe latency has not been measured under contention.
  • Not validated / out of scope: full module verification, native Linux Java registration, MySQL and public Hosted acceptance remain unverified. No sleep, identity cache or persisted-format change is introduced.
  • Breaking changes / migration notes: none; existing stored identity bytes remain unchanged.

Design: English, 简体中文.

Linked Issues

Fixes #14453

Refs #12380

中文说明

本 PR 的改动

允许新建 Linux Workspace 根目录在存储 marker 与目录创建发生于同一文件系统时钟 tick 时完成注册。只有 GNU stat 确认 device、inode 以及精确至纳秒的出生时间均相同时,才接受存在歧义的创建时间。

修改原因

缺少出生时间时,JDK 可能使用 mtime 替代,因此原有 guard 拒绝创建时间与修改时间相等的目录。真实出生时间在新建目录时也可能等于 mtime,导致发布 marker 时拒绝合法的生产 Workspace。本次在原生证据缺失或不一致时继续安全拒绝,不通过 sleep 或在身份读取器中修改时间戳绕过问题。

评审验证计划

验证方式

在支持文件系统出生时间的 Linux/JDK 21 上,将已注册根目录的 mtime 显式恢复为实际出生时间,再验证原实例和新 guard 实例均可接受该目录。后续 mtime 变化应继续允许;marker 篡改以及携带复制 marker 的替换目录应继续拒绝。用户可见修复验收还需在同一构建上完成公开 Workspace 创建、有界 Turn 和关闭流程。

修改前后证据

issue 中的原始 Linux 失败归属于报告者。新增原生回归用例会强制制造并读回出生时间与 mtime 相等的状态:旧 guard 拒绝该状态,候选实现则要求精确原生证据。本工作树尚未执行完整回归用例。

远程 Linux 文件系统探测观察到新目录的真实出生时间与 mtime 相等,发布 marker 后保留该相等状态,再将实际 GNU stat 输出交给远程 Darwin/JDK 21 上从候选代码逐字提取的解析器。解析检查 10/10 通过,包含 device、inode、纳秒不匹配、出生时间未知、格式错误、非法日期及 epoch 拒绝。另一次实际 Linux x86_64/Temurin 21.0.12.1 检查运行了逐字提取的候选出生时间方法,8/8 断言通过,覆盖自然及强制相等时间戳、Java NIO/GNU stat 纳秒一致性、真实 ProcessBuilder 调用以及 device/inode 不匹配拒绝。执行前已按官方 SHA256 校验临时 JDK 归档。完整 JDBC 注册、公开流程验收和截图仍未验证。

此精确候选的完整静态审查已结束,没有阻塞问题。变更文档的格式及补丁空白检查通过。按要求没有执行本地 Java/Maven/npm build;完整模块、Linux/MySQL 与 Hosted 验收仍待执行。

验证平台

OS 状态
🍏 macOS 远程 OpenJDK 21.0.12.1:只验证提取的解析器,10/10 通过;完整模块未验证
🪟 Windows 未测试;仅修改原生 Linux 分支
🐧 Linux 远程 Linux/JDK 21 精确原生方法:8/8 通过;完整注册和 MySQL 未验证

环境

使用现有远程 Linux 主机与临时、经过官方校验的 Temurin 21 JDK,以及远程 macmini/JDK 21。临时探测目录已清理,保留具名且已校验的 Linux JDK 缓存用于当前验收工作,未修改服务或部署。

风险与范围

  • 主要风险与取舍:仅在 Linux 时间戳存在歧义时调用 /usr/bin/stat,进程预算五秒、输出上限 256 字节。程序缺失或出生时间不可用时继续安全拒绝。部分身份检查会在持有权威锁时执行,与现有文件系统/marker 读取和 macOS helper 一致;新增 Linux 歧义探测在争用下的延迟尚未测量。
  • 未验证及范围外内容:完整模块、原生 Linux Java 注册、MySQL 和公开 Hosted 验收仍未验证;没有引入 sleep、身份缓存或持久化格式变化。
  • 不兼容变更及迁移:无;保持现有持久化身份字节。

设计:English、简体中文。

关联 Issue

Fixes #14453

Refs #12380

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@yiliang114

Copy link
Copy Markdown
Collaborator Author

Verification report

The candidate permits an ambiguous Linux Workspace birth time only when native device, inode and full nanosecond birth evidence match. This report records narrow remote observations; full registration and Hosted acceptance remain unverified.

  • Remote Darwin OpenJDK 21.0.12.1 executed the verbatim extracted formatter/parser: 10/10 checks passed, exit 0.
  • An actual remote Linux GNU stat probe observed equal birth time/mtime on a new directory and retained equality after marker publication plus explicit mtime restoration. Its full native output was accepted by the parser harness.
  • Rejected inputs included changed device/inode/nanoseconds, unknown birth time, epoch, invalid calendar date and malformed field count.
  • Formatting, reciprocal design references and patch whitespace checks passed. Consolidated source review/ponytail found no blocking issue; the completed full static review gate found no blocking issue.
  • A subsequent actual Linux x86_64 Temurin21.0.12.1 execution of the verbatim candidate native methods passed 8/8 assertions, including NIO/stat nanosecond agreement, natural/forced equality and real ProcessBuilder device/inode refusal. The official JDK checksum was verified before execution.
  • Not executed: complete Workspace/JDBC registration, marker/root replacement regression, full Java module, MySQL, public create/Turn/close or Hosted acceptance. No local build was run. Original Linux suite failures belong to the issue reporter.

中文验收记录

实际远程证据限于解析器与文件系统探测:Darwin/JDK 21 上逐字提取的候选解析逻辑 10/10 通过;Linux 原生 stat 观察到出生时间与 mtime 相等,实际输出可被该解析器接受。设备号、inode、纳秒及不可用/畸形证据均拒绝。

后续实际 Linux/JDK 21 原生方法检查 8/8 通过,验证了 NIO/stat 纳秒一致性、真实 Java 子进程调用与身份不匹配拒绝。完整 Workspace/JDBC 注册、目录替换保护回归、MySQL、公开创建/Turn/关闭和 Hosted 验收均未执行,没有运行本地 build。集中源码审查与 ponytail 无阻塞,完整静态 gate 已结束,没有阻塞问题。不能将这些窄范围证据写成生产链路验收通过。

Retained observation record

{
  "provenance": "Retained test-engineer report from this task. It is an observation record, not a full module or Hosted acceptance log.",
  "candidate_source_sha256": "cfc797960337a88e22c0598a8999e45695d4be29fd7d4a0b80c21bb31bcdded2",
  "extracted_formatter_and_method_sha256": "fe3b5c4353aa31fd05c30ae4106c38f15d2e7f1842c94567633e2b21564652d7",
  "harness_sha256": "e26f5b38ab35429012f369aad17ddd7283e599301ed15ed59147db2efd9d3e51",
  "remote_java_environment": "codex-macmini, Darwin, OpenJDK 21.0.12.1",
  "method": "Formatter and verifiedNativeBirthTime copied verbatim into temporary remote Java harness",
  "results": {
    "passed": 10,
    "failed": 0,
    "stdout_final": "RESULT 10/10 passed",
    "ssh_exit": 0
  },
  "cases": [
    "matching nine-digit nanoseconds",
    "different device refused",
    "different inode refused",
    "same-second different nanos refused",
    "unknown birth refused",
    "invalid calendar date refused",
    "extra field refused",
    "missing field refused",
    "epoch refused",
    "actual Linux GNU stat output accepted"
  ],
  "linux_probe": {
    "environment": "qwenbot Linux Python3/GNU stat, no JDK on PATH",
    "before": "66307|14656098|2026-10-17 17:32:15.448074816 +0000|2026-10-17 17:32:15.448074816 +0000",
    "after_marker_and_forced_equal_mtime": "66307|14656098|2026-10-17 17:32:15.448074816 +0000|2026-10-17 17:32:15.448074816 +0000",
    "ssh_exit": 0,
    "cleanup": "temporary directory deleted"
  },
  "limits": [
    "Darwin parser10/10 and Linux native-method8/8 are distinct evidence",
    "Full WorkspaceStorageGuard registration/JDBC/root replacement/module/MySQL/Hosted acceptance NOT RUN",
    "No local build/test/install or deployment change",
    "Remote probe source/log directories were removed; retained observations are not a full raw module archive"
  ],
  "linux_jdk_preflight": {
    "result": "environment-blocked",
    "host": "qwenbot",
    "host_standard_jvm_paths": "No java/javac under /usr/lib/jvm or /opt within bounded search",
    "existing_image": "qwen4-allcase-tools:20261014 checked once with --pull=never --network=none --read-only; no Java/Javac",
    "changes": "No install, pull or host/service change",
    "acceptance": "Linux NIO -> ProcessBuilder registration path remains UNVERIFIED"
  },
  "native_linux_verification": {
    "provenance": "Actual read-only test-engineer run on qwenbot, retained observation report",
    "result": "8/8 passed; remote exit 0",
    "java": "Temurin21.0.12.1+1-LTS, Linux x86_64",
    "jdk_path": "/tmp/qwen-managed-jdk21-TMtjIo/jdk",
    "official_release": "https://github.com/adoptium/temurin21-binaries/releases/tag/jdk-21.0.12.1%2B1",
    "jdk_archive_sha256": "ce79869e1307ed8ee1e2baa86a412b1eb5b75d10a01006d788a6f968bcfaee94",
    "official_checksum": "verified before Java execution",
    "candidate_source_sha256": "cfc797960337a88e22c0598a8999e45695d4be29fd7d4a0b80c21bb31bcdded2",
    "exact_members": [
      "LINUX_BIRTH_TIME_FORMAT",
      "linuxBirthTime",
      "verifiedNativeBirthTime",
      "verifiedBirthTime"
    ],
    "extracted_members_sha256": "f58cfeb3d273b1413964ac55a857a718ed77899a5f9306d78b18abbe82197b8f",
    "harness_sha256": "b08b5bffba69702238ed37f95c14d3ae0785950ed25f2ecc33a388adc8ff7ea2",
    "mkdir": {
      "dev": "66307",
      "ino": "39780184",
      "nio_creation": "2026-10-17T18:30:49.571592795Z",
      "nio_modified": "2026-10-17T18:30:49.571592795Z",
      "stat": "66307|39780184|2026-10-17 18:30:49.571592795 +0000"
    },
    "after_marker": {
      "nio_creation": "2026-10-17T18:30:49.571592795Z",
      "nio_modified": "2026-10-17T18:30:49.588592805Z"
    },
    "forced_equal": {
      "nio_creation": "2026-10-17T18:30:49.571592795Z",
      "nio_modified": "2026-10-17T18:30:49.571592795Z"
    },
    "checks": [
      "actual NIO dev/ino/nanos match stat",
      "natural equal timestamps accepted",
      "marker preserves birth",
      "marker state accepted",
      "forced equality read back",
      "real ProcessBuilder equal case accepted",
      "wrong dev refused",
      "wrong inode refused"
    ],
    "limits": [
      "Exact methods only; no WorkspaceStorageGuard JDBC registration",
      "No full marker/root replacement/module/MySQL/Hosted acceptance",
      "One Linux/JDK/filesystem combination only"
    ],
    "cleanup": "Only verified named JDK cache retained; harness and temporary roots removed; no host configuration or local build"
  }
}

Candidate and review

Commit: 79719e92b83b484fbbba96dd812d62c386f8c2e0. Completed expert static review of all four candidate files: no blocking finding. Non-blocking suggestions concern process-helper reuse, failure-path test seams and diagnostics. The bounded probe latency under authority locks is disclosed and remains unmeasured. Full module and public Hosted acceptance remain unverified.

提交为 79719e92b83b484fbbba96dd812d62c386f8c2e0。四个候选文件的完整 expert 静态审查已结束,没有阻塞发现。非阻塞建议涉及进程 helper 复用、失败路径测试入口及诊断文字;持锁期间的有界探测延迟已披露,尚未测量。完整模块及公开 Hosted 验收仍未验证。

@yiliang114 yiliang114 added the autofix/takeover Summon the autofix loop to manage this PR (remove to release; needs triage+) label Oct 17, 2026
@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator

🤝 Takeover engaged: the autofix loop now manages this PR — it will address new review feedback and resolve base conflicts until the label is removed or the round cap is reached. Remove the autofix/takeover label (or comment @qwen-code /takeover stop) to release.

中文说明

🤝 已接管:autofix 循环现在管理此 PR —— 将持续处理新的评审反馈与 base 冲突,直到移除标签或达到轮次上限。移除 autofix/takeover 标签(或评论 @qwen-code /takeover stop)即可释放。

@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator

🔀 Base updated: red check(s) [web-shell E2E Smoke (ubuntu-latest, Node 22.x)] pass on current main — merged current main via update-branch; CI will re-run.

中文说明

🔀 已更新 base:红色检查 [web-shell E2E Smoke (ubuntu-latest, Node 22.x)] 在当前 main 上通过 —— 已通过 update-branch 合入当前 main,CI 将重新运行。

@qwen-code-dev-bot

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

Copy link
Copy Markdown
Collaborator

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

中文说明

✅ AutoFix 第 2 轮已完成 —— 查看运行。本轮报告见下方。

… lock-order audit (#14505)

#14461 added hasLiveTurn and markTurnRecoveryBlocked to
ManagedAgentStore without updating the pinned turn-row accessor set in
SessionRowLockOrderTest, so the exact-set assertion fails on any tree
containing both — including this PR's merge commit, whose fast tier is
red because of it. hasLiveTurn is a read-only helper and
markTurnRecoveryBlocked is fenced by the live dispatch lease rather than
the session-row lock, and the audit finds no lock-ordering violation in
either, so both belong in the pinned accessor set.
@yiliang114

Copy link
Copy Markdown
Collaborator Author

CI triage for head 2dd543ba126769cce09966efd87cedcc6b142914: the Java fast lane ran 4,580 tests with one failure, in SessionRowLockOrderTest.mutationEntriesAcquireTheSessionRowLockBeforeAnyTurnRowAccess. The exact failure is an accessor inventory mismatch: unexpected hasLiveTurn and markTurnRecoveryBlocked. The preceding lock-order violation assertion passed.

Both the store and this audit test are byte-identical to the merge’s main parent 39c237af3b9dd994b502e82809652f7bcf086f46; the four birth-time candidate files are unchanged from 79719e9. The two accessors came from #14461. The narrow repair is to add their names to the existing exact accessor set, retaining the lock-order and locker assertions, then verify that test. This does not call for changing the production lock policy.

The takeover bot is already active, so this records the diagnosis for its repair rather than starting a concurrent push. Failing job. No local build was run.

中文说明

当前 head 的 Java 快速检查执行 4,580 项测试,只有一项失败:锁顺序审计发现实际访问器集合多了 hasLiveTurn、markTurnRecoveryBlocked,但预期清单尚未同步。此前的锁顺序违例断言已通过。

store 和审计测试与合入的 main 父提交 39c237a 逐字节相同,四个出生时间候选文件也保持不变。这两个方法来自 #14461。最小修复是仅把两个名称加入既有精确集合,保留锁顺序与 locker 断言,再做该测试的定向验证,不调整生产锁策略。

该 PR 已有活跃 takeover bot,此评论记录定位,供同一个修复执行者处理,避免并行推送。没有运行本地 build。

@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator

🤖 Addressed the latest review feedback (round 1/100). What changed, and what I pushed back on: · 已处理最新评审反馈(第 1/100 轮)。改动内容与我反驳保留之处如下:

Autofix round summary — PR #14505

Feedback dispositions

  1. Failed check: SDK Java (fast) / ubuntu-latest / Java 21 — Fixed. Root-caused and repaired; see below.
  2. Failed check: Managed Agent fast tier — Fixed by the same change. That check is the gate job mirroring the SDK Java suite result; it was red only because the suite was red.
  3. [ic:6239186529] @yiliang114 verification report — Acknowledged; no code action. The report records narrow remote evidence (Darwin parser 10/10, Linux native-method 8/8) and explicitly states the completed static review found no blocking finding. Its non-blocking suggestions (process-helper reuse, failure-path test seams, diagnostics) name no concrete defect, so per the repository's Simplicity First rule they are not worth diff growth in this PR. The report's own caveat stands: full module and Hosted acceptance remain for CI to prove.

Root cause of the red checks

The fast tier's mvn clean test on packages/managed-agent-server failed deterministically in SessionRowLockOrderTest.mutationEntriesAcquireTheSessionRowLockBeforeAnyTurnRowAccess. That test statically audits ManagedAgentStore.java and pins the exact set of members that reach turn rows. Main's #14461 (f110a6b7fa) added hasLiveTurn and markTurnRecoveryBlocked to the store without adding them to the pinned set, so the exact-set assertion fails on any tree containing both. Both files are byte-identical between this PR's head and origin/main (git diff origin/main HEAD on them is empty), i.e. main itself fails this test; the PR's merge commit 2dd543ba12 simply carried the breakage into the branch. Nothing in the PR's birth-time change is implicated — under Temurin 21 the new linuxBirthTime probe and its forced-equality regression behave as designed.

Change (1 commit, +4/−1)

SessionRowLockOrderTest.java: pin hasLiveTurn and markTurnRecoveryBlocked in the turnRowAccessors exact-set assertion, with a short comment noting why the writer needs no session-row lock. Both members are safe under the audit's own rules, verified against their bodies: hasLiveTurn is a read-only SELECT COUNT(*) helper, and markTurnRecoveryBlocked updates ma_turn fenced by the live dispatch lease (dispatch_owner = ? AND dispatch_lease_until >= ?) rather than the session-row lock — the audit's lock-ordering violation check is empty for both, and the lockers exact-set assertion passes without them, confirming they are accessors, not lockers.

Conflict notes

None. --conflict false; no base merge was performed this round.

Local-environment caveats

This sandbox lacks /etc/machine-id and a UTF-8 locale, and its default JDK (/tmp/jdk21, Oracle JDK 21.0.12.1) reports Linux creationTime as mtime (no btime), which produced misleading early failures. All reported Java verification below was run under Temurin 21.0.12.1 (/tmp/jdk/jdk-21.0.12.1+1), matching CI's setup-java distribution. Four suite errors remain locally and are environmental and pre-existing on main: three require /etc/machine-id (absent here, present on CI runners; main reads it identically), and one builds a CJK path under the POSIX locale (InvalidPathException: qwen-context-中文-…). None is in code this PR changed.

Verification

  • npm run build — passed (with COREPACK_HOME=/tmp/corepack-cache; the sandbox HOME is read-only).
  • npm run typecheck — passed.
  • npm run lint — passed. The first local run failed only on git-ignored JaCoCo report JS under packages/sdk-java/qwencode/target/ generated by my local Maven runs; after removing those git-ignored target/ directories (absent from the gate's clean checkout), lint is green.
  • packages/sdk-java/qwencode: mvn clean test (Temurin 21.0.12.1) — 388 tests, 0 failures.
  • packages/managed-agent-server: mvn checkstyle:check checkstyle:check@runtime-broker-checkstyle — 0 violations, both before and after the change.
  • packages/managed-agent-server: mvn -Dtest=WorkspaceStorageGuardTest test — 21 run; the only error is the environmental /etc/machine-id read in nativeRegistrationSurvivesNewGuardAndMtimeChangesButRefusesRootReplacement (that read exists identically on main; the PR's probe path itself passed under Temurin, including the forced mtime==birth equality case).
  • packages/managed-agent-server: mvn -Dtest=SessionRowLockOrderTest test — pre-fix: 1 failure (audit reported hasLiveTurn and markTurnRecoveryBlocked as unpinned); post-fix: 39/39 green.
  • Mutation probes — removing either new pin entry individually re-fails the audit test ("elements were unexpected"); restoring each returns it to green. Both additions are load-bearing.
  • packages/managed-agent-server: full mvn clean test — pre-fix: 4580 tests, 1 failure (the stale pin) + 4 errors; post-fix: 4580 tests, 0 failures, 4 errors — all four the environmental ones listed above.
中文说明

Autofix 本轮总结 — PR #14505

反馈处置

  1. 失败的检查:SDK Java (fast) / ubuntu-latest / Java 21 —— 已修复。 已定位根因并修复,见下文。
  2. 失败的检查:Managed Agent fast tier —— 由同一处修改一并修复。 该检查只是镜像 SDK Java 套件结果的门禁任务;它变红只是因为套件变红。
  3. [ic:6239186529] @yiliang114 的验证报告 —— 已知悉;无需代码改动。 该报告记录了有限的远程证据(Darwin 解析器 10/10、Linux 原生方法 8/8),并明确说明已完成的静态审查没有阻塞性发现。其中非阻塞建议(进程 helper 复用、失败路径测试入口、诊断文字)没有指出任何具体缺陷,按照仓库 Simplicity First 原则,不值得在本 PR 中为此扩大 diff。报告自身的保留意见仍然成立:完整模块与 Hosted 验收仍由 CI 证明。

检查变红的根因

fast tier 在 packages/managed-agent-server 上执行的 mvn clean test 确定性失败于 SessionRowLockOrderTest.mutationEntriesAcquireTheSessionRowLockBeforeAnyTurnRowAccess。该测试对 ManagedAgentStore.java 做静态审计,并精确锁定所有访问 turn 行的成员集合。main 上的 #14461(f110a6b7fa)向 store 添加了 hasLiveTurn 与 markTurnRecoveryBlocked,却没有把它们加入锁定集合,因此任何同时包含这两者的代码树都会在该精确集合断言上失败。这两个文件在本 PR 头部与 origin/main 之间逐字节一致(对它们执行 git diff origin/main HEAD 为空),也就是说 main 自身同样无法通过该测试;PR 的合并提交 2dd543ba12 只是把这个破坏带进了分支。PR 的出生时间改动与此无关——在 Temurin 21 下,新的 linuxBirthTime 探测及其强制相等回归用例均按设计工作。

本次修改(1 个提交,+4/−1)

SessionRowLockOrderTest.java:在 turnRowAccessors 精确集合断言中补充 hasLiveTurn 与 markTurnRecoveryBlocked,并附一行短注释说明该写方法为何不需要会话行锁。对照两个方法体确认它们在该审计自身的规则下是安全的:hasLiveTurn 是只读的 SELECT COUNT(*) 辅助方法;markTurnRecoveryBlocked 对 ma_turn 的更新由存活的分发租约(dispatch_owner = ? AND dispatch_lease_until >= ?)防护,而非会话行锁——审计的锁序违规检查对两者均为空,且 lockers 精确集合断言在不包含它们的情况下通过,确认它们是访问者而非加锁者。

冲突说明

无。本轮 --conflict false,未执行 base 合并。

本地环境注意事项

本沙箱缺少 /etc/machine-id 与 UTF-8 locale,且默认 JDK(/tmp/jdk21,Oracle JDK 21.0.12.1)在 Linux 上将 creationTime 报告为 mtime(无 btime),这在早期造成了误导性的本地失败。下文所有 Java 验证均在 Temurin 21.0.12.1(/tmp/jdk/jdk-21.0.12.1+1,与 CI 的 setup-java 发行版一致)下进行。本地套件仍留有 4 个错误,均为环境性且在 main 上同样存在:三个需要 /etc/machine-id(此处缺失,CI 运行器上存在;main 的读取方式完全相同),一个在 POSIX locale 下构建含中文的路径(InvalidPathException: qwen-context-中文-…)。它们都不在本 PR 改动的代码中。

验证记录

  • npm run build —— 通过(使用 COREPACK_HOME=/tmp/corepack-cache;沙箱 HOME 只读)。
  • npm run typecheck —— 通过。
  • npm run lint —— 通过。首次本地运行只因我本地 Maven 运行生成的、已被 git 忽略的 packages/sdk-java/qwencode/target/ 下的 JaCoCo 报告 JS 而失败;删除这些被 git 忽略的 target/ 目录(门禁的干净检出中本就不存在)后 lint 转绿。
  • packages/sdk-java/qwencode:mvn clean test(Temurin 21.0.12.1)—— 388 个测试,0 失败。
  • packages/managed-agent-server:mvn checkstyle:check checkstyle:check@runtime-broker-checkstyle —— 修改前后均 0 违规。
  • packages/managed-agent-server:mvn -Dtest=WorkspaceStorageGuardTest test —— 运行 21 个;唯一错误是 nativeRegistrationSurvivesNewGuardAndMtimeChangesButRefusesRootReplacement 中环境性的 /etc/machine-id 读取(该读取在 main 上完全相同;PR 的探测路径本身在 Temurin 下通过,包括强制 mtime==birth 的相等用例)。
  • packages/managed-agent-server:mvn -Dtest=SessionRowLockOrderTest test —— 修复前:1 个失败(审计报告 hasLiveTurn 与 markTurnRecoveryBlocked 未被锁定);修复后:39/39 全绿。
  • 变异探针 —— 单独移除任一新增锁定条目都会使审计测试重新失败("elements were unexpected");恢复后回到绿色。两处新增均为必要。
  • packages/managed-agent-server:完整 mvn clean test —— 修复前:4580 个测试,1 个失败(过期锁定)+ 4 个错误;修复后:4580 个测试,0 失败,4 个错误——全部为上述环境性错误。

Base-conflict check · 基分支冲突检查: no conflict with main. · 与 main 无冲突。

Re-review when you have a moment. After round 100 this bot stops and leaves the PR for a human. · 有空请复审;第 100 轮后本 bot 停止并将 PR 交给人工。


🧠 Handled by Qwen Code · model/模型 kimi-k3 · CLI 0.25.2

qwen-code-autofix added 2 commits October 17, 2026 23:58
…e-birth-time

# Conflicts:
#	packages/managed-agent-server/src/test/java/com/alibaba/qwen/code/managedagent/store/SessionRowLockOrderTest.java
@qwen-code-dev-bot

Copy link
Copy Markdown
Collaborator

🤖 Addressed the latest review feedback (round 2/100). What changed, and what I pushed back on: · 已处理最新评审反馈(第 2/100 轮)。改动内容与我反驳保留之处如下:

Autofix round summary — PR #14505

Feedback triage

[ic:6242075835] CI triage: SessionRowLockOrderTest accessor inventory mismatch (@yiliang114)

Disposition: still resolved; no code work needed this round. The branch head entering this round was unchanged from the rejected round (94ba2a4029, the merge with origin/main), and that merge resolution had already made SessionRowLockOrderTest.java byte-identical to origin/main, which pins both hasLiveTurn and markTurnRecoveryBlocked. This round re-confirmed it with git diff origin/main -- <file> (empty) and grep (both accessors pinned, lines 415/422). The prior round's focused run on this exact tree was 39/39 green.

Same-run verification repair (the round's actual work)

Rejection: the deterministic gate's npm run lint failed with 757 errors — all on generated JavaScript under packages/sdk-java/qwencode/target/reports/apidocs/ (javadoc script.js, jquery, *-search-index.js).

Root cause: the previous round ran the module-prescribed Maven verification (mvn -f ../sdk-java/qwencode/pom.xml install, mvn verify), which generates report output containing JavaScript under target/ (javadoc reports/apidocs, JaCoCo site/jacoco). Those files are git-ignored, but the repository-root ESLint sweep (eslint . --ext .ts,.tsx) does not read .gitignore, and its global ignores cover dist/ but not target/ — so the leftover generated files were linted. No committed content was ever broken; a clean checkout lints green.

Fix (this round):

  1. Deleted both leftover Maven target/ directories (packages/sdk-java/qwencode/target, packages/managed-agent-server/target) — git-ignored, regenerable build output. npm run lint now passes (see Verification).
  2. Committed 3061af9940 — a 6-line note in packages/managed-agent-server/AGENTS.md (the document that prescribes those Maven runs) telling future rounds to mvn clean or delete the target/ directories before running root checks in the same checkout. Adding target/ to the root ESLint ignores would be the alternative fix, but the workspace-root ESLint config is outside this PR's footprint and off-limits to an autofix round.

Scope check: no production code changed, no test added/removed/weakened, footprint stays inside the PR's existing areas (docs/, packages/managed-agent-server/; net PR diff now 153 lines). Mutation probe not applicable — the commit is documentation-only and adds no code guard or branch.

Verification

  • rm -rf packages/sdk-java/qwencode/target packages/managed-agent-server/target; find packages -type d -name target → 0 remaining.
  • git diff origin/main -- .../SessionRowLockOrderTest.java → empty (file byte-identical to main; hasLiveTurn and markTurnRecoveryBlocked pinned at lines 415/422).
  • HOME=/home/node npx prettier --check packages/managed-agent-server/AGENTS.md — passed.
  • HOME=/home/node npm run lint — passed (the exact command whose 757-error failure rejected the previous round; this sandbox needs HOME=/home/node because the default HOME is not writable for corepack).
  • HOME=/home/node npm run typecheck — passed.
  • HOME=/home/node npm run build — passed (settings schema regenerated identically; git status shows no drift).
  • Pre-commit hook (scripts/pre-commit.js, prettier --write on the markdown) ran clean during the commit.

No inline review threads existed this round, so resolved-comments.txt and comment-replies.json are omitted. No tests were deleted or weakened, so test-weakening.json is omitted. No self-review pass (Invocation: Self-review: off).

中文说明

Autofix 本轮总结 — PR #14505

反馈处理

[ic:6242075835] CI 定位:SessionRowLockOrderTest 访问器清单不匹配(@yiliang114)

处理结论:仍然已解决,本轮无需改动代码。 进入本轮时分支头与被驳回的一轮相同(94ba2a4029,即与 origin/main 的合并),而那次合并的解决已使 SessionRowLockOrderTest.java 与 origin/main 逐字节一致,main 中已固定 hasLiveTurn 和 markTurnRecoveryBlocked 两个访问器。本轮用 git diff origin/main -- <file>(结果为空)和 grep(两个访问器分别在第 415/422 行被固定)重新确认。上一轮在这同一棵树上的定向测试结果为 39/39 全绿。

同轮验证修复(本轮的实际工作)

驳回原因: 确定性校验门的 npm run lint 失败,共 757 个错误——全部位于 packages/sdk-java/qwencode/target/reports/apidocs/ 下生成的 JavaScript(javadoc 的 script.js、jquery、*-search-index.js)。

根因: 上一轮按模块文档要求执行了 Maven 验证(mvn -f ../sdk-java/qwencode/pom.xml install、mvn verify),会在 target/ 下生成包含 JavaScript 的报告输出(javadoc reports/apidocs、JaCoCo site/jacoco)。这些文件已被 git 忽略,但仓库根的 ESLint 全量检查(eslint . --ext .ts,.tsx)不读取 .gitignore,其全局忽略列表覆盖 dist/ 却不覆盖 target/——因此残留的生成文件被纳入了 lint。已提交的内容从未有问题;干净检出上 lint 是绿的。

修复(本轮):

  1. 删除了两个残留的 Maven target/ 目录(packages/sdk-java/qwencode/target、packages/managed-agent-server/target)——均为 git 忽略、可再生的构建产物。npm run lint 现已通过(见"验证")。
  2. 提交了 3061af9940——在 packages/managed-agent-server/AGENTS.md(即规定要执行这些 Maven 命令的文档)中加入 6 行说明,提醒后续轮次在同一检出中运行根级检查之前,先 mvn clean 或删除 target/ 目录。把 target/ 加进根 ESLint 忽略列表本是另一种修法,但仓库根的 ESLint 配置不在本 PR 足迹内,且对 autofix 轮次属于禁改区域。

范围核对: 未改动任何生产代码,未新增、删除或削弱任何测试,足迹保持在本 PR 原有区域内(docs/、packages/managed-agent-server/;PR 净 diff 现为 153 行)。变异探针不适用——本次提交仅为文档,没有新增代码守卫或分支。

验证

  • rm -rf packages/sdk-java/qwencode/target packages/managed-agent-server/target;find packages -type d -name target → 剩余 0 个。
  • git diff origin/main -- .../SessionRowLockOrderTest.java → 为空(文件与 main 逐字节一致;hasLiveTurn、markTurnRecoveryBlocked 分别在第 415/422 行被固定)。
  • HOME=/home/node npx prettier --check packages/managed-agent-server/AGENTS.md —— 通过。
  • HOME=/home/node npm run lint —— 通过(正是上一轮以 757 个错误导致驳回的那条命令;本沙箱中需要 HOME=/home/node,因为默认 HOME 不可写,corepack 无法落缓存)。
  • HOME=/home/node npm run typecheck —— 通过。
  • HOME=/home/node npm run build —— 通过(settings schema 重新生成后内容一致;git status 无漂移)。
  • 提交时 pre-commit 钩子(scripts/pre-commit.js,对该 markdown 执行 prettier --write)干净通过。

本轮没有 inline 评审线程,故省略 resolved-comments.txt 与 comment-replies.json。未删除或削弱任何测试,故省略 test-weakening.json。未执行自评审(Invocation 标注 Self-review: off)。

Base-conflict check · 基分支冲突检查: conflicted with main — resolved in this push. · 与 main 有冲突——已在本次推送中解决。

Re-review when you have a moment. After round 100 this bot stops and leaves the PR for a human. · 有空请复审;第 100 轮后本 bot 停止并将 PR 交给人工。


🧠 Handled by Qwen Code · model/模型 kimi-k3 · CLI 0.25.2

This branch has not been deployed

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

Labels

autofix/takeover Summon the autofix loop to manage this PR (remove to release; needs triage+)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(managed-agent): native storage registration refuses a root whose marker lands in its creation clock tick

2 participants