Skip to content

feat(managed-agent): enable external workspace execution - #15684

Merged
yiliang114 merged 104 commits into
mainfrom
feat/15512-completion
Nov 15, 2026
Merged

yiliang114 merged 104 commits into
mainfrom
feat/15512-completion

Conversation

@yiliang114

@yiliang114 yiliang114 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does

Builds the external Workspace execution slice on top of the materialization prerequisite in #15654. The branch now includes live hosted-workspace-external-files/1 admission, bounded and single-query Workspace discovery, authoritative registration checks, stable lifecycle refusal classification, and receipt-backed release for external Runtime bindings. The separate materialization operation still creates metadata only; it does not allocate storage or start a worker.

This revision closes the remaining review gaps in that execution slice: registration decode failures, including field-type failures, now resolve to a permanent 409 workspace_unavailable; a malformed registration disables only its own Workspace during batch discovery; saved-provider shutdown is classified as retryable 503; attachment actor lookup fails closed on zero, multiple, or null rows; and external lifecycle authorization preserves the exact permanent fence response.

Why it's needed

#15512 needs a durable link from registered external storage to a Workspace that can be discovered and used safely. A Session must not become executable through a partially wired path, and one corrupt storage row must not hide every healthy Workspace on the page. The same branch also needs terminal close and recovery paths to distinguish permanent identity failures from provider availability failures.

Reviewer Test Plan

How to verify

On an isolated fresh catalog, register external storage using the loopback operator credential, materialize its alias with an owner, and verify that only the owner can discover it. Exercise Session creation after the external-files gates and a Harness lifecycle capability are available. Confirm that prompts can run, file tools remain within the external profile, and close/recovery uses the receipt-backed ownership transition without destroying a shared placement.

For the query and failure paths, corrupt one registration and confirm only that Workspace loses Session-creation eligibility while another Workspace remains visible. Confirm that an admission attempt against the corrupted Workspace returns 409 workspace_unavailable with retryable=false. Shut down the saved external provider during drain-capability checks and confirm a retryable 503. Submit a non-current lifecycle authority to the external attachment path and confirm 409 workspace_lifecycle_claim_fenced with retryable=false.

Evidence (Before & After)

Before this revision, a field-type error while decoding an opaque-persisted registration could escape as a mapper failure, batch discovery could fail as a whole when one row was malformed, and a shut-down saved provider was conflated with a permanent binding conflict. The candidate maps these cases explicitly, uses one registration batch read rather than per-row JDBC work inside a mapper, and keeps external lifecycle fences non-retryable.

Earlier evidence in this stack covered materialization, registration replay, and isolated MySQL validation. The newest commit was checked statically and through the repository's CI gates; no local test, build, or typecheck was run under the requested execution policy.

Tested on

OS Status
macOS ✅ static review and git diff --check; no heavy local execution
Windows ⚠️ not tested
Linux ✅ repository CI for the branch; the new head is checked again after push

Risk & Scope

  • Main risk or tradeoff: the authenticated operator delegates the Workspace owner. That field is a grant target, not authenticated user identity. Existing operator and tenant checks remain required.
  • Batch discovery now fails closed per malformed storage row instead of failing the whole Workspace page. A failed SQL read remains a retryable provider-unavailable verdict.
  • workspace_lifecycle_claim_fenced remains permanent. Do not reinterpret a stale or non-current authority as a transient outage.
  • Full external Hosted shell/capture, attachment widening beyond the current profile, and the Resident shared-worker behavior remain outside this PR. feat(managed-agent): share resident external Workspace across sessions #16023 carries the Resident and EPHEMERAL layers.
  • Breaking changes / migration notes: the preceding stack extends the shared V1 catalog under the repository's pre-release fresh-catalog policy. No V2 migration is introduced here.

Design: English · 简体中文.

Linked Issues

Part of #15512. Related prerequisite: #15654. The Resident shared-worker increment is stacked in #16023 and must not merge before this PR.

@qwen-code-review-bot

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

Copy link
Copy Markdown
Collaborator

🩺 serve daemon A/B

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

health-deep-with-session

field PR base (before) this PR (after)
activeWorkStaleMs 67 55

— Qwen Code · serve A/B

main landed step 3a (#15654) and the design doc's status line changed
under it. Keep the slice-A amendment and state both increments in one
status line instead of letting either side's sentence win:

  step 3a (provisioning prerequisite) and bounded slice A (external
  Workspace materialization) are implemented; both are inert and no
  Session can use them yet ...

Everything else merged cleanly: capability-parity.ts keeps main's
autofix_pr_watches row next to EXTERNAL_WORKSPACE_MATERIALIZE, and
ExternalStorageRegistrationTest keeps main's provisioner read-path tests
with this PR's controller constructor.
yiliang114 added a commit that referenced this pull request Oct 27, 2026
…branch

The base moved when the stack base merged main, so the two design documents
conflicted on the same status-line region: the base carries #15684's combined
status line for slices A and step 3a, while this branch's document already
supersedes it with the A / step 3a / B0 / B1 / B2 milestone status and §14.

Take this branch's document for both files: every base-only line is the older
framing (§12's status paragraph, the A-only admission limits) that this
branch's §13/§14 explicitly supersede and reference, and the bounded-slice-A
amendment is present and further qualified here. The merge therefore changes
no file content; it records that the branch contains the current stack base.
@yiliang114
yiliang114 marked this pull request as ready for review October 27, 2026 12:26
@yiliang114

Copy link
Copy Markdown
Collaborator Author

@-

@yiliang114

Copy link
Copy Markdown
Collaborator Author

The one red check on this head is the automated review workflow failing before it read the PR:

  • review-pr job 122187767395 (run 40503738850) — Run review failed ~15s after start with gh: Bad credentials (HTTP 401) / HTTP 401: Bad credentials (https://api.github.com/graphql), and FAILURE_REASON: Failed to determine state for PR #15684. It never reached the diff.
  • The same 401 hit other PRs in this window, including same-repository ones (not a fork-permission issue), so this is a repository-side credential/service failure, not a finding about this change.
  • gh run rerun 40503738850 --failed is refused ("workflow file may be broken"), so it cannot be cleared from here.

Every code lane on this head is green: SDK Java (fast) / ubuntu-latest / Java 21, Lint & Static, Test, Integration Tests (no-AK), TUI parity, web-shell E2E, Serve A/B — 21 pass, 0 failing code checks.

Local verification within the module's budget (JDK 21.0.12.1 / Maven 3.10.0): ExternalWorkspaceMaterializationTest + ExternalStorageRegistrationTest = 20 tests / 0 failures; ManagedAgentApiContractTest + SurfaceRegistryGateTest + SurfaceRegistryGateNegativeTest + ManagedSurfaceCaptureTest + checkstyle:check = 30 tests / 0 failures / 0 Checkstyle violations; prettier --check clean on both design docs. Not run locally and CI-owned: full mvn verify, SpotBugs, the mysql-integration profile, CLI/TS suites.

Because this PR carries #15654's step-3a merge on top, the reviewer-visible diff against main is exactly this PR's 13 files (+612/−24) — read it that way rather than against the stacked branch.

chiga0
chiga0 previously approved these changes Oct 27, 2026

@chiga0 chiga0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review: feat(managed-agent): materialize inert external workspaces

Summary

This PR introduces the materialization step for external workspaces — a new REST endpoint POST /internal/managed-workspaces/v1/workspace:materialize-external that creates the metadata (ma_workspace, OWNER grant, EXTERNAL_WORKSPACE receipt) for an already-registered EXTERNAL storage. Critically, the materialized workspace is inert by design: no session can use it yet. That gate is the next PR.

What I checked

  • Idempotent materialization: The store correctly handles exact retries returning the original receipt even after grant revocation/rename/removal. The idempotency key + tenant-scoped lock is the right pattern.
  • Inert-by-design enforcement: ManagedWorkspaceRegistry filters EXTERNAL workspaces from canCreateSession(), findReadable(), and readableGrant() — all three surfaces consistently block session creation.
  • Schema contract: New EXTERNAL_WORKSPACE enum value in ReceiptNamespace with V1 CHECK constraint update (WHEN 'EXTERNAL_WORKSPACE' THEN 18). Monotonic sequence ordering is preserved.
  • Concurrency: Placement-domain lock (lockPlacementDomain) serializes materialization against other tenant-scoped operations. The concurrency test verifies same-key replays and different-key one-winner semantics.
  • Test coverage: 360 lines of unit tests covering materialization, no-resurrection after receipt, session denial, operator boundary, closed body validation, receipt identity/conflict, persisted tuple drift, and concurrency.

Finding: summary() and readableGrant() changed from static to instance

Severity: Non-blocking (correctness concern)
File: ManagedWorkspaceRegistry.java

The summary() and readableGrant() methods changed from static to instance methods because they now call externalFilesAllowed() which requires externalFilesActivation (a Spring @Autowired bean). This is a reasonable change, but it introduces an implicit dependency: these methods are now called from within RowMapper lambdas during SQL result processing, which happens inside a JDBC transaction. If externalFilesActivation is not yet initialized (e.g., during early startup), these queries could NPE.

Mitigation: The @Autowired(required = false) on externalFilesActivation and the null check in externalFilesAvailable() handle this correctly — if the bean is absent, external files are unavailable, and the EXTERNAL filter stays blocked. So this is safe in practice.

Verdict

Approve. Clean, well-scoped foundation PR. The inert-by-design approach is the right way to build this incrementally — materialize first, enable execution in a separate PR with its own guards. The idempotent materialization pattern and comprehensive concurrency tests set a strong foundation for the lifecycle work in #15685.


Review by AI00002265 (阿奇) — pr-review skill

@doudouOUC doudouOUC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QwenCode Reviewer 评审报告 — PR #15684

总体评价

本 PR 实现了 external Workspace materialization(有界切片 A),为已注册的外部存储别名创建元数据和幂等回执,不分配存储、不启动 worker、不启用 Session 执行。设计清晰、安全边界明确、测试覆盖充分。

评审结论:通过 ✅


改动内容与方案正确性

  1. 新增 POST /internal/managed-workspaces/v1/workspace:materialize-external 端点 (ExternalStorageRegistrationController.java:127-149)

    • 请求体严格限定为 5 个字段 + 可选 trace-only requestId,16 KiB 上限
    • 复用已有 operator loopback + bearer token 认证(提取为 requireOperator() 私有方法),安全边界不变
    • 输入校验完整:tenant/alias/displayName/ownerActorId/idempotencyKey 均有正则或长度约束
  2. ExternalWorkspaceMaterializationStore.materialize() (新文件,131 行)

    • 事务内获取 placement-domain 锁,检查注册记录一致性(tenant、alias identity、provider/physical identity、revision、mount root)
    • 拒绝已有 Workspace、Runtime binding、holder 或 maintenance 状态
    • 原子创建 ma_workspace + OWNER grant + EXTERNAL_WORKSPACE receipt
    • 幂等重放返回原始回执,不恢复已撤销/改名/移除的状态 — 符合设计文档描述
  3. Discovery 限制 (ManagedWorkspaceRegistry.java:213-237, 252-257)

    • EXTERNAL storage 的 canCreateSession 和 canSelectDirectory 均为 false
    • 批量 readable grant 也一致限制
    • JOIN ma_storage 获取 storage_kind 的方式合理
  4. Schema 变更 (V1__managed_schema.sql:607)

    • 新增 EXTERNAL_WORKSPACE namespace 到 CHECK 约束,长度值 18 正确
    • 遵循 fresh-catalog 策略,无 migration — 与设计文档一致
  5. Capability parity (capability-parity.ts:598, SurfaceRegistry.java:446-449)

    • 新增 EXTERNAL_WORKSPACE_MATERIALIZE capability,标记为 managed-only not-a-gap
    • Surface registry 正确注册路由与 rule class

安全审查

  • ✅ Operator 认证:loopback listener + local addr + remote addr + bearer token 四重校验,使用 MessageDigest.isEqual 常量时间比较
  • ✅ 输入校验:所有字符串参数有正则/长度/控制字符检查,displayName 拒绝 ISO control characters
  • ✅ 无硬编码密钥/Token
  • ✅ SQL 注入防护:全部使用参数化查询
  • ✅ 事务完整性:receipt insert 失败会回滚 workspace 和 grant(有专门测试 receiptInsertFailureRollsBackWorkspaceAndGrant)
  • ✅ 并发安全:同键并发只产生一个 Workspace(有 MySQL 并发测试)
  • ✅ 回执不包含敏感信息(测试验证不含 operator-secret)

测试覆盖

  • ExternalWorkspaceMaterializationTest:360 行,覆盖正常流程、幂等重放、不复活、operator 边界、闭合请求校验、内容冲突、持久化元组漂移、忙碌 owner、已有 Workspace/Runtime 拒绝、MySQL 并发
  • ExternalWorkspaceMaterializationMySqlIT:MySQL 集成测试
  • ExternalStorageRegistrationTest:更新构造函数适配
  • 测试质量高,边界条件覆盖全面

CI/门禁状态

  • Build and verify reference distribution: ✅ pass
  • Check TUI impact: ✅ pass
  • Integration Tests (no-AK, No Sandbox): ✅ pass
  • Lint & Static: ✅ pass
  • Test (ubuntu-latest, Node 22.x): ✅ pass
  • Serve A/B: ✅ pass
  • web-shell E2E Smoke: ✅ pass
  • TUI parity snapshots: ✅ pass
  • SDK Java tests: ✅ pass/skipping (expected)
  • review-pr: ❌ fail — 这是仓库自身的 AI review bot,非代码质量门禁,不影响合入标准
  • Installed npm Node26 private Bun acceptance: ⏳ pending
  • fallback-comment: ⏳ pending

建议项(非阻塞)

  1. ExternalWorkspaceMaterializationStore.java:139: input.requestId() != null && !input.requestId().matches(...) 中 Jackson 对未知字段的处理依赖 FAIL_ON_UNKNOWN_PROPERTIES=false(已在 ObjectMapper 配置),但如果未来有人修改 ObjectMapper 配置,可能导致意外行为。建议在 MaterializeRequest record 上显式标注 @JsonIgnoreProperties(ignoreUnknown = true) 或在类级别文档说明此依赖。

  2. 设计文档同步: 中英文设计文档更新详尽,保持了良好的双语同步习惯 👍


安全审查结论:无安全漏洞发现。

本 PR 是一个精心设计的惰性元数据操作,安全边界清晰,测试覆盖充分,可以合入。

doudouOUC
doudouOUC previously approved these changes Oct 27, 2026

@doudouOUC doudouOUC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QwenCode Reviewer 评审报告 — PR #15684

总体评价

本 PR 实现了 external Workspace materialization(有界切片 A),为已注册的外部存储别名创建元数据和幂等回执,不分配存储、不启动 worker、不启用 Session 执行。设计清晰、安全边界明确、测试覆盖充分。

评审结论:通过 ✅


改动内容与方案正确性

  1. 新增 POST /internal/managed-workspaces/v1/workspace:materialize-external 端点 (ExternalStorageRegistrationController.java:127-149)

    • 请求体严格限定为 5 个字段 + 可选 trace-only requestId,16 KiB 上限
    • 复用已有 operator loopback + bearer token 认证(提取为 requireOperator() 私有方法),安全边界不变
    • 输入校验完整:tenant/alias/displayName/ownerActorId/idempotencyKey 均有正则或长度约束
  2. ExternalWorkspaceMaterializationStore.materialize() (新文件,131 行)

    • 事务内获取 placement-domain 锁,检查注册记录一致性(tenant、alias identity、provider/physical identity、revision、mount root)
    • 拒绝已有 Workspace、Runtime binding、holder 或 maintenance 状态
    • 原子创建 ma_workspace + OWNER grant + EXTERNAL_WORKSPACE receipt
    • 幂等重放返回原始回执,不恢复已撤销/改名/移除的状态 — 符合设计文档描述
  3. Discovery 限制 (ManagedWorkspaceRegistry.java:213-237, 252-257)

    • EXTERNAL storage 的 canCreateSession 和 canSelectDirectory 均为 false
    • 批量 readable grant 也一致限制
    • JOIN ma_storage 获取 storage_kind 的方式合理
  4. Schema 变更 (V1__managed_schema.sql:607)

    • 新增 EXTERNAL_WORKSPACE namespace 到 CHECK 约束,长度值 18 正确
    • 遵循 fresh-catalog 策略,无 migration — 与设计文档一致
  5. Capability parity (capability-parity.ts:598, SurfaceRegistry.java:446-449)

    • 新增 EXTERNAL_WORKSPACE_MATERIALIZE capability,标记为 managed-only not-a-gap
    • Surface registry 正确注册路由与 rule class

安全审查

  • ✅ Operator 认证:loopback listener + local addr + remote addr + bearer token 四重校验,使用 MessageDigest.isEqual 常量时间比较
  • ✅ 输入校验:所有字符串参数有正则/长度/控制字符检查,displayName 拒绝 ISO control characters
  • ✅ 无硬编码密钥/Token
  • ✅ SQL 注入防护:全部使用参数化查询
  • ✅ 事务完整性:receipt insert 失败会回滚 workspace 和 grant(有专门测试 receiptInsertFailureRollsBackWorkspaceAndGrant)
  • ✅ 并发安全:同键并发只产生一个 Workspace(有 MySQL 并发测试)
  • ✅ 回执不包含敏感信息(测试验证不含 operator-secret)

测试覆盖

  • ExternalWorkspaceMaterializationTest:360 行,覆盖正常流程、幂等重放、不复活、operator 边界、闭合请求校验、内容冲突、持久化元组漂移、忙碌 owner、已有 Workspace/Runtime 拒绝、MySQL 并发
  • ExternalWorkspaceMaterializationMySqlIT:MySQL 集成测试
  • ExternalStorageRegistrationTest:更新构造函数适配
  • 测试质量高,边界条件覆盖全面

CI/门禁状态

  • Build and verify reference distribution: ✅ pass
  • Check TUI impact: ✅ pass
  • Integration Tests (no-AK, No Sandbox): ✅ pass
  • Lint & Static: ✅ pass
  • Test (ubuntu-latest, Node 22.x): ✅ pass
  • Serve A/B: ✅ pass
  • web-shell E2E Smoke: ✅ pass
  • TUI parity snapshots: ✅ pass
  • SDK Java tests: ✅ pass/skipping (expected)
  • review-pr: ❌ fail — 这是仓库自身的 AI review bot,非代码质量门禁,不影响合入标准
  • Installed npm Node26 private Bun acceptance: ⏳ pending
  • fallback-comment: ⏳ pending

建议项(非阻塞)

  1. ExternalWorkspaceMaterializationStore.java:139: input.requestId() != null && !input.requestId().matches(...) 中 Jackson 对未知字段的处理依赖 FAIL_ON_UNKNOWN_PROPERTIES=false(已在 ObjectMapper 配置),但如果未来有人修改 ObjectMapper 配置,可能导致意外行为。建议在 MaterializeRequest record 上显式标注 @JsonIgnoreProperties(ignoreUnknown = true) 或在类级别文档说明此依赖。

  2. 设计文档同步: 中英文设计文档更新详尽,保持了良好的双语同步习惯 👍


安全审查结论:无安全漏洞发现。

本 PR 是一个精心设计的惰性元数据操作,安全边界清晰,测试覆盖充分,可以合入。

qqqys
qqqys previously approved these changes Oct 27, 2026

@qqqys qqqys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

APPROVE at head 68b02f94.

Critical-only scan found no blocking defect. I read all five production files and the schema change, and I checked the three places this shape can fail: the managed-schema CHECK, the new store's transaction discipline, and the authorization guard that the controller refactor moved.

1. The schema CHECK edit is literal-only, and the boot lane confirms it

V1__managed_schema.sql adds one arm to ck_ma_request_namespace: WHEN 'EXTERNAL_WORKSPACE' THEN 18. Two things make this safe where a schema edit usually is not:

  • The declared length is right. EXTERNAL_WORKSPACE is 18 characters, and the constraint compares the CASE result against CHAR_LENGTH(namespace), so the arm admits exactly the enum value it names and nothing else. ELSE -1 still rejects any unlisted namespace.
  • No function MySQL canonicalizes was introduced. The added tokens are a string literal, an integer and two keywords. CHAR_LENGTH was already in the constraint and prints back from CHECK_CLAUSE unchanged, so the verbatim token comparison ManagedSchemaCatalog.validateChecks performs still matches. Had this used a synonym MySQL folds on store — OCTET_LENGTH resolving to Item_func_length and printing as length — the context would fail to boot.

That reasoning is corroborated rather than left standing on its own: Build and verify reference distribution passes at this head, which is the lane that boots the exact archive and runs ManagedSchema.validate. ManagedSchemaContract.ReceiptNamespace gains EXTERNAL_WORKSPACE in the same commit, so the Java enum and the DDL arm stay in lockstep. Editing V1 in place is the established convention here — the same CASE already carries nine namespaces accumulated the same way — and ExternalWorkspaceMaterializationMySqlIT is added to pin the scenario against a real MySQL.

2. The new store locks before it reads, and fails closed on every ambiguity

ExternalWorkspaceMaterializationStore gets the ordering right, which is the part most likely to be wrong: WorkspaceStorageKindGuard.requireFreshTransaction() runs before transaction.execute, and lockDomain(jdbc, tenant, 10) is the first statement inside it. Every read therefore happens after the lock is held and inside a fresh snapshot, so there is no discovery→lock→re-read window in which a REPEATABLE READ snapshot pinned before the lock could serve stale evidence.

The admission chain requires exactly one row at each step and refuses otherwise: the ma_storage registration is selected FOR UPDATE with storage_kind = 'EXTERNAL' AND registration_state = 'REGISTERED' and registrations.size() != 1 throws; a COUNT(*) re-check binds (alias_key, tenant_key, storage_key, physical_key, registration_revision); the ma_storage_owner row is selected FOR UPDATE and must be mount_state = 'UNVERIFIED' with holder_key, binding_id, runtime_generation, runtime_session_id, maintenance_id and maintenance_generation all NULL — so a storage already bound to a runtime cannot be materialized; and an existing ma_workspace claiming either the id or the storage conflicts. Every refusal is 409 with retryable=false.

Input validation is strict and rejects the whole call on any failure: regex-bounded tenant, registeredAliasId and idempotencyKey, a non-blank displayName under 128 characters with no code point satisfying Character.isISOControl, and a non-blank ownerActorId. Idempotency binds the replay to the request: a prior receipt with a different requestDigest throws idempotency_conflict rather than returning the earlier result. All SQL is parameterized, transaction.setTimeout(10) bounds the unit, and I counted the two INSERTs' columns against their placeholders and arguments — ma_workspace is 12 columns / 8 placeholders / 8 arguments in order, ma_workspace_access 4 / 3 / 3.

3. The authorization extraction does not weaken the guard

Moving the loopback-operator check into requireOperator(request) is the riskiest edit in the diff, since a subtle loss would silently open an internal write route. I compared the removed block against the method at head line by line: the loopbackListener derivation, all three loopback tests (getLocalAddr, getRemoteAddr, and the listener address), the token == null || token.isBlank() refusal, the authorization.length() > 4096 cap and the MessageDigest.isEqual constant-time comparison are all present and unchanged, and the 403 external_storage_registration_denied refusal is identical. It is called at both endpoints — register (line 51) and materialize (line 82) — before either reads the request body.

The new route also carries the surrounding hygiene: Cache-Control: no-store set on the response and repeated as cacheControl(noStore()), the same 16384-byte body cap with a 413 on overflow, requestId constrained to [\x21-\x7e]{1,128} before RequestIdFilter.useClientId, and the shared strict ObjectMapper.

4. The registry join cannot multiply rows, and its new terms only restrict

findReadable gains LEFT JOIN ma_storage s ON s.tenant_id = r.tenant_id AND s.storage_id = r.storage_id. ma_storage is unique on (tenant_key, storage_key), both CHAR(64) and both derived deterministically from the tenant and storage ids the join uses — the store itself builds them via storageFenceKey(tenant) and storageFenceKey(registeredAliasId) — so the join is one-to-one and cannot duplicate a grant. Where no storage row exists the LEFT JOIN yields NULL, and !"EXTERNAL".equals(null) is true, so non-external workspaces keep exactly the capabilities they had.

The three added && !"EXTERNAL".equals(result.getString("storage_kind")) terms appear in summary's operator-capable flag, summary's owner-root flag (alongside the existing SSH_LOCAL and CSI exclusions) and readableGrant. All three only ever turn a capability off, which is the correct direction for materializing workspaces the design describes as inert.

5. Surface parity is consistent across all three pins

The new internal route is registered coherently: managed-surface.txt gains EXTERNAL_WORKSPACE_MATERIALIZE POST /internal/managed-workspaces/v1/workspace:materialize-external internal with its sha256 header updated, SurfaceRegistry.java gains the name, and capability-parity.ts adds EXTERNAL_WORKSPACE_MATERIALIZE to MANAGED_ONLY_NOT_A_GAP beside the existing EXTERNAL_STORAGE_REGISTER — so an internal-only operator route is not reported as a missing client capability. The @PostMapping path matches the pinned line exactly.

6. Scope of verification, and CI

I did not compile or run the Java suite — no JRE on this machine — so the execution evidence is CI's. At review time: 22 pass, 41 skipping, 15 pending, 1 fail. The failure is review-pr, which is not a gate in any state. Green and load-bearing here: Build and verify reference distribution (boots the archive, validates the schema), SDK Java (fast) / ubuntu-latest / Java 21 (compiles and runs the new 360-line ExternalWorkspaceMaterializationTest), both Flyway migration version uniqueness lanes, Managed Agent fast tier, and Lint & Static for the TypeScript parity change. Still pending: the SDK Java (full) tier, including Runtime Broker and Managed Agent MySQL / MariaDB, which is what would execute ExternalWorkspaceMaterializationMySqlIT. I did not wait on them, and they are not what this verdict rests on — but the MySQL-specific behaviour of the new store is the one thing not yet executed anywhere I can see.

Not read: the design-doc deltas and the bulk of the 360-line unit test. The docs are non-executable, and the tests are additive for new code rather than edits to an existing gate.

* feat(managed-agent): add the external-workspace provisioning prerequisite (#15512)

Step 3a of the external Hosted Workspace plan: a new `external-workspace`
Runtime provisioner kind that places a session-isolated worker on a registered
EXTERNAL storage tree and mints the boot document the shipped worker already
admits (`managed-context/1` plus the existing `storage` member).

The storage identity comes only from the durable registration: a read-only
primary-key lookup that admits `REGISTERED` rows, bounds the revision to
2^53-1, joins the owner row on its own primary key, and fails closed when a
persisted row disagrees with itself. A registration that cannot be read to
completion stays retryable (`runtime_external_unavailable`) so the Broker keeps
the placement adoptable instead of burying it. `external-workspace` accepts
only the closed evidence set {storageRef, mountRoot, continuity}; `mountNonce`
from the design is deferred and explicitly refused, because the registration
record cannot persist it yet and an unverifiable claim must not be ignored.

Hosted tools, EXECUTION admission, publication consumption, `stopDrained` and
close gating are not enabled: `supportsDrainedStop()` stays false, every
managed Workspace feature remains refused, and preflight now states the
prerequisite in an `external-prerequisite` warning. No Session can be placed
yet, and every placement fails closed.

`external-scratch` behavior and wording, the shipped worker
boot/storage/registration.json contract, the schema and the CLI are unchanged.

* test(managed-agent): pin external storage refusal in lock canary

* fix(managed-agent): require exact external workspace digest

* fix(managed-agent): reject storage evidence for non-running workers

* feat(managed-agent): add inert exact-worker external drain

* feat(managed-agent): fence external workspace ownership and drain

* feat(managed-agent): enable external files with verified close

* docs: record verified external files and remaining phase two work

* fix(web-shell): avoid recovery warning for closed sessions
@yiliang114
yiliang114 dismissed stale reviews from qqqys, doudouOUC, and chiga0 via 0f7b8c0 October 27, 2026 13:43
@yiliang114

Copy link
Copy Markdown
Collaborator Author

🧐 Qwen Pull Request Review / review-pr failed on the current head 68b02f94 — job 122187767395, step Run review, 12:26:37Z → 12:27:06Z UTC.

Recording it so a re-run or a later look has a baseline; nothing else is known about the cause from the job metadata alone. The three approvals on 68b02f94 are unaffected, and the SDK Java full matrix is still in flight.

… list

#15685 adds HostedExternalPublicFilesIT, so hosted-process-ci.test.js's
expected class list must carry it; the meta-test pins which IT classes the
hosted-process lane runs and had 35 entries against 36 discovered.
@yiliang114

Copy link
Copy Markdown
Collaborator Author

Review scope changed on this head, so it needs a fresh look rather than the earlier approvals.

What landed since the approvals: #15685 merged into this PR's base branch (feat/15512-completion), so this PR now carries both increments — 2aaee5e1 is that merge (feat(managed-agent): enable external files with verified close (#15685)). The reviewer-visible diff against main is now 67 files. That is why the previous approvals were invalidated, not a change of anyone's verdict.

One real fix in this head: Test (ubuntu) was failing at scripts/tests/hosted-process-ci.test.js:1006 — the meta-test pins the IT classes the hosted-process lane runs, and it expected 35 while discovery found 36. The added class is HostedExternalPublicFilesIT, brought in by #15685. I added it in sorted position; the file now passes 76/76 under the repo's own scripts/tests/vitest.config.ts. Test (ubuntu) is green again on this head.

Since the merge: conflicts were only the two design documents (main's step-3a status line vs this PR's bounded-slice-A amendment) — resolved by keeping the amendment and writing one status line naming both shipped increments, zh in sync. Everything else auto-merged; the merged tree differs from main by exactly this PR's files.

Local verification on the merged tree, within the module's 10-minute budget (JDK 21.0.12.1 / Maven 3.10.0): ExternalWorkspaceMaterializationTest + ExternalStorageRegistrationTest 20/20; ManagedAgentApiContractTest + SurfaceRegistryGateTest + SurfaceRegistryGateNegativeTest + ManagedSurfaceCaptureTest 30/30; checkstyle:check 0 violations; prettier --check clean on both docs. CI-owned and not run locally: full mvn verify, SpotBugs, the mysql-integration profile, CLI/TS suites, web-shell E2E.

What to review now: the combined managed-agent external-workspace surface against main — materialization (this PR) and the files-with-verified-close path (from #15685) — and whether the combined diff still reads as two clearly separable increments.

CI note: the review-pr job may show red from the repository-side HTTP 401 Bad credentials failure seen across PRs in this window; that is infrastructure and not a signal about this change.

@doudouOUC doudouOUC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QwenCode Reviewer 复审报告 — PR #15684 (Incremental Re-review)

HEAD 变更确认

上次评审 HEAD: 68b02f9 → 当前 HEAD: 2aaee5e

新增 3 个 commit:

  1. 68b02f9 Merge origin/main into feat/15512-completion
  2. 0f7b8c0 feat(managed-agent): enable external files with verified close (#15685) — squash merge of PR #15685
  3. 2aaee5e test(ci): pin HostedExternalPublicFilesIT in the hosted-process class list

增量 diff 59 files / +4760 lines,主体为 PR #15685 的内容合入(已在上一轮独立评审中完整审查并通过),加上一个 CI 配置 commit(仅将 HostedExternalPublicFilesIT 添加到测试列表,安全无风险)。

原始 slice A 代码(04306a9)未发生变化。

复审结论:通过 ✅

依据:

  • 原始 slice A(external Workspace materialization)代码不变,上次评审结论仍然有效
  • 合入的 #15685 内容已在独立评审中完整审查并通过(工具白名单、optional lanes 闭合、SQL-level physical ownership、drain proof 校验、attestation pinning 等安全护栏均确认完备)
  • 新增 CI pin commit (2aaee5e) 仅添加测试类名到列表,无功能变更
  • 设计文档 §14 正确记录了 A/B0/B1/B2 里程碑边界和剩余门禁

CI/门禁状态

已完成 check 均 pass:

  • Lint & Static: ✅ pass
  • Integration Tests (no-AK, No Sandbox): ✅ pass
  • Test (ubuntu-latest, Node 22.x): ✅ pass
  • Serve A/B: ✅ pass
  • OpenTUI no-flicker gate: ✅ pass
  • Build and verify reference distribution: ✅ pass
  • SDK Java (fast) / Flyway migration version uniqueness: ✅ pass
  • SDK Java (fast) / Real daemon E2E / Java 11: ✅ pass
  • Check TUI impact: ✅ pass
  • Classify PR: ✅ pass

Pending(运行中):

  • SDK Java (fast) / ubuntu-latest / Java 21
  • web-shell E2E Smoke
  • Installed npm Node26 private Bun acceptance
  • Capture web-shell visuals
  • TUI parity snapshots

无失败 check。

安全审查

  • ✅ 原始 slice A 安全边界不变(operator 四重认证、输入校验、事务原子性、幂等重放、并发安全)
  • ✅ 合入的 #15685 安全护栏已在上次评审中确认(工具白名单、physical ownership 排他锁、drain proof schema 校验、redirect 防护、late write 409)
  • ✅ CI pin commit 无安全影响
  • ✅ 无硬编码密钥/Token、无 SQL 注入风险

建议项(非阻塞,延续上次评审)

  1. MaterializeRequest record 建议显式标注 @JsonIgnoreProperties(ignoreUnknown = true)
  2. ManagedAgentStore.java insertTurn SQL 中 hex literal X'7177656e2d636f6465' 建议加注释
  3. WorkspaceRuntimeTransport.java 第二个构造函数重复赋值 verifyExternalAcquisition 建议移除
  4. PR 现含 68 files / +5306 lines(含 #15685 内容),后续类似规模可考虑拆分

安全审查结论:无安全漏洞发现。

本 PR 原始 slice A 代码未变,合入的 #15685 内容已通过独立评审,CI pin 安全无风险。复审通过,待 CI 全部完成后可合入。

doudouOUC
doudouOUC previously approved these changes Oct 27, 2026

@doudouOUC doudouOUC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

QwenCode Reviewer 复审报告 — PR #15684 (Incremental Re-review)

HEAD 变更确认

上次评审 HEAD: 68b02f9 → 当前 HEAD: 2aaee5e

新增 3 个 commit:

  1. 68b02f9 Merge origin/main into feat/15512-completion
  2. 0f7b8c0 feat(managed-agent): enable external files with verified close (#15685) — squash merge of PR #15685
  3. 2aaee5e test(ci): pin HostedExternalPublicFilesIT in the hosted-process class list

增量 diff 59 files / +4760 lines,主体为 PR #15685 的内容合入(已在上一轮独立评审中完整审查并通过),加上一个 CI 配置 commit(仅将 HostedExternalPublicFilesIT 添加到测试列表,安全无风险)。

原始 slice A 代码(04306a9)未发生变化。

复审结论:通过 ✅

依据:

  • 原始 slice A(external Workspace materialization)代码不变,上次评审结论仍然有效
  • 合入的 #15685 内容已在独立评审中完整审查并通过(工具白名单、optional lanes 闭合、SQL-level physical ownership、drain proof 校验、attestation pinning 等安全护栏均确认完备)
  • 新增 CI pin commit (2aaee5e) 仅添加测试类名到列表,无功能变更
  • 设计文档 §14 正确记录了 A/B0/B1/B2 里程碑边界和剩余门禁

CI/门禁状态

已完成 check 均 pass:

  • Lint & Static: ✅ pass
  • Integration Tests (no-AK, No Sandbox): ✅ pass
  • Test (ubuntu-latest, Node 22.x): ✅ pass
  • Serve A/B: ✅ pass
  • OpenTUI no-flicker gate: ✅ pass
  • Build and verify reference distribution: ✅ pass
  • SDK Java (fast) / Flyway migration version uniqueness: ✅ pass
  • SDK Java (fast) / Real daemon E2E / Java 11: ✅ pass
  • Check TUI impact: ✅ pass
  • Classify PR: ✅ pass

Pending(运行中):

  • SDK Java (fast) / ubuntu-latest / Java 21
  • web-shell E2E Smoke
  • Installed npm Node26 private Bun acceptance
  • Capture web-shell visuals
  • TUI parity snapshots

无失败 check。

安全审查

  • ✅ 原始 slice A 安全边界不变(operator 四重认证、输入校验、事务原子性、幂等重放、并发安全)
  • ✅ 合入的 #15685 安全护栏已在上次评审中确认(工具白名单、physical ownership 排他锁、drain proof schema 校验、redirect 防护、late write 409)
  • ✅ CI pin commit 无安全影响
  • ✅ 无硬编码密钥/Token、无 SQL 注入风险

建议项(非阻塞,延续上次评审)

  1. MaterializeRequest record 建议显式标注 @JsonIgnoreProperties(ignoreUnknown = true)
  2. ManagedAgentStore.java insertTurn SQL 中 hex literal X'7177656e2d636f6465' 建议加注释
  3. WorkspaceRuntimeTransport.java 第二个构造函数重复赋值 verifyExternalAcquisition 建议移除
  4. PR 现含 68 files / +5306 lines(含 #15685 内容),后续类似规模可考虑拆分

安全审查结论:无安全漏洞发现。

本 PR 原始 slice A 代码未变,合入的 #15685 内容已通过独立评审,CI pin 安全无风险。复审通过,待 CI 全部完成后可合入。

@qqqys qqqys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

COMMENT at head 2aaee5e1 — not approving. This is not a re-review of the change I approved at 68b02f94; the branch absorbed #15685 and the PR grew from 13 files/+612/−24 to 68 files/+5364/−317, so my approval was dismissed and the scope is now roughly nine times what I certified. Everything I read at this head is sound. I am not able to scan the rest in this pass's budget, and most of it is surface I explicitly named as unread when I reviewed #15685 an hour ago.

1. What the head now contains

Two commits landed after 68b02f94: 0f7b8c00 (feat(managed-agent): enable external files with verified close (#15685)) and 2aaee5e1 (test(ci): pin HostedExternalPublicFilesIT in the hosted-process class list). The first brings in the whole of #15685 — step 3b, which turns the inert external workspaces this PR materializes into ones that can actually serve files. The second is one line, adding 'HostedExternalPublicFilesIT' to the hosted-process class list in scripts/tests/hosted-process-ci.test.js; I confirmed that class exists at this head (packages/managed-agent-server/src/test/java/.../HostedExternalPublicFilesIT.java), so the pin names a real gate rather than a phantom one.

The two changes are complementary rather than redundant: #15684 creates an EXTERNAL workspace with its capability flags forced off, and #15685 supplies the predicate that turns files back on once the binding is provably current. That combination is what makes the merged form of ManagedWorkspaceRegistry worth reading closely, since neither of my prior reviews saw it.

2. What I verified at this head

#15684's own contributions survived the merge. V1__managed_schema.sql still carries WHEN 'EXTERNAL_WORKSPACE' THEN 18 in ck_ma_request_namespace, and ManagedSchemaContract.ReceiptNamespace still declares EXTERNAL_WORKSPACE — the DDL arm and the Java enum are still in lockstep, and 18 is still the correct CHAR_LENGTH for that literal. ManagedWorkspaceRegistry still carries the LEFT JOIN ma_storage s ON s.tenant_id = r.tenant_id AND s.storage_id = r.storage_id, now at three query sites rather than the one #15684 added.

The capability relaxation is fail-closed on every axis I could reach. #15685 changed summary's operator-capable flag from #15684's unconditional !"EXTERNAL".equals(storage_kind) to (!"EXTERNAL".equals(storage_kind) || externalFilesAllowed(tenantId, workspaceId)). A relaxation of an access predicate is the thing to read hardest, so I followed it:

  • externalFilesAllowed(String, String) first requires externalFilesAvailable(), then queries ma_workspace by tenant and workspace and requires rows.size() == 1 before delegating — an ambiguous or absent row is a refusal, not a pass.
  • externalBindingCurrent then requires, conjunctively: non-null binding/properties/registrations; cwdRelative exactly "." (root, not a subdirectory); the binding's contextConfigRef equal to CONTEXT_CONFIG_REF; a ma_workspace row pinned on tenant, workspace, workspace_generation, storage_id, workspace_kind = 'ROOT' and state = 'ACTIVE', whose config_ref and policy_ref both equal the profile constants, with rows.size() != 1 || !rows.getFirst() refusing; and finally a three-way identity agreement — the registration exists for that tenant and storage, binding.getWorkspaceId() equals registered.tenantWorkspaceId(), and the configured externalProviderId equals registered.providerId().
  • Every one of those paths returns false. There is no default-true branch and no exception that escapes as permission.

The generation pin is the detail that makes this more than a name comparison: a stale binding from an earlier workspace generation cannot satisfy it. And line 449 adds an independent gate — isExternal(binding) && (!externalFilesAllowed(binding) || !".".equals(binding.getCwdRelative())) — so the tool path refuses an external binding whose cwd is not the root even when files are allowed.

The owner-root flag at line 284-288 keeps the unconditional !"EXTERNAL".equals(storage_kind) alongside the existing SSH_LOCAL and CSI exclusions, so the relaxation is confined to the operator-capable flag and does not leak into root ownership.

3. What I did not read, which is why this is not an approval

The production surface I verified an hour ago on #15685 and still have not read — now part of this PR: JdbcExternalWorkspaceOwnership.java (+373, entirely new, and the file that carries ownership and identity for external workspaces), WorkspaceExecutionStore.java (+176/−5), RuntimeBrokerService.java (+159/−33), WorkspaceRuntimeTransport.java (+159/−16), HttpRuntimeTransport.java (+121/−3), ExternalWorkspaceProvisioner.java (+129/−8), hosted-harness-session.ts (+125/−38), hosted-workspace-tool-turn.ts (+45/−4), ManagedAgentStore.java (+52/−15), EmbeddedRuntimeBroker.java (+39/−8), WorkspaceMigrationAdmission.java (+37, new), and ManagedSessionsPage.tsx. Also unread: the remainder of ManagedWorkspaceRegistry's own +78/−7 beyond the two predicates above, and the ~2,500 lines of tests.

Two things follow from the merge that no prior review of either PR covers. First, the reconciled form of every file both PRs touched — ManagedWorkspaceRegistry is the one I checked, and its combined shape is deliberate rather than accidental, but I only read two of its methods. Second, #15684's materialization produced workspaces that were inert by construction; with #15685 present in the same branch, the inertness now depends entirely on externalFilesAllowed returning false. That is a correct design, and the predicate is well guarded, but it means the safety property I approved at 68b02f94 is no longer structural — it is conditional, and the condition lives in code paths I have only partly read.

4. CI

14 pass, 9 skipping, 5 pending, 0 fail at review time. The suite had been retriggered by the two new commits and was still materializing, so this is a snapshot rather than a verdict; I did not wait on it and CI is not what this comment rests on.

Next step

The useful next round is on #15685's surface as it now stands inside this branch, starting with JdbcExternalWorkspaceOwnership.java and the two transport diffs. If the intent is to land #15684's materialization on its own, note that the branch no longer contains only that change — the approval I gave at 68b02f94 covered a 13-file increment and does not extend to this one, which is why I am recording a comment rather than re-issuing it.

chiga0
chiga0 previously approved these changes Oct 27, 2026

@chiga0 chiga0 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

审查总结

这是一个大型 PR(68 个文件,+5364/-317),实现了外部 workspace 的完整生命周期管理。相比之前的版本,新增了 Java 后端实现(48 个文件),形成了完整的前后端集成方案。

主要变更

1. TypeScript 前端(15 个文件)

  • 新增 hosted-workspace-external-files/1 profile,仅支持 read_file, write_file, edit, glob
  • 明确禁用 shell、monitor、capture、skills 等高级功能
  • 添加外部 workspace 的准入检查和生命周期管理

2. Java 后端(48 个文件)

  • ExternalWorkspaceMaterializationStore: 外部 workspace 物化存储,包含严格的输入验证和事务管理
  • WorkspaceExecutionStore: 执行存储,支持外部 workspace 的 claim/hold/release 操作
  • ManagedWorkspaceRegistry: workspace 注册表,管理外部 workspace 的准入
  • SessionLifecycleCoordinator: 生命周期协调器,处理 drain 和 close
  • WorkspaceRuntimeProvisioner: runtime provisioner,管理外部 runtime 的创建和销毁

3. SQL 迁移

  • 在 ma_request_receipt 表中添加 EXTERNAL_WORKSPACE namespace 支持

4. 测试覆盖

  • 大量单元测试覆盖各个存储层和业务逻辑
  • HostedExternalPublicFilesIT: 896 行的端到端集成测试,覆盖完整的注册→物化→执行→关闭流程
  • 设计文档中提到在 remote191 上通过了真实 MySQL 环境的验证

安全性分析

优点:

  1. 所有 SQL 查询都使用参数化查询,防止 SQL 注入
  2. 严格的事务隔离和锁定机制(FOR UPDATE)
  3. 幂等性检查防止重复操作
  4. 多层权限验证(operator, owner)
  5. 存储状态验证(REGISTERED, UNVERIFIED)
  6. 输入验证使用正则表达式,防止恶意输入

需要关注的点:

  1. 代码复杂度高,特别是 WorkspaceExecutionStore 中的多个重载方法
  2. 事务超时设置为 10 秒,需要确认是否足够
  3. 外部 workspace 的 claim/hold/release 逻辑需要仔细验证并发安全性

测试覆盖评估

测试覆盖非常全面:

  • 单元测试:覆盖各个存储层的核心逻辑
  • 集成测试:HostedExternalPublicFilesIT 覆盖完整流程
  • 设计文档中提到使用真实 MySQL 8.4.13 环境验证

建议

  1. 性能优化:WorkspaceExecutionStore 中的 isExternal 方法每次都查询数据库,可以考虑缓存
  2. 代码简化:authorizeAttachment 有多个重载版本,可以考虑合并或提取公共逻辑
  3. 文档更新:设计文档非常详细,但代码中的注释相对较少,建议补充关键逻辑的注释

结论

这是一个复杂但实现良好的 PR,覆盖了外部 workspace 的完整生命周期。代码质量高,测试覆盖全面,安全性考虑充分。虽然代码复杂度高,但通过严格的验证和事务管理确保了正确性。

建议:批准合并

主要理由:

  1. 设计文档详细,明确了实现边界和限制
  2. 代码实现与设计方案一致
  3. 测试覆盖全面,包括端到端集成测试
  4. 安全性考虑充分,使用了参数化查询、事务隔离和权限验证
  5. 设计文档中提到已在真实环境中验证通过

需要注意的是,这个 PR 仍然是完整目标的一部分(#15512),后续还需要实现 shell、monitor、capture 等功能。

@yiliang114

Copy link
Copy Markdown
Collaborator Author

Blocking red checks on the current head 2aaee5e1f1180b01e1349b01f985a6229c1d7a3d (both approvals from 14:59–15:00Z land after these runs, so they don't cover this state):

  • SDK Java (fast) / ubuntu-latest / Java 21 — job 122249662721, failed step Run Java SDK tests (self-hosted)
  • Managed Agent fast tier — job 122268218895, failed step Report the tier result
  • Managed Agent gate — job 122273667735, failed step Report the tier result

None of these is a required status check, so they don't show up on the PR page, but mergeStateStatus is UNSTABLE on them. Not retrying or digging in here — just flagging them so they aren't mistaken for a green head.

…ain claim

The external-files increment resolved the Workspace above the Agent pin, so a
request whose stored definition cannot take effect, or whose revision cannot be
selected, was refused on Workspace grounds first: it answered 404
workspace_required and a bare IllegalStateException instead of 409
agent_definition_unsupported / 400 unsupported_feature. Resolve the pin first
again and keep the external pin rewrite once the Workspace is known.

The close-claim validation admitted only DRAINING, but drainClaimedBinding
deliberately keeps a LOST binding in LOST until its stop proof commits, so the
arm refused its own claim with runtime_close_claim_pending instead of surfacing
the stop's runtime_broker_recovery_blocked. BindingRenewal now records that its
claim was taken on a LOST binding and admits that state.

The settlement probe reads the storage kind to refuse an EXTERNAL tree the
bridge holds no mount for, so its fixture needs the managed catalog rather than
an empty database. The lock-order canary gains the new ExternalWork.apply/3
ambiguity, whose callee locks the Session row first and never reads ma_turn.
@yiliang114
yiliang114 dismissed stale reviews from chiga0 and doudouOUC via abc86cf October 27, 2026 15:56
@yiliang114

Copy link
Copy Markdown
Collaborator Author

sdk-java-fast job 122249662721 was not a flaky lane: mvn clean test on packages/managed-agent-server ran 5836 tests with 17 failures across 5 classes, and every one reproduces locally and deterministically. The Managed Agent gate run on 68b02f9497f7 (merge of main) was green, so the regression arrived with #15685, which merged into this branch's base and is now part of this PR.

Real signatures (none of which the annotation summary showed):

  • ManagedAgentDefinitionAdmissionTest.java:403 — Status expected:<409> but was:<404> (6 cases), and ManagedWorkspaceAdmissionTest.java:1279 — IllegalStateException: Workspace resolution requires a creation transaction at ManagedWorkspaceRegistry.resolveForCreation:358.
  • RuntimeHarnessDrainTest.java:692 — expected: <runtime_broker_recovery_blocked> but was: <runtime_close_claim_pending> (the two LOST rows).
  • WorkspaceRuntimeInstallProbeTest.java:146 — BadSqlGrammarException: bad SQL grammar [SELECT storage_kind FROM ma_storage WHERE alias_key = ?], caused by JdbcSQLSyntaxErrorException: Table "MA_STORAGE" not found (this database is empty).
  • SessionRowLockOrderTest.java:609 — exemption snapshot now derives one extra entry, WorkspaceExecutionStore.java → ExternalWork.apply/3.

Root cause. Three production behaviour changes and two fixture/snapshot consequences, all from the external-files increment:

  1. ManagedAgentStore.insertWorkspaceSessionCommand resolved the Workspace (and read ma_storage) above the Agent pin. The pin is a property of the stored definition, not of the Workspace, so error precedence inverted: a definition that cannot take effect answered 404 workspace_required instead of 409 agent_definition_unsupported, and a revision that cannot be selected reached a durable resolution that a direct (non-proxied) store call has no transaction for. Fixed by resolving the pin first again, keeping the external pin rewrite after the Workspace is known.
  2. BindingRenewal.requireDrainClaim admitted only state DRAINING, but drainClaimedBinding deliberately parks a LOST binding in LOST until its stop proof commits — the arm was refusing the claim it had just taken, reporting runtime_close_claim_pending ("Original drain claim expired") instead of letting the stop fail with runtime_broker_recovery_blocked. BindingRenewal now records that its claim was taken on a LOST binding and admits that state; ownership, generation, drain-requested and lease-expiry checks are unchanged.
  3. The settlement probe reads the storage kind to refuse an EXTERNAL tree the bridge holds no mount for, so its fixture needs the managed catalog — it was building a bare in-memory H2 that the production path can never face. Fixed in the fixture only; no assertion changed.

Why the two test-side changes are the correct expectations. The lock-order canary's new ExternalWork.apply/3 exemption is the ambiguity between the lambdas' JdbcExternalWorkspaceOwnership.claim/4 (a receiver outside the audited package) and this file's own claim/4; that callee locks the ma_session row first and touches only ma_runtime_session rows, never ma_turn, so no Turn ordering is at stake and the file's derived locker/reader sets are unchanged. Nothing was weakened, skipped or ignored — no assertion was relaxed.

Verification (JDK 21.0.12.1, Maven 3.10.0, abc86cf7c7fef):

  • The five previously failing classes: Tests run: 217, Failures: 0, Errors: 0, Skipped: 0 — RuntimeHarnessDrainTest 68, ManagedWorkspaceAdmissionTest 74, ManagedAgentDefinitionAdmissionTest 24, SessionRowLockOrderTest 44, WorkspaceRuntimeInstallProbeTest 7.
  • Full module mvn clean test: 5811 run, 67 failures, 131 skipped — all 67 confined to five classes that are environment-bound in a fresh worktree (no built packages/core/dist; ERR_MODULE_NOT_FOUND .../packages/core/dist/src/managed-runtime/...; plus macOS POSIX semantics in ServiceAccountTest). A stashed baseline run of exactly those classes at the same commit reproduces the same 67 in the same classes, so the diff adds none.
  • mvn checkstyle:check checkstyle:check@runtime-broker-checkstyle: 0 violations, both executions. mvn -DskipTests verify (Checkstyle + SpotBugs high-confidence gate): BUILD SUCCESS.

Still CI-owned: the whole SDK Java (fast) lane with its built Core/CLI JavaScript, the MySQL-integration and Hosted/fault profiles, and the two downstream tier gates. Local H2 runs do not establish MySQL or process-recovery behaviour.

@yiliang114

Copy link
Copy Markdown
Collaborator Author

The repair is now pushed as abc86cf7c7fef34a500cff272075bd7cba26b64f. I independently checked that all four delivered files match the frozen patch reviewed locally. The scoped source review found no confirmed new blocker; this is not approval of the entire combined PR.

The five affected classes now report 217 tests, 0 failures, 0 errors, 0 skipped. That does not turn the wider local run green: its missing Core build artifacts and platform-specific failures remain recorded in the preceding repair report.

Additional local real-stack verification is in progress on an isolated copy of the repair: a real Spring/H2 public API and the actual Managed WebShell component, not a mocked HTTP backend. The ordinary Session-close UI is a nearby control, not proof of LOST-worker drain, MySQL behavior, or native stop safety. The final capture report will state those limits explicitly.

A separate reviewer has now been assigned the exact 2aaee5e1..abc86cf7 repair and retained test evidence. Current-head runtime evidence and the review result will follow here; CI and full Hosted/fault acceptance remain pending.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No blocking issues. LGTM! ✅

Not explored to full depth (tool budget reached): "agent reverse-audit (round 3)": did not trace RuntimeAdmission.requireStoppedRelease 's ma_session_head claim_generation/claim_lease_until comparison, so the three-way split in retiredHold…; "agent reverse-audit (round 2)": could not determine whether the external provider re-validates state.files / state.snapshots on a raw-file-history bind — requireExternalControl checks on…; chunk 6: did not execute the three new tests — the review worktree has no node_modules/packages/core/dist, so vitest cannot run here; the assertions were verified by rea…; "agent reverse-audit (round 1)": the base-side blob of RuntimeBrokerSupport.java is unreadable in this worktree ( git show <merge-base>:…/RuntimeBrokerSupport.java returns no content), so th…; "agent reverse-audit (round 3)": did not verify the §13 claims about the provisioner's internal original-identity checks, restart-from-saved-identity, redirect rejection and active-socket cance…, and 6 more.

Deferred under the convergence posture (round 27, not a blocker) — recorded, not requested in this round; 2 Critical(s) among them are deferred by their axes — fails-closed on new surface, where no wrong result is certified and the merge base had neither the surface nor the defect — and remain follow-up work recorded in the findings artifact:

  • packages/managed-agent-server/contracts/src/main/java/com/alibaba/qwen/code/managedagent/contracts/harness/HarnessConnector.java:167 — [review] Critical [fails-closed] [new-surface] The new default is inherited unchanged by SdkHarnessBound…
  • packages/managed-agent-server/runtime-external/src/main/java/com/alibaba/qwen/code/runtimebroker/provisioning/external/ExternalWorkspaceProvisioner.java:169 — [review] Critical [fails-closed] [new-surface] stopDrained is the first *succes…
  • docs/design/2026-10-25-external-hosted-workspace.md:269 — [review] Five of the six source links added in §14 resolve to non-existent paths: they omit the Maven module directory ( server/ , persistence/ , control-plane/ , contracts/ ) tha…
  • docs/design/2026-10-25-external-hosted-workspace.md:269 — [review] The new §14 enumeration of the closed option surface omits **memory** ( memoryStoreId ), which hasHostedExternalFilesExcludedOptions refuses for hosted-workspace-external…
  • docs/design/2026-10-25-external-hosted-workspace.md:291 — [review] The section that declares what remains of the goal is keyed to milestone label "C", which neither language version of the document ever defines — the taxonomy used everywher…
  • packages/cli/src/serve/hosted-harness-session.test.ts:17848 — [review] The new cold-load refusal test's expect(broker).not.toHaveBeenCalled() (line 17852) cannot fail: nothing on the load route calls HostedWorkspaceBroker.control — the …
  • packages/cli/src/serve/hosted-harness-session.ts:4860 — [review] Two of the three refusal clauses in the new external-files admission gate read values that are constants in every production process, so the "negotiated consumer token" the ga…
  • packages/cli/src/serve/hosted-harness-session.ts:5136 — [review] These two contract terms are permanently true whenever they are reached, because open() 's new first guard refuses the very same request shape earlier, so the lifecycle exemp…
  • packages/cli/src/serve/hosted-harness-session.ts:6181 — [review] The definition-side and journal-side clauses of the new external-files open guard — 40+ lines of refusal logic — have no test that fails without them; only the body-side claus…
  • packages/cli/src/serve/hosted-harness-session.ts:7309 — [review] the diff adds four cold-load refusals for the external profile; the two tests added ( refuses an external files saved session with Hook pin|extension config_install on cold lo…
  • packages/cli/src/serve/hosted-harness-session.ts:7309 — [review] The new cold-load refusal for an external-files Session whose unsettled turn ran in plan mode is unreachable: planMode can only enter a turn's durable admission through adm…
  • packages/cli/src/serve/hosted-workspace-tool-turn.ts:2106 — [review] This new 18-condition lane guard is the only thing standing between an external-files Session and every optional lane, and the diff tests exactly one of its conditions ( s…
  • packages/cli/src/serve/hosted-workspace-tool-turn.ts:2354 — [review] The external-files branch advertises the *resident/CSI restricted* read_file declaration (no pages ), while every other non-resident profile advertises HOSTED_PAGED_RE…
  • packages/cli/src/serve/managed-runtime-attestation-worker.test.ts:402 — [review] The new test named keeps publication routes unowned without an external publication asserts only the status, and in this worker two different mechanisms prod…
  • packages/managed-agent-server/adapters/src/main/java/com/alibaba/qwen/code/managedagent/harness/HarnessPoolConnector.java:518 — [review] the "external files" negotiation branch is written twice ( QwenHostedHarnessConnector and this pool va…
  • packages/managed-agent-server/adapters/src/main/java/com/alibaba/qwen/code/managedagent/harness/QwenHostedHarnessConnector.java:520 — [review] the diff adds the same external carve-out around verifyMountForProbe at two delivery sites (lin…
  • packages/managed-agent-server/contracts/src/main/java/com/alibaba/qwen/code/runtimebroker/spi/ExternalStorageRegistry.java:72 — [review] decodeRegistration , the tightened compact constructor (three inline matches("[A-Za-z0-9._-]{1,128}")…
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/session/ManagedAgentService.java:2021 — [review] A per-row durable read (two SQL queries) is added to the Session-listing path: webShellSessions …
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/session/SessionLifecycleCoordinator.java:123 — [review] This overload was half-updated for the external profile: the warmer half honours the profil…
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/workspace/runtime/ManagedRuntimeCoordinator.java:58 — [review] ManagedRuntimeCoordinator.resolver(...) has exactly one call site (production, Em…
  • …and 51 more (see the run report)
中文说明

无阻断问题。LGTM!✅

未探索到全部深度(达到工具调用预算):"agent reverse-audit (round 3)":did not trace RuntimeAdmission.requireStoppedRelease 's ma_session_head claim_generation/claim_lease_until comparison, so the three-way split in retiredHold…;"agent reverse-audit (round 2)":could not determine whether the external provider re-validates state.files / state.snapshots on a raw-file-history bind — requireExternalControl checks on…;chunk 6:did not execute the three new tests — the review worktree has no node_modules/packages/core/dist, so vitest cannot run here; the assertions were verified by rea…;"agent reverse-audit (round 1)":the base-side blob of RuntimeBrokerSupport.java is unreadable in this worktree ( git show <merge-base>:…/RuntimeBrokerSupport.java returns no content), so th…;"agent reverse-audit (round 3)":did not verify the §13 claims about the provisioner's internal original-identity checks, restart-from-saved-identity, redirect rejection and active-socket cance…,另有 6 条。

收敛姿态下延后(第 27 轮,非阻断)——已记录,本轮不要求修改;其中 2 条 Critical 按其失败方向与对照基线延后——fails-closed 且 new-surface:未认证任何错误结果,且 merge base 既无该功能面也无该缺陷——作为后续工作记录在 findings 工件中:共 71 条(原文未翻译,列表见上方英文部分)。

— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.27.2)

Merge refs/heads/upstream-main (0b333d3) into feat/15512-completion
(983ae8a). Four files conflicted; the resolution keeps both sides'
deltas and records every choice below.

1. managed-schema/V1__managed_schema.sql
   Pure union, no object dropped from either side. The branch's only schema
   delta was the EXTERNAL_WORKSPACE receipt namespace; main added
   RESOURCE_ALLOCATE to the same ck_ma_request_namespace CHECK. The merged
   CHECK admits both, ordered to match ManagedSchemaContract.ReceiptNamespace
   (EXTERNAL_STORAGE, EXTERNAL_WORKSPACE, MEMORY, SIDE_QUERY,
   RESOURCE_ALLOCATE), which ManagedSchemaTest iterates.
   All main-owned objects kept as-is: ma_journal_pack + ix_ma_journal_pack_*
   indexes, ck_ma_journal_record_bytes, nullable ma_session_journal_tx.record_bytes,
   ma_session.preview/preview_revision, ma_user_message_queue.queue_revision,
   ma_session_head.packed_through_revision. Verified object-by-object against
   both parents (CREATE TABLE/INDEX sets are a superset of both).

2. RuntimeBrokerService + drain cluster
   Both sides independently decomposed the same region: main's #16922 facade
   decomposition (RuntimeDrainCoordinator, RuntimeSessionRelease, top-level
   BindingRenewal) and the branch's partial RuntimeDrainRelease split. Main's
   shape is adopted as the skeleton because it is the larger refactor and
   because main lowered the class-size ceiling to 1930; the branch's 2817 pin
   may not be restored. RuntimeDrainRelease is folded into
   RuntimeDrainCoordinator and deleted (its only consumers were the facade and
   itself).
   Mechanics: main's versions of the moved methods are pure moves of the merge
   base, while the branch's carry behaviour, so the branch's semantics are
   ported into main's file homes:
     - drainClaimedBinding: isLiveWorkerStopRecoverable gate (a restart-fenced
       external-workspace LOST binding may stop its live worker), wider stop
       precondition (receipt | absence | authority | lost), acknowledge-then-stop
       via stopAcknowledgedRuntime, requireDrainClaim re-read, persisted receipt
       before releaseRetiredHolders, and the receipt-identity/lease fence before
       RELEASED.
     - stopAcknowledgedRuntime: branch's external-workspace arm
       (drainClaimForIo + acknowledge + stopDrained) plus its private
       EXTERNAL_WORKSPACE guard; main's observation.matchesRuntime() check kept.
     - acknowledgeDrainedTools: admits EXTERNAL_WORKSPACE and threads
       (renewal, authority) so each acknowledge re-reads the drain claim. The
       branch's second lease-null guard was unreachable behind the combined
       first guard and is not carried over.
     - releaseDrainedSessions / releaseRetiredHolders: claim re-read, receipt
       match, authority-scoped session and per-record re-validation.
     - drainResourceBindings: external-workspace short-circuit to
       drainBinding(binding, null, authority).
     - releaseSavedSession: the loss path stops through stopAcknowledgedRuntime
       instead of a bare stopDrained.
   BindingRenewal gains the branch's lostClaim state, isDrainClaimStateValid
   usage, the stopped-claim guard on persistResourceHandle, and
   verifyDrainReceiptIdentity. The two statics that BindingRenewal and the
   coordinator share moved to RuntimeBrokerSupport. supportsDrainedStopKind
   stays on the facade for EmbeddedRuntimeBroker.
   Facade-only main changes (isProtocolV3/isPublicationV3 call sites,
   acknowledgeExecution, getExecution, observeExtensionOwner, releaseSession
   and finishSessionRelease through RuntimeSessionRelease) are kept as main
   wrote them. The branch's external-workspace refusal in startExecution
   (settlePrepared as workspace_tool_unsupported before dispatch) is kept.

3. capability-parity/managed-surface.txt
   Re-derived with ManagedSurfaceCaptureTest -Dcapability.parity.capture=true;
   the regenerated inventory carries both main's STORE_RESOURCE_* routes and
   the branch's EXTERNAL_WORKSPACE_MATERIALIZE route.

4. class-size-ratchet.properties
   No pin raised; GLOBAL_MAX_LINES stays 2662. RuntimeBrokerService re-pinned
   to its measured 1928 (main's conflict-side 1930 was the branch's 2817
   alternative), AgentSessionPolicies to 791 (branch pinned 803).
   JdbcRuntimeBindingRepository grew past the global ceiling through the
   branch's external-ownership delta, so unverifiedWorkspaceHolder moved to
   JdbcRepositorySupport (pure move, call sites re-qualified in the file's own
   style). Other pure moves to stay under the ceiling: requireDuration and
   newScheduler to RuntimeBrokerSupport, selectApprovalMode to its only
   consumer ExternalWorkspaceSessionPolicies.

Verification (JDK 21, offline Maven): 575 tests green across
ClassSizeRatchetTest, SessionRowLockOrderTest, ManagedStoreDecompositionTest,
ManagedSchemaTest, ManagedSurfaceCaptureTest, RuntimeBrokerServiceTest,
RuntimeExternalWorkspaceDrainTest, RuntimeHarnessDrainTest,
ManagedUserMessageStoreTest, BrokerRenewalPinningTest,
DurableRuntimeRecoveryTest, ManagedAgentDefinitionAdmissionTest,
ManagedWorkspaceAdmissionTest, ManagedApprovalChangeTest,
SessionCreationCommandContractTest, ExternalWorkspaceMaterializationTest.
Both checkstyle goals clean (checkstyle:check and
checkstyle:check@runtime-broker-checkstyle). MySQL ITs left to CI.
@yiliang114

Copy link
Copy Markdown
Collaborator Author

Sync with origin/main (0b333d37db9c0) — conflict resolution and verification

Merge commit: 32c30016c9a78 (parents 983ae8a455da9 + 0b333d37db9c0). Four files conflicted; the rest of the 268-file merge auto-resolved. Nothing from either side was dropped.

1. V1__managed_schema.sql — pure union

The branch's only schema delta was the EXTERNAL_WORKSPACE receipt namespace; main added RESOURCE_ALLOCATE to the same ck_ma_request_namespace CHECK. The merged CHECK admits both, ordered to match ManagedSchemaContract.ReceiptNamespace (EXTERNAL_STORAGE, EXTERNAL_WORKSPACE, MEMORY, SIDE_QUERY, RESOURCE_ALLOCATE) — the order ManagedSchemaTest.theCurrentReceiptNamespaceCheckAdmitsEveryShippedNamespace iterates.

Every main-owned object is intact: ma_journal_pack + ix_ma_journal_pack_through / ix_ma_journal_pack_state, ck_ma_journal_record_bytes, nullable ma_session_journal_tx.record_bytes, ma_session.preview / preview_revision, ma_user_message_queue.queue_revision, ma_session_head.packed_through_revision. Checked object-by-object against both parents: the merged CREATE TABLE/CREATE INDEX set is a superset of each parent's.

2. RuntimeBrokerService and the drain cluster — one decomposition, both sides' behaviour

Both sides decomposed the same region independently: main's #16922 facade decomposition (RuntimeDrainCoordinator, RuntimeSessionRelease, top-level BindingRenewal) and the branch's partial RuntimeDrainRelease split. Main's shape is the skeleton — it is the larger refactor, main's callers (RuntimeBindingProvisioning's Function<..., BindingRenewal> factory) expect it, and main lowered the class-size ceiling to 1930, which the branch's 2817 pin may not override. RuntimeDrainRelease is folded into RuntimeDrainCoordinator and removed (its only consumers were the facade and itself).

Main's versions of the moved methods are pure moves of the merge base; the branch's carry behaviour, so the branch's semantics are ported into main's file homes:

method branch behaviour kept
drainClaimedBinding isLiveWorkerStopRecoverable gate (a restart-fenced external-workspace LOST binding stops its live worker), wider stop precondition (receipt / absence / authority / lost), acknowledge-then-stop, claim re-read, persisted receipt before releaseRetiredHolders, receipt+lease fence before RELEASED
stopAcknowledgedRuntime external-workspace arm (drainClaimForIo → acknowledge → stopDrained) and its private EXTERNAL_WORKSPACE guard, on top of main's observation.matchesRuntime check
acknowledgeDrainedTools admits EXTERNAL_WORKSPACE; threads (renewal, authority) so each acknowledge re-reads the drain claim
releaseDrainedSessions, releaseRetiredHolders claim re-read, receipt match, authority-scoped session, per-record re-validation
drainResourceBindings external-workspace short-circuit to drainBinding(binding, null, authority)
releaseSavedSession loss path stops through stopAcknowledgedRuntime instead of a bare stopDrained
startExecution external-workspace refusal settles the prepared row as workspace_tool_unsupported before dispatch

BindingRenewal gains the branch's lostClaim state, isDrainClaimStateValid check, stopped guard on persistResourceHandle, and verifyDrainReceiptIdentity; the two statics shared with the coordinator moved to RuntimeBrokerSupport. supportsDrainedStopKind stays on the facade for EmbeddedRuntimeBroker.

Facade-only main changes are kept as main wrote them (isProtocolV3 / isPublicationV3 call sites, acknowledgeExecution, getExecution, observeExtensionOwner, releaseSession / finishSessionRelease via RuntimeSessionRelease).

One deliberate omission: the branch's acknowledgeDrainedTools had a second lease == null guard that is unreachable behind the combined first guard, so it is not carried over.

3. capability-parity/managed-surface.txt — re-derived

Regenerated with -Dcapability.parity.capture=true; the inventory carries both main's STORE_RESOURCE_ALLOCATE / STORE_RESOURCE_UPLOAD / STORE_RESOURCE_FINALIZE routes and the branch's EXTERNAL_WORKSPACE_MATERIALIZE.

4. class-size-ratchet.properties — no pin raised, GLOBAL_MAX_LINES unchanged (2662)

  • RuntimeBrokerService: 1930 → 1928 (measured; the conflicted alternative was the branch's stale 2817)
  • AgentSessionPolicies: 803 → 791 (measured)
  • JdbcRuntimeBindingRepository crossed the global ceiling through the branch's external-ownership delta, so unverifiedWorkspaceHolder moved to JdbcRepositorySupport (pure move; call sites re-qualified in the file's own style).
  • Other pure moves to stay under the ceiling: requireDuration and newScheduler → RuntimeBrokerSupport, selectApprovalMode → its only consumer ExternalWorkspaceSessionPolicies.

Verification (JDK 21, offline Maven)

575 tests green: ClassSizeRatchetTest, SessionRowLockOrderTest, ManagedStoreDecompositionTest, ManagedSchemaTest, ManagedSurfaceCaptureTest, RuntimeBrokerServiceTest (199), RuntimeExternalWorkspaceDrainTest, RuntimeHarnessDrainTest (74), ManagedUserMessageStoreTest, BrokerRenewalPinningTest, DurableRuntimeRecoveryTest (38), ManagedAgentDefinitionAdmissionTest, ManagedWorkspaceAdmissionTest, ManagedApprovalChangeTest, SessionCreationCommandContractTest, ExternalWorkspaceMaterializationTest.

Both checkstyle goals clean: checkstyle:check and checkstyle:check@runtime-broker-checkstyle (the latter is what covers the runtimebroker package; it caught an unused import the plain goal did not).

MySQL integration tests are left to CI.

Self-audit

Two passes over the full diff. Automated checks: every file added by either side is present (only RuntimeDrainRelease is gone, by design, folded into the coordinator); every file main deleted is deleted here; every branch-added and main-added line in the drain corpus, the persistence classes touched by the ratchet moves, and the schema objects is accounted for, either present or in its documented new home.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[Critical] Blocking finding(s) follow.

Partially reviewed — gaps disclosed.

Unresolved, please confirm:

Not reviewed: reverse audit did not converge — rounds 1 and 2 each reported findings and round 3 of the 3-round cap was not run; the 61 Suggestion-level and 4 Critical-level candidates those rounds raised beyond the verified set were not individually verified.

Not explored to full depth (tool budget reached): "agent reverse-audit (round 2)": did not trace how the release-side claim record is constructed (whether it carries provisionSeed / resourceHandle ), so the new external seed/handle equality…; "agent reverse-audit (round 1)": could not resolve whether the external worker's attest admission also requires the storage boot member that ExternalWorkspaceProvisioner.bootDocument adds b…; chunk 34: runtime execution of ExternalWorkspaceProvisionerTest under Maven (not run — the shared review worktree was left unbuilt to avoid writing target/ trees into…; "agent reverse-audit (round 1)": could not verify the new file's "pure delegation" claim against the pre-refactor inline predicates — AgentSessionAdmissions at the merge base 0b333d37db con…; chunk 21: did not verify how an external worker replies to acknowledgeV2 for a row that was cancelled before it ever dispatched (whether it errors and so blocks the sam…, and 4 more.

Deferred under the convergence posture (round 28, not a blocker) — recorded, not requested in this round; 1 Critical(s) among them are deferred by their axes — fails-closed on new surface, where no wrong result is certified and the merge base had neither the surface nor the defect — and remain follow-up work recorded in the findings artifact:

  • packages/managed-agent-server/runtime-broker/src/main/java/com/alibaba/qwen/code/runtimebroker/service/RuntimeExecutionDispatcher.java (+1 locations) — [review] Critical [fails-closed] [new-surface] the new external-drain guard requires eve…
  • docs/design/2026-10-25-external-hosted-workspace.md (+2 locations) — [review] the new section 14 code links point into a packages/managed-agent-server/src/main/java tree that does not exist, so five of six links 404; the package is multi-…
  • packages/cli/src/serve/hosted-harness-session.ts (+1 locations) — [review] the two capability-granting additions for the external-files profile (the live approval-reader list at 851-856 and the selectable approval-definition list at 610…
  • packages/cli/src/serve/hosted-harness-session.ts (+1 locations) — [review] the cold-load refusal that scans committed domain.committed events for sixteen closed lanes has no test that ever produces a hit, and the test named for the Hook l…
  • packages/cli/src/serve/hosted-harness-session.ts (+1 locations) — [review] the retained H6b comment still asserts "every hosted Session owns its automation funnel", but the line it introduces now skips that funnel for the external-files p…
  • packages/cli/src/serve/managed-runtime-attestation-worker.test.ts (+1 locations) — [review] the "unowned without an external publication" guard is asserted by status code only, and Express's default 404 satisfies it, so the test cannot go r…
  • packages/managed-agent-server/adapters/src/main/java/com/alibaba/qwen/code/managedagent/harness/HarnessPoolConnector.java (+1 locations) — [review] the pool connector's new external-files admission branch ( supportsLifecycle ) and its supp…
  • packages/managed-agent-server/contracts/src/main/java/com/alibaba/qwen/code/runtimebroker/spi/ExternalStorageRegistry.java (+1 locations) — [review] RegisteredExternalStorage re-implements, as an independent copy, what com.alibaba.qwen.c…
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/session/ManagedAgentService.java (+1 locations) — [review] the WebShell capability surface for the external-files deployment is untested: the branc…
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/workspace/runtime/WorkspaceRuntimeTransport.java (+1 locations) — [review] the transport-level refusals added to the external execute path — and …
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/AgentSessionPolicies.java (+1 locations) — [review] the new eleven-condition later-Turn admission gate for the external-files profile has…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/JdbcManagedUserMessageStore.java (+1 locations) — [review] input() issues a fresh SELECT tool_profile FROM ma_session on every submi…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/JdbcManagedWorkspaceRegistry.java (+1 locations) — [review] the external-workspace eligibility rule has two independent implementations i…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/JdbcWorkspaceExecutionStore.java (+1 locations) — [review] authorizeExternal gates on a hand-copied profile string instead of the expor…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/JdbcWorkspaceExecutionStore.java (+1 locations) — [review] assertHeld runs the external hold check in the acquire shape ( acquiring = t…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/WorkspaceMigrationAdmission.java (+1 locations) — [review] requireExternalPhysicalOpen is the second copy of the same fail-closed "phys…
  • packages/managed-agent-server/runtime-broker/src/main/java/com/alibaba/qwen/code/runtimebroker/service/RuntimeBindingProvisioning.java (+1 locations) — [review] this branch is unreachable — it sits in the PROVISIONING -only path but requir…
  • packages/managed-agent-server/runtime-broker/src/main/java/com/alibaba/qwen/code/runtimebroker/service/RuntimeDrainCoordinator.java (+1 locations) — [review] the active-execution half of the new external guard in the single-argument stopAc…
  • packages/managed-agent-server/runtime-broker/src/main/java/com/alibaba/qwen/code/runtimebroker/service/RuntimeExecutionDispatcher.java (+1 locations) — [review] this adds a third independent copy of the external-workspace file-tool allowlis…
  • packages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/config/ManagedAgentProperties.java (+1 locations) — [review] isExternalWorkspaceFilesConfigured() re-discovers the RuntimeProviderFactory service load…
  • …and 5 more (see the run report)
中文说明

仅完成部分审查,审查缺口已披露。

未决,请确认:共 35 条(原文未翻译,列表见上方英文部分)。

未审查(原文为英文):reverse audit did not converge — rounds 1 and 2 each reported findings and round 3 of the 3-round cap was not run; the 61 Suggestion-level and 4 Critical-level candidates those rounds raised beyond the verified set were not individually verified.

未探索到全部深度(达到工具调用预算):"agent reverse-audit (round 2)":did not trace how the release-side claim record is constructed (whether it carries provisionSeed / resourceHandle ), so the new external seed/handle equality…;"agent reverse-audit (round 1)":could not resolve whether the external worker's attest admission also requires the storage boot member that ExternalWorkspaceProvisioner.bootDocument adds b…;chunk 34:runtime execution of ExternalWorkspaceProvisionerTest under Maven (not run — the shared review worktree was left unbuilt to avoid writing target/ trees into…;"agent reverse-audit (round 1)":could not verify the new file's "pure delegation" claim against the pre-refactor inline predicates — AgentSessionAdmissions at the merge base 0b333d37db con…;chunk 21:did not verify how an external worker replies to acknowledgeV2 for a row that was cancelled before it ever dispatched (whether it errors and so blocks the sam…,另有 4 条。

收敛姿态下延后(第 28 轮,非阻断)——已记录,本轮不要求修改;其中 1 条 Critical 按其失败方向与对照基线延后——fails-closed 且 new-surface:未认证任何错误结果,且 merge base 既无该功能面也无该缺陷——作为后续工作记录在 findings 工件中:共 25 条(原文未翻译,列表见上方英文部分)。

— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.27.2)

@yiliang114
yiliang114 disabled auto-merge November 12, 2026 14:20
…lved)

Also migrate the two branch test files left on the InMemory repositories
retired by #16953 to JDBC-on-H2, following the retirement design doc's
house pattern (UUID-named H2, fake-clock DataSource shim, deterministic
binding ids, claim-aware state injection):

- RuntimeExternalWorkspaceDrainTest keeps all 17 scenarios, including the
  R2-1 witness restartLostLiveWorkerWithoutReceiptStopsForReceiptAndReleases.
  The fixture now seeds the control-plane rows the JDBC stopped-release
  guards verify: EXTERNAL storage registration, materialized Workspace,
  Session root pin, storage-ownership claim, and the lifecycle claim on the
  harness head; the ensure step uses the real provisioner so the boot
  identity matches the registration.
- EmbeddedRuntimeBrokerTest's registration-drift test swaps to the JDBC
  repositories on its existing H2 source.

No production behavior change beyond the merge resolutions and the import
repair they required.
# Conflicts:
#	packages/cli/src/serve/hosted-harness-session.ts
#	packages/cli/src/serve/workspace-recovery-session.test.ts
#	packages/managed-agent-server/contracts/src/main/java/com/alibaba/qwen/code/managedagent/contracts/workspace/WorkspaceToolProfiles.java
#	packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/AgentSessionCommands.java
#	packages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/config/runtime/EmbeddedRuntimeBroker.java
#	packages/managed-agent-server/verification/src/test/resources/capability-parity/managed-surface.txt
#	packages/managed-agent-server/verification/src/test/resources/class-size-ratchet.properties
@yiliang114

Copy link
Copy Markdown
Collaborator Author

Sync with origin/main (6f754be654890) — conflict resolution, test migration, verification

Two merge commits, same policy as the previous syncs — main's shape is the skeleton, branch semantics ported into main's file homes:

  1. c55b524cc8815 (parents 32c30016c9a78 + c865e869f6613) — nine paths conflicted; the rest auto-resolved. Also carries the refactor(managed-agent): retire the InMemory runtime broker repositories #16953 test migration below.
  2. f0735c44c1ed6 (parents c55b524cc8815 + 6f754be654890) — main advanced nine more commits while this round was in verification (feat(managed-agent): fixed-interval /loop schedules for Managed Sessions #17088 fixed-interval /loop, feat(managed-agent): add the Managed Web Terminal #16866 Managed Web Terminal, and fixes); seven paths conflicted, resolved below. The intermediate main commit 110199a7132f6 (external-context test deflake) touches no PR file.

Conflicts and how each was resolved

path resolution
packages/cli/src/serve/capability-parity.ts union: branch's EXTERNAL_WORKSPACE_MATERIALIZE + main's INTERNAL_CLIENT_FILES_MCP (#16844)
packages/cli/src/serve/hosted-harness-session.ts main's self-paced /loop (#16835) stays unconditional — loop_wakeup is profile-gated (hosted-workspace-shell/3) and the external-files exclusion list does not cover loops; the branch's !externalFiles gate is kept around automations and channels only
packages/cli/src/serve/hosted-workspace-profiles.test.ts union of the branch's closed-options test and main's shell/3 + public-shell-profile tests
ManagedAgentService.java main removed the rename-lease machinery (#17006 sync Session rename): dropped renameLeaseDuration/renameClock/configureRenameDelivery; kept the branch's externalFilesConfiguration gate (re-derived via @Autowired configureExternalFiles from the provisioner kind) alongside main's configureClientFiles
AgentSessionCommands.java kept the branch's TURN_SESSION_PROJECTION_GUARD; added main's hosted-workspace-shell/3 to its profile IN-list
JdbcRuntimeBindingRepository.java took main's RuntimeAdmissionFences extraction (#16936): the branch's local copies of the fence methods were byte-identical to main's extracted engine, so both hunks resolve to main's side; re-qualified the branch's call sites (JdbcExternalWorkspaceOwnership, WorkspaceMigrationAdmission, ExternalWorkspaceMaterializationStore, two test classes) to RuntimeAdmissionFences.*; restored the branch's WorkspaceExecutionProfile import lost in the import-block rewrite
WorkspaceMigrationMain.java main's pack-aware readers (#17047: MaintenanceObjectStores.readPacks, 3-arg bindings ctor) + restored the branch's 4-arg WorkspaceRuntimeProvisioner call the auto-merge had dropped
capability-parity/managed-surface.txt route lines auto-merged to the exact union (235 routes = 229 branch + 234 main − 228 shared, verified by set comparison); digest header re-derived over the sorted route keys per ManagedSurfaceCapture.digest
lock-contract/sql-owners.txt deleted — main retired the whole lock-contract meta-ratchet (#17044); no Java or POM reference remains

Second merge (6f754be654890) — seven conflicts

path resolution
packages/cli/src/serve/hosted-harness-session.ts (2 sites) union: branch's HOSTED_WORKSPACE_EXTERNAL_FILES_PROFILE + main's hosted-workspace-files/4 in both approval-selection profile lists
packages/cli/src/serve/workspace-recovery-session.test.ts union of the branch's external-files entry and main's files/4 entry in the capture it.each
WorkspaceToolProfiles.java kept the branch's external-files ternary in supportsApprovalSelection; added main's FILES_V4 to the else arm
AgentSessionCommands.java kept the branch's TURN_SESSION_PROJECTION_GUARD structure (including the external-files is_plan_enabled=FALSE projection); extended the guard's profile IN-list with main's hosted-workspace-shell/4 and hosted-workspace-files/4
EmbeddedRuntimeBroker.java union: branch's 5-arg WorkspaceRuntimeResolver construction (external registrations) + main's setBindingRepository terminal-digest hint (#16866)
capability-parity/managed-surface.txt re-captured from the merged SurfaceRegistry enum via -Dcapability.parity.capture=true; route set verified as the exact union (239 = 229 branch + 238 main − 228 shared), digest 89e57b71…
class-size-ratchet.properties RuntimeBrokerService ceiling lowered to the merged file's 1909 lines (main #16866 extracted TerminalHolds/BackgroundProcessAdmission, 1917; branch wiring adds the rest); JdbcRuntimeBindingRepository pin unchanged at 2319

The #17088 fixed-interval cron trio (session.crons) stays unconditional like main's self-paced loops: the branch's !externalFiles gate remains around automations and channels only, and cron loop-wakeup is already profile-gated to shell/3+shell/4. Whether external-files Sessions should own cron arming is the same product decision deferred for loops — noted here, not silently changed.

Test migration forced by main #16953 (InMemory retirement)

Main deleted the three InMemory runtime-broker repositories and migrated all its consumers to JDBC-on-H2. Two branch test files still referenced them after the merge:

  • EmbeddedRuntimeBrokerTest.externalCloseCapabilityContainsRegistrationDriftAndReadFailure — the auto-merge kept the branch's added test but took main's import block; swapped the three InMemory constructions to the JDBC repositories on the test's existing H2 source (the file's own broker(...) helper pattern).
  • RuntimeExternalWorkspaceDrainTest — full fixture migration to JDBC-on-H2 following the mechanisms in docs/design/2026-11-11-retire-inmemory-runtime-repositories.md (house H2 pattern, fake-clock DataSource shim, deterministic binding ids, operation-claim-aware state injection). All 17 scenarios preserved, including the R2-1 witness restartLostLiveWorkerWithoutReceiptStopsForReceiptAndReleases. No production code changed.

CI attribution (red review-pr on 32c30016)

Run 43052913353 / job 130637805803: the review itself was posted successfully; the job then died writing its log (Failed to write qwen review log. + core dump in the tee pipeline, exit 1). The fallback-comment job succeeded. This is reviewer infrastructure, not PR code; the latest bot review (5863058887, round 28) reports findings: [].

Stale CHANGES_REQUESTED (5736220215, R2-1)

The CR reviewed head eb57393f and refused a LOST external binding with no drain receipt before the drain claim. Fixed by a2301bc7595b ("stop a lost live worker before releasing its rows", ancestor of the current head): isLiveWorkerStopRecoverable now admits exactly that state (LOST, no absence evidence, no receipt, no active executions, external-workspace request) into the drain, which stops the live worker for a receipt, persists it, and only then releases the sessions and the retired storage holder. Re-verified line-by-line in the merged RuntimeDrainCoordinator/RuntimeBrokerSupport; the witness restartLostLiveWorkerWithoutReceiptStopsForReceiptAndReleases fences READY→LOST with an active session row and asserts stop→cleanup→receipt→RELEASED. Dismissing the stale review with this evidence. The CR's secondary note (MySQL lanes skipped) is tier selection, not a failure.

Verification

JDK 21, Maven from packages/managed-agent-server (offline; one online fetch of spring-boot-starter-websocket 3.5.16, new from main #16866):

  • mvn -pl verification -am test -Dtest='ClassSizeRatchetTest,ManagedSchemaTest,ManagedSurfaceCaptureTest,SurfaceRegistryGateTest,RuntimeExternalWorkspaceDrainTest,ExternalWorkspaceOwnershipTest,WorkspaceLifecycleStoreTest,ExternalWorkspaceMaterializationTest,ManagedAgentSessionCapabilitiesTest,ManagedModelSelectionTest,ManagedUserMessageStoreTest,ManagedWorkspaceAdmissionTest,SessionCreationCommandContractTest,EmbeddedRuntimeBrokerTest' — 354 tests, 0 failures, 0 errors on the pushed head, including the migrated RuntimeExternalWorkspaceDrainTest (17/17) and EmbeddedRuntimeBrokerTest (54/54).
  • checkstyle:check and checkstyle:check@runtime-broker-checkstyle — 0 violations across all 15 modules.
  • ManagedSurfaceCaptureTest with -Dcapability.parity.capture=true — re-captured the inventory; the route set was verified as the exact branch∪main union (239 routes) before committing.
  • TypeScript: Prettier clean on all 17 PR-touched .ts files; typecheck and unit gates run in CI (no local node_modules in this worktree).

Deferred bot items from round 28 remain deferred per the >5-round scope policy; nothing optional was added this round. Scope snapshot vs origin/main (6f754be654890): 98 files +6420/−589 — implementation 65 files +2898/−484 (pre-round head: +2897/−497 against its then-base; production scope unchanged), test 31 files +3364/−66 (the #16953 migration), docs 2 files +158/−39.

中文说明

本轮只做必要的收尾:分两步合并最新 main(先到 c865e86,验证期间 main 又前进了 9 个提交,再合到 6f754be),共解决 16 处冲突——main 的骨架为准,分支语义移植进 main 的文件位置(fence 引擎提取、pack-aware 读取、rename 重构、shell/3 profile、client-files;第二步是 files/4 profile 并集、投影守卫 IN 列表扩展、Web Terminal 的 resolver 接线、ratchet 上限下调)。managed-surface 清单用合并后的枚举重新 capture,路由集合验证为精确并集(239 条);main 已删除的 lock-contract 清单随之删除。#17088 的 fixed-interval cron 与 loops 同样保持无条件,external-files 是否开放 cron 属产品决策,与 loops 一并留作后续,不在本轮擅自扩大门控。

main #16953 退役了 InMemory 仓库,两个分支测试文件按其退役设计文档迁移到 JDBC-on-H2,全部场景保留(含 R2-1 见证测试),不改任何生产代码。

CI 红项 review-pr 属评审基础设施故障(评审已发出,写日志时 tee 管道崩溃),非 PR 代码问题。过期的 CHANGES_REQUESTED(R2-1:无回执 LOST 绑定被提前拒绝)已由 a2301bc 修复并在合并后代码中逐行复核,附证据 dismiss。

本地验证:JDK 21 本地 Maven:14 个聚焦测试类共 354 个用例全绿(含迁移后的 drain 17/17、Embedded 54/54);两个 checkstyle goal 全部 15 个模块 0 违规;surface 清单用合并后枚举重新 capture,路由集合验证为精确并集(239 条)后提交。TS 侧 PR 涉及的 17 个文件 Prettier 全过,typecheck/单测由 CI 覆盖(worktree 无本地 node_modules)。范围快照对 origin/main(6f754be6):98 文件 +6420/−589,其中生产代码 65 文件 +2898/−484,与本轮开始前基本持平(+2897),测试增量来自 #16953 迁移,无功能范围扩张。。TS 侧 Prettier 通过,typecheck/单测由 CI 覆盖。按 >5 轮范围策略,本轮不加任何可选改动,bot 第 28 轮的延期项继续延期。

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Unresolved, please confirm:

  • [Critical] R3-1 (comment 4414111908) — could not establish at this head whether releasing a retired non-holder Session still aborts the cascade
  • [Critical] R3-2 (comment 4414111896) — could not establish the queued-message dispatcher's current rejection classification
  • [Critical] R16-1 (comment 4503191297) — could not establish whether a lease-less PROVISIONING external binding can provision again
  • [Critical] R1-16 (comment 4392432132) — could not read the two named test bodies whole within this round

Not explored to full depth (tool budget reached): "agent reverse-audit (round 2)": §13's wire-level claims (colon escaping of publication:* routes, the exact stop headers, the 64 KiB envelope, redirect rejection) were not re-verified against…; "agent reverse-audit (round 3)": did not confirm that the CLI's external-files lane reserves its file-tool executions as v2 (no runtimeProtocol , no publication grant) — I verified the referen…; chunk 23: cross-language check that the worker's ManagedContextProtocol.ATTEST_PATH attestation echoes the context-only boot (the test's attestationResponse(ManagedCon…; chunk 33: I did not execute the new tests (a verification Maven run); the pass/fail questions above were settled by reading the transport, parser and value-coercion sou…; "agent reverse-audit (round 3)": could not execute RuntimeExternalWorkspaceDrainTest — compiling or mvn -ing in this shared worktree is forbidden by the brief — so its greenness is inferred …, and 3 more.

Deferred under the convergence posture (round 29, not a blocker) — recorded, not requested in this round; 3 Critical(s) among them are deferred by their axes — fails-closed on new surface, where no wrong result is certified and the merge base had neither the surface nor the defect — and remain follow-up work recorded in the findings artifact:

  • packages/cli/src/serve/hosted-workspace-tool-turn.ts:2337 — [review] Critical [fails-closed] [new-surface] the external-files lane guard omits clientFiles and the profile's declarations() returns before clientFilesDeclarations(), so a regis…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/ExternalWorkspaceSessionPolicies.java:30 — [review] Critical [fails-closed] [new-surface] the blanket catch converts a retryable registra…
  • packages/managed-agent-server/runtime-broker/src/main/java/com/alibaba/qwen/code/runtimebroker/service/RuntimeBrokerSupport.java:453 — [review] Critical [fails-closed] [new-surface] the LOST-recovery exemption excludes a receipt-backed LOST…
  • packages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/api/ExternalStorageRegistrationController.java:114 — [review] Extracting the operator gate into requireOperator silently renames the 403 code of the **p…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/AgentSessionPolicies.java:697 — [review] requireExternalTurnAllowed issues the same ma_request_receipt read twice per Turn — creatio…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/JdbcWorkspaceExecutionStore.java:135 — [review] The new external gate issues the same ma_storage read twice per authorize() call — an…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/JdbcManagedWorkspaceRegistry.java:310 — [review] The diff replaces the single summary(ResultSet) mapper that all read paths shared with…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/JdbcWorkspaceExecutionStore.java:657 — [review] The new helper re-implements the "no active execution" predicate a fourth time instead of…
  • docs/design/2026-10-25-external-hosted-workspace.md:269 — [review] All five newly added source links in §14 point at paths that do not exist in this repository; the packages/managed-agent-server/<module>/ segment is missing from every one…
  • packages/managed-agent-server/runtime-broker/src/main/java/com/alibaba/qwen/code/runtimebroker/service/RuntimeDrainCoordinator.java — [review] Every execution row of an external-workspace drain re-runs the harness-cleanup DB fence — N+2 ide…
  • packages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/config/ManagedAgentProperties.java:541 — [review] isExternalWorkspaceFilesConfigured() builds a RuntimeProviderRegistry — whose constructor fully iter…
  • docs/design/2026-10-25-external-hosted-workspace.zh-CN.md:245 — [review] Every Java source link added by §14 is dead — the new milestone paragraph's "see the code" pointers resolve to paths that do not exist in the tree (the English twin, …
  • packages/managed-agent-server/verification/src/test/java/com/alibaba/qwen/code/managedagent/session/ManagedAgentSessionCapabilitiesTest.java:128 — [review] The two capability assertions that are supposed to pin "unproven eligibility adverti…
  • packages/managed-agent-server/verification/src/test/java/com/alibaba/qwen/code/managedagent/workspace/runtime/WorkspaceRuntimeTransportTest.java:467 — [review] externalFileAuxiliaryControlsPreserveOriginalHolderAndRejectOtherOperations (l…
  • packages/managed-agent-server/verification/src/test/java/com/alibaba/qwen/code/runtimebroker/RuntimeExternalWorkspaceDrainTest.java:291 — [review] The fixture claims the operation and fences the binding to LOST but never releases the clai…
  • packages/managed-agent-server/verification/src/test/resources/class-size-ratchet.properties:36 — [review] The new pin for AgentSessionPolicies sits 12 lines above the class's actual size, so the ratchet admits growth the pin convention sa…
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/session/ManagedAgentService.java:1958 — [review] The new external-profile shape predicate does two SQL reads per evaluation, and it is evaluated pe…
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/session/SessionLifecycleCoordinator.java:127 — [review] This overload's only caller passes a hardcoded FILES profile, so the added EXTERNAL_FILES …
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/JdbcWorkspaceExecutionStore.java:632 — [review] hasHolder 's only two callers both exclude external bindings before the call, so the bra…
  • packages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/config/runtime/EmbeddedRuntimeBroker.java:390 — [review] The new String -profile override that gates external-files close/create capability has no test; …
  • …and 4 more (see the run report)

Mechanism health: this round did not close cleanly, so it withholds the incremental anchor — and the round it recovered had no anchor this round could use either — none at all, one with no certifier, one certified by an identity other than the one this round runs under, or one this round's fetch refused or resolved to the head — so the next review re-reads the whole diff unless recovery grafts an earlier own anchor that the round running it can use onto the complete work list this round leaves behind, and keeps doing so until a round's marker carries an anchor again or a graft lands that the round running it can use. (Stated, not acted on — this changes nothing about what the round posts.)

中文说明

未决,请确认:共 4 条(原文未翻译,列表见上方英文部分)。

未探索到全部深度(达到工具调用预算):"agent reverse-audit (round 2)":§13's wire-level claims (colon escaping of publication:* routes, the exact stop headers, the 64 KiB envelope, redirect rejection) were not re-verified against…;"agent reverse-audit (round 3)":did not confirm that the CLI's external-files lane reserves its file-tool executions as v2 (no runtimeProtocol , no publication grant) — I verified the referen…;chunk 23:cross-language check that the worker's ManagedContextProtocol.ATTEST_PATH attestation echoes the context-only boot (the test's attestationResponse(ManagedCon…;chunk 33:I did not execute the new tests (a verification Maven run); the pass/fail questions above were settled by reading the transport, parser and value-coercion sou…;"agent reverse-audit (round 3)":could not execute RuntimeExternalWorkspaceDrainTest — compiling or mvn -ing in this shared worktree is forbidden by the brief — so its greenness is inferred …,另有 3 条。

收敛姿态下延后(第 29 轮,非阻断)——已记录,本轮不要求修改;其中 3 条 Critical 按其失败方向与对照基线延后——fails-closed 且 new-surface:未认证任何错误结果,且 merge base 既无该功能面也无该缺陷——作为后续工作记录在 findings 工件中:共 24 条(原文未翻译,列表见上方英文部分)。

机制健康:本轮未能干净收尾,因而扣留了增量锚点,而它恢复到的那一轮也没有留下本轮可用的锚点——要么完全没有、要么没有认证者、要么由本轮运行身份之外的身份认证、要么被本轮的获取拒绝或解析为头提交——因此下一次评审将重读整个 diff,除非恢复流程把本轮能使用的更早自有锚点嫁接到本轮留下的完整工作清单上;并会一直如此,直到某一轮的标记重新带上锚点,或落地的嫁接能被运行该轮的评审使用。(仅陈述,不据此行动——这不改变本轮发布的任何内容。)

— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.27.2)

…dmission gaps

creationPin now refuses memoryStoreId, mirroring the CLI closed-option
list (R29-1): the public-API create lane committed external-files
Sessions whose memory binding the hosted lane refuses on attach, so the
Session could never take a turn. The CLI lane was closed in the previous
round; this closes the persistence seam every create entry point shares.

changeSessionApproval reads external eligibility through
externalFilesAllowedOrRefuse, so an undecodable registration answers the
permanent 409 on the approval-change lane as it already does on create
and turn (R10-2 residual, flagged by wenshao in rounds 12/13). The
registry keeps its documented retryable 503 (design 12: the Broker keeps
the placement adoptable); the admission seam owns the permanent refusal.

Witnesses: externalFilesCreationRefusesMemoryStoreBinding (refusal plus
an admissible control) and
malformedExternalRegistrationIsANonRetryableApprovalChangeRefusal. Both
are mutation-verified: reverting either fix reds exactly its witness
while the other twelve cases stay green.
@yiliang114

Copy link
Copy Markdown
Collaborator Author

Round 30 — two admission-gap fixes (850a1bca5eaa), four stale Criticals confirmed

Scope-correction round: only the two posted Criticals were fixed; the 24 deferred items stay deferred under the convergence posture and the >5-round policy. Both threads are replied and resolved.

Fixes

R29-1 — memoryStoreId at the persistence create seam. creationPin now refuses command.memoryStoreId() != null with the same workspace_unavailable refusal as the other closed options. This is the seam every create entry point shares (PublicAgentController → createWorkspaceSession → AgentSessionAdmissions:188, external derived from the registered workspace kind), so the public-API lane can no longer commit an external-files Session whose memory binding the hosted lane refuses on attach — a Session that could never take a turn. The previous round (comment 6793366652) closed the CLI lane; this closes the shared persistence seam. Witness: externalFilesCreationRefusesMemoryStoreBinding — 409/workspace_unavailable for a create command carrying a memory binding, plus an admissible control proving the identical command without it creates the EXTERNAL_FILES session.

R29-2 / R10-2 residual — decode failure on the approval-change lane. The registry-layer retryable 503 stays: design §12 reserves it for lookups that cannot be read to completion so the Broker keeps the placement adoptable, and the strict decoder cannot distinguish corruption from a newer build's document. The permanent refusal belongs to the admission seam (externalFilesAllowedOrRefuse), which create and turn already use. The one lane that bypassed the seam was changeSessionApproval — the residual wenshao named in rounds 12/13 and comment 6711331008 — and it now routes through the seam, so an undecodable registration answers the permanent 409 unsupported_feature there too. The PR description's decode-failure claim now holds on all three admission lanes; the execution path keeps its fail-closed throwing predicate and the listing capability flag keeps its own catch, both by design. Witness: malformedExternalRegistrationIsANonRetryableApprovalChangeRefusal — session created under a healthy registration, registration_json corrupted, approval change asserts 409/unsupported_feature, not the retryable 503.

Mutation matrix (both witnesses are real killers): reverting both one-line fixes reds exactly the two new witnesses while the class's other twelve cases stay green (14 run, 2 failures); restoring the fixes returns 14/14.

The four "Unresolved, please confirm" items — all closed at this head

Finding Disposition Evidence at 850a1bca5eaa
R3-1 — retired non-holder aborts the cascade Fixed (comment 6527601465; re-verified at ae9584f5 in 6542452337; mutation-killed in wenshao's matrix, 6544521343) The stopped-release path in JdbcExternalWorkspaceOwnership early-returns a retired non-holder after clearing its membership instead of throwing; target and global membership checks intact. ExternalWorkspaceOwnershipTest 13/13 and the drain retired-cleanup scenario green in this round's run.
R3-2 — refused queued message wedges the queue Delivered in ad689fcfa540 (scope ledger) Queue submit and edit refuse non-text input for the external-files profile before persisting, so no permanently refused queue head. ManagedUserMessageStoreTest 18/18 green this round.
R16-1 — lease-less PROVISIONING cannot provision again Fixed in ccbab32127ebc (comment 6717474475); wenshao adjudicated the production semantics (6722578328) A lease-less PROVISIONING external binding with only a persisted handle resumes through provisionBinding (ensure + provision); ExternalRuntimeProvisioner.reconcile accepts the null previous lease and observes the provider. RuntimeExternalWorkspaceDrainTest 17/17 green this round, after the #16953 JDBC migration.
R1-16 — the two named tests cannot red their regressions Disposition ce48757e (closeout 6461321124 and the thread reply) drainRefusesIncompleteAndChangedOriginalsBeforeNetworkOrProviderCalls now asserts exact permanent 409/resource_conflict/non-retryable, so a later network 503 cannot satisfy it; externalProfileRequiresExactNegotiationButSavedCloseSurvivesFilesDisablement feeds advertised /2 against requested /1 for both admission and saved lifecycle, rejecting the near miss. Both classes run locally at this head: ExternalWorkspaceProvisionerTest 30/30, QwenHostedHarnessConnectorTest 159/159.

Verification

  • 16-class focused set at 850a1bca5eaa: 368 tests, 0 failures, 0 errors; checkstyle:check + checkstyle:check@runtime-broker-checkstyle, 0 violations across all 15 modules (JDK 21, Maven).
  • Mutation matrix above; R1-16 classes 30/30 + 159/159.
  • CI at the previous head f0735c44c1ed6 finished 28 success / 50 skipped / 0 failed (including Managed Agent fast tier and review-pr); the new push re-runs it.

Scope

Production +2 lines across the two named seams; tests +101 lines (the two witnesses); no new surface, no optional work. Snapshot vs origin/main (6f754be654890): 98 files +6523/−589 — implementation 65 files +2900/−484, test 31 files +3465/−66, docs 2 files +158/−39. substantiveRounds 18 → 19 (production behavior changed).

中文说明

第 30 轮,范围修正模式:只修本轮贴出的两条 Critical,24 条 deferred 按收敛姿态与 >5 轮策略继续延后。两条 thread 已回复并 resolve。

R29-1:creationPin 补上 memoryStoreId 拒绝——这是所有创建入口共享的持久化缝隙(公共 API → createWorkspaceSession → AgentSessionAdmissions),此前只关了 CLI 通道,公共 API 仍能提交一个 hosted 通道永远拒绝 attach、永远无法 turn 的 external-files Session。witness 带可准入对照。

R29-2/R10-2 残留:registry 层的可重试 503 是设计 §12 的明文契约(读不完整 → 保持 placement 可收养;严格解码器分不清损坏与更新版本的文档),永久拒绝归准入缝隙所有。真正绕过缝隙的是 changeSessionApproval——wenshao 在第 12/13 轮和评论 6711331008 三次点名的残留——本轮按他给的方向接入 externalFilesAllowedOrRefuse,PR 描述里"解码失败永久 409"的主张至此在创建/turn/审批变更三条准入通道全部成立。执行路径保留 fail-closed throwing、列表 capability 保留独立 catch,均为设计内行为。

变异矩阵:同时回退两处一行修复,恰好两个新 witness 变红、其余 12 例保持绿;恢复后 14/14。

四条"未决请确认"全部给出闭环证据:R3-1(非 holder 早退,wenshao 变异矩阵杀过)、R3-2(ad689fcf 交付,入队前拒绝非文本)、R16-1(ccbab321 修复,wenshao 裁定过生产语义)、R1-16(ce48757e 强化断言,两个被点名的测试类本轮本地 30/30 + 159/159 全绿)。

验证:16 类聚焦 368 用例全绿,双 checkstyle goal 全模块 0 违规。范围:生产 +2 行、测试 +101 行,无新功能面;substantiveRounds 18→19。

@yiliang114
yiliang114 dismissed qwen-code-review-bot’s stale review November 14, 2026 04:16

Both Criticals posted by this review are fixed in 850a1bc and their threads are replied and resolved: R29-1 (memoryStoreId at the shared create seam, with an admissible-control witness) and R29-2 (the approval-change lane now routes through the permanent-refusal seam; the registry's retryable 503 stays per design §12). Both witnesses are mutation-verified — reverting the two one-line fixes reds exactly the two new cases while the other twelve stay green. The four "could not establish" items (R3-1, R3-2, R16-1, R1-16) are confirmed closed with commit and witness evidence, including local runs of the two R1-16 test classes at this head (30/30 + 159/159). The 24 deferred items remain deferred under the review's own convergence posture. Focused verification at this head: 368 tests, 0 failures; both checkstyle goals, 0 violations. Full evidence: comment 6871554415.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Partially reviewed — gaps disclosed.

Not reviewed: reverse audit — stopped at the round cap (3 rounds) without convergence; the audit was still reporting new findings in its final round.

Not explored to full depth (tool budget reached): "agent reverse-audit (round 1)": full trace of how RuntimeBrokerHttpServer maps a non- RuntimeBrokerException from stopDrained to a status/code — I stopped at WorkspaceRuntimeProvisioner.…; "agent reverse-audit (round 3)": base-side extraction-fidelity diff — git show <merge-base>:packages/…/persistence/…/JdbcWorkspaceExecutionStore.java returned no such file at 6f754be65 , so …; "agent reverse-audit (round 3)": did not enumerate all ~20 lifecycleProtocol(...) call sites to confirm the EXTERNAL_FILES 0→1 flip ( SessionLifecycleService.usesLifecycleProtocol , AgentL…; "agent reverse-audit (round 1)": could not establish whether WorkspaceRuntimeResolver.verifyInstallable 's authority.verifyMountForProbe(...) call (which now reaches WorkspaceStorageKindGua….

Deferred under the convergence posture (round 30, not a blocker) — recorded, not requested in this round; 1 Critical(s) among them are deferred by their axes — fails-closed on new surface, where no wrong result is certified and the merge base had neither the surface nor the defect — and remain follow-up work recorded in the findings artifact:

  • packages/managed-agent-server/contracts/src/main/java/com/alibaba/qwen/code/managedagent/contracts/harness/HarnessConnector.java:184 — [review] Critical [fails-closed] [new-surface] The new supportsSavedLifecycle(String) capability is not…
  • docs/design/2026-10-25-external-hosted-workspace.md:269 — [review] Five of the six source links newly added in design section 14 point at repository paths that do not exist
  • docs/design/2026-10-25-external-hosted-workspace.zh-CN.md:245 — [review] All five links added to the Chinese design section 14 resolve to paths that do not exist
  • packages/cli/src/serve/hosted-harness-session.ts:6360 — [review] The new 16-domain journal scan on external cold load is never the deciding conjunct in its only test
  • packages/cli/src/serve/hosted-workspace-tool-turn.ts:2317 — [review] The external-files optional-lane guard is a 19-way disjunction witnessed by exactly one lane
  • packages/cli/src/serve/hosted-workspace-tool-turn.ts:2323 — [review] The no-optional-lanes gate omits clientFiles , a lane the external profile silently drops
  • packages/cli/src/serve/hosted-workspace-tool-turn.ts:2624 — [review] The external-files profile is the only non-resident, non-CSI profile that declares the *unpaged* read_file , so it loses the pages parameter while every other code path…
  • packages/managed-agent-server/adapters/src/main/java/com/alibaba/qwen/code/managedagent/harness/HarnessPoolConnector.java:546 — [review] The HarnessPoolConnector external-files lifecycle override has no test, while its sibling connector d…
  • packages/managed-agent-server/adapters/src/main/java/com/alibaba/qwen/code/managedagent/harness/QwenHostedHarnessConnector.java:522 — [review] The new external-profile mount-verification bypass has no test — no existing probe test ever sets…
  • packages/managed-agent-server/contracts/src/main/java/com/alibaba/qwen/code/runtimebroker/spi/ExternalStorageRegistry.java:66 — [review] String.matches compiles a fresh Pattern on every call, and the added validation uses it per field: …
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/session/ManagedAgentService.java:339 — [review] ManagedAgentService.queryWebShellSessionOptions has no test at any level
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/session/ManagedAgentService.java:1941 — [review] Session-page render issues a JDBC read per row (twice) for the external profile
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/session/SessionLifecycleCoordinator.java:126 — [review] supportsWorkspaceLifecycle(String) now branches on EXTERNAL_FILES , but its only caller …
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/workspace/runtime/WorkspaceRuntimeResolver.java:130 — [review] The external branch asks the store isExternal(...) and then calls authority.autho…
  • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/workspace/runtime/WorkspaceRuntimeTransport.java:214 — [review] ownership.requireExternalExecution(...) sits in the shared prologue of execute()…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/AgentSessionCommands.java:642 — [review] The turn-policy projection is re-implemented in SQL, duplicating the Java profile/plan predicate…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/AgentSessionPolicies.java:700 — [review] The plan-mode conjunct in requireExternalTurnAllowed re-reads the row this transaction already…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/ExternalStorageRegistrationStore.java:203 — [review] states() selects EXTERNAL registrations by ma_storage.tenant_id + ma_storage.st…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/ExternalStorageRegistrationStore.java:267 — [review] RegistrationState.current is a constant, so the state.current() eligibility conj…
  • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/JdbcManagedUserMessageStore.java:283 — [review] A second read of the session row per user-message submit/edit, when the row is already lo…
  • …and 39 more (see the run report)

Mechanism health: this round did not close cleanly, so it withholds the incremental anchor — and the round it recovered had no anchor this round could use either — none at all, one with no certifier, one certified by an identity other than the one this round runs under, or one this round's fetch refused or resolved to the head — so the next review re-reads the whole diff unless recovery grafts an earlier own anchor that the round running it can use onto the complete work list this round leaves behind, and keeps doing so until a round's marker carries an anchor again or a graft lands that the round running it can use. (Stated, not acted on — this changes nothing about what the round posts.)

中文说明

仅完成部分审查,审查缺口已披露。

未审查(原文为英文):reverse audit — stopped at the round cap (3 rounds) without convergence; the audit was still reporting new findings in its final round.

未探索到全部深度(达到工具调用预算):"agent reverse-audit (round 1)":full trace of how RuntimeBrokerHttpServer maps a non- RuntimeBrokerException from stopDrained to a status/code — I stopped at WorkspaceRuntimeProvisioner.…;"agent reverse-audit (round 3)":base-side extraction-fidelity diff — git show <merge-base>:packages/…/persistence/…/JdbcWorkspaceExecutionStore.java returned no such file at 6f754be65 , so …;"agent reverse-audit (round 3)":did not enumerate all ~20 lifecycleProtocol(...) call sites to confirm the EXTERNAL_FILES 0→1 flip ( SessionLifecycleService.usesLifecycleProtocol , AgentL…;"agent reverse-audit (round 1)":could not establish whether WorkspaceRuntimeResolver.verifyInstallable 's authority.verifyMountForProbe(...) call (which now reaches WorkspaceStorageKindGua…。

收敛姿态下延后(第 30 轮,非阻断)——已记录,本轮不要求修改;其中 1 条 Critical 按其失败方向与对照基线延后——fails-closed 且 new-surface:未认证任何错误结果,且 merge base 既无该功能面也无该缺陷——作为后续工作记录在 findings 工件中:共 59 条(原文未翻译,列表见上方英文部分)。

机制健康:本轮未能干净收尾,因而扣留了增量锚点,而它恢复到的那一轮也没有留下本轮可用的锚点——要么完全没有、要么没有认证者、要么由本轮运行身份之外的身份认证、要么被本轮的获取拒绝或解析为头提交——因此下一次评审将重读整个 diff,除非恢复流程把本轮能使用的更早自有锚点嫁接到本轮留下的完整工作清单上;并会一直如此,直到某一轮的标记重新带上锚点,或落地的嫁接能被运行该轮的评审使用。(仅陈述,不据此行动——这不改变本轮发布的任何内容。)

— deepseek-v4.1-flash-1017 via Qwen Code /review (v0.27.2)

@yiliang114

Copy link
Copy Markdown
Collaborator Author

Local verification (merge-reference) — module-level external-workspace surface

I ran both arms myself on this machine with the same commands (JDK 21.0.13+9, Maven 3.9.9, no product code touched, both worktrees detached):

Arm Revision Reactor install -DskipTests -pl verification test (default selection)
before 6f754be6548 (merge-base with main 0ffaea08ba8) BUILD SUCCESS 883 tests, 0 failures
after 850a1bca5ea (PR head) BUILD SUCCESS 672 tests, 0 failures

Two things the default selection did not run at the after arm, so I selected them explicitly (same revision, same JDK/Maven):

  • -Dtest='com.alibaba.qwen.code.runtimebroker.provisioning.**.*Test' → 326 tests, 0 failures (12 skipped). Those 21 suites are present and compiled in the after-arm tree, and the same default selection did run them at the before arm; the two arms have byte-identical verification/pom.xml and managed-agent-server/pom.xml. I am reporting the selection difference as observed, not explaining it.
  • -Dtest=ExternalWorkspaceMaterializationTest → 14 tests, 0 failures, including externalFilesCreationRefusesMemoryStoreBinding (409 workspace_unavailable) and malformedExternalRegistrationIsANonRetryableApprovalChangeRefusal (409 unsupported_feature).

Before side is a compile-level refusal, not a behavioural one. ExternalWorkspaceMaterializationTest does not exist at merge-base 6f754be. Copying the branch version into a clean 6f754be worktree fails to compile because the API surface it exercises is absent there: ContextBinding parameter types, JdbcManagedWorkspaceRegistry.externalFilesAllowed(...), WorkspaceExecutionStore.requireExternalExecution(...), and ExternalStorageRegistrationController.MaterializeRequest. That is evidence the refusal contract is new in this PR rather than a rename.

CI at this head: 34 check names / 100 check runs, every name terminal green — 0 failing, 0 live, 0 cancelled without a successful successor. Note Select the Managed Agent tier and SDK Java () were skipped, so this head received the fast tier only; the Java/MySQL gate did not run in CI.

Boundary (why this is PARTIAL, not PASS). *MySqlIT and ExternalPublicFilesE2E need a live MySQL 8.4; this host only has MariaDB 10.11, so the external-workspace execute/close path through the real daemon + CLI is not verified locally. Nothing here claims that path is broken — it is simply not closed by this run. This comment is verification evidence, not an approval.

Raw logs: /data/pr-verify/evidence/15684/850a1bca5eaa5653af0d5f6612b1b16cc5ae1209/bqtbsuwh-14nov0830z/ (base-test.log, head-test.log, head-provisioning-explicit.log, head-materialization-explicit.log, base-headtest-compile-refusal.log, per-arm provenance files).

中文版(完整)

本地 merge-reference 验证:外部工作区模块级行为

两臂都由我在本机串行执行,命令完全一致(JDK 21.0.13+9、Maven 3.9.9,未改动产品代码,均用 detached worktree):

  • before 臂 6f754be6548(与 main 0ffaea08ba8 的 merge-base):全 reactor 编译安装 SUCCESS;verification 模块默认套件 883 个测试、0 失败。
  • after 臂 850a1bca5ea(PR head):编译安装 SUCCESS;默认套件 672 个测试、0 失败。

after 臂上有两类用例没有被默认选择跑到,我按同一 revision 显式补跑:

  • provisioning 包下 21 个套件 → 326 个测试、0 失败(12 跳过)。这些类在 after 臂树里存在且已编译,同一默认选择在 before 臂却跑到了它们;两臂的 verification/pom.xml 与 managed-agent-server/pom.xml 逐字节相同。我只把它当作观测差异记录,本轮没有查明原因。
  • 本 PR 新增的 ExternalWorkspaceMaterializationTest → 14 个测试、0 失败,覆盖「内存存储绑定必须被拒(409 workspace_unavailable)」与「非法注册在审批变更时是非重试的拒绝(409 unsupported_feature)」。

before 侧的差异体现在编译层:该测试类在 merge-base 上根本不存在;把分支版本放进干净的 6f754be worktree 会编译失败,因为 ContextBinding 形参类型、JdbcManagedWorkspaceRegistry.externalFilesAllowed、WorkspaceExecutionStore.requireExternalExecution、ExternalStorageRegistrationController.MaterializeRequest 在该提交上都还没有 —— 说明这套拒绝契约是本 PR 新增,而不是改名。

CI:当前 head 上 34 个检查名 / 100 次运行,全部终态通过,0 失败、0 在跑、0 个「取消且无成功后继」。但 Select the Managed Agent tier 与 SDK Java () 是 skipped,即这个 head 只跑了 fast tier,Java/MySQL 全量门在 CI 上没有跑。

边界(结论为 PARTIAL 而非 PASS):*MySqlIT 与 ExternalPublicFilesE2E 需要活的 MySQL 8.4,本机只有 MariaDB 10.11,因此「真实 daemon + CLI 的外部工作区执行/关闭路径」本地未验证。这不代表该路径有问题,只是本轮没有闭合。本条是验证证据,不是 approve。

@doudouOUC doudouOUC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

评审结论:需修改后通过(不 approve)

  • 基线:head 850a1bca5eaa5653af0d5f6612b1b16cc5ae1209,base(merge-base)6f754be6548903e545e6ff0ed43a34927fe3bfb9;98 个文件 +6523/−589。
  • 历史评审:58 条 review thread 均已 resolved,无遗留 CHANGES_REQUESTED。
  • CI:当前 head 必需检查(Classify PR / Lint & Static / Test ubuntu Node 22 / Integration Tests no-AK No Sandbox / Serve A-B / SDK Java fast / web-shell E2E / TUI parity)通过;Managed Agent full、MySQL、hosted-fault 任务为 skipped。
  • 结论依据:发现 1 个阻塞项(生产装配缺失导致 saved close 语义失效),其余为文档与闭合面一致性问题。

阻塞项

1. SdkHarnessBoundary 未转发 supportsSavedLifecycle(String),生产环境 external Session 在关闭 workspace files 后无法 close/delete

  • 位置:packages/managed-agent-server/adapters/src/main/java/com/alibaba/qwen/code/managedagent/harness/SdkHarnessBoundary.java:230-243
    该边界只转发了 isWorkspaceFilesAvailable()、supportsLifecycle()、supportsLifecycle(String),没有覆盖 supportsSavedLifecycle(String),因此继承 packages/managed-agent-server/contracts/src/main/java/com/alibaba/qwen/code/managedagent/contracts/harness/HarnessConnector.java:184-186 的默认实现 return supportsLifecycle(profile);。
  • 生产装配证据:packages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/config/HarnessConfiguration.java:76 与 :91 显示两条生产 HarnessConnector bean 路径都返回 new SdkHarnessBoundary(...),因此 ManagedAgentService/SessionLifecycleCoordinator 注入到的就是该边界。
  • 本 PR 期望的新语义在 packages/managed-agent-server/adapters/src/main/java/com/alibaba/qwen/code/managedagent/harness/QwenHostedHarnessConnector.java:326:supportsSavedLifecycle(profile) 只要求 lifecycle protocol 1 + EXTERNAL_FILES feature,不要求 files 当前可用,目的正是“files 被禁用后仍能关闭已保存的 Session”。
  • 受影响调用链(均以注入的 boundary 为 harness):
    • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/session/ManagedAgentService.java:200、:1638(hasLifecycle/closable 对 external 使用 supportsSavedLifecycle)
    • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/session/SessionLifecycleCoordinator.java:134、:771
    • packages/managed-agent-server/control-plane/src/main/java/com/alibaba/qwen/code/managedagent/session/SessionLifecycleService.java:166(据此计算 supported)
    • packages/managed-agent-server/persistence/src/main/java/com/alibaba/qwen/code/managedagent/persistence/AgentLifecycleOperations.java:389:!supported 直接抛 workspaceExecutionUnavailable()(409)
  • 触发条件:external Session 已创建后,运维将 workspaceFilesEnabled 置为 false(或 Harness 报告 workspace files 暂不可用),再对该 ACTIVE Session 执行 close/delete。AgentLifecycleOperations.java:389 的二段豁免(admitsLegacyClose,ExternalWorkspaceSessionPolicies.java:76)只在 supported=true 时才可能生效;由于 boundary 返回 false,close/delete 被 409 拒绝,worker 与 SQL physical holder 无法退役,只能恢复配置后才能清理。
  • 与测试的矛盾:packages/managed-agent-server/verification/src/test/java/.../QwenHostedHarnessConnectorTest.java 中 externalProfileRequiresExactNegotiationButSavedCloseSurvivesFilesDisablement 仅包装裸 QwenHostedHarnessConnector 断言为 true;HostedGateTestSupportTest 虽然用 SdkHarnessBoundary 包装,但没有覆盖 supportsSavedLifecycle 的转发,因此生产路径的回归未被任何测试捕获。
  • 修复方向:
    1. 在 SdkHarnessBoundary 增加与相邻方法一致的转发:
      @Override
      public boolean supportsSavedLifecycle(String profile) {
          return call(() -> delegate.supportsSavedLifecycle(profile));
      }
    2. 增加一个以 SdkHarnessBoundary 包装 connector 的测试:先协商 external profile,再关闭 workspace files,断言 supportsSavedLifecycle(EXTERNAL_FILES) 仍为 true、supportsLifecycle(EXTERNAL_FILES) 为 false,并覆盖 close 准入不再 409 的路径。
    3. 顺带检查 boundary 是否还有其他新增/既有 default 方法未转发(本次只发现这一处)。

建议项(非阻塞)

  1. 设计文档 §14 的 5 个源码链接不可达

    • docs/design/2026-10-25-external-hosted-workspace.md:269、:275 与 docs/design/2026-10-25-external-hosted-workspace.zh-CN.md:245、:251。
    • ManagedAgentProperties/ManagedWorkspaceRegistry/SessionLifecycleCoordinator/WorkspaceLifecycleStore/JdbcExternalWorkspaceOwnership 的链接都缺少 server/、control-plane/、persistence/、runtime-broker/ 等模块路径(实际路径见 packages/managed-agent-server/server/...、control-plane/...、persistence/...)。建议改为可点击的准确相对路径。
  2. 设计文档与 drain 回包实现不一致

    • 英文 docs/design/2026-10-25-external-hosted-workspace.md:255 / 中文 :231 声称“非空 channels/receipts 不产生 receipt”。
    • 实现 packages/managed-agent-server/runtime-http/src/main/java/com/alibaba/qwen/code/runtimebroker/adapter/HttpRuntimeTransport.java:571-583 明确接受并逐条校验非空 receipts;测试 externalDrainAcceptsPublicationReceiptsButRejectsMalformedEntries 也把合法 receipts 当作成功用例。请同步文档措辞(仅非空 channels/undrained 保持可重试拒绝),避免后续误读。
  3. client-files 注册面在 external profile 上未闭合

    • packages/cli/src/serve/hosted-harness-session.ts:9658 的 register 只拒绝 foregroundOnly || !toolProfile;external profile 具有 toolProfile,因此允许注册。
    • 但 packages/cli/src/serve/hosted-workspace-tool-turn.ts:2625-2629 的 external 分支直接返回 [...HOSTED_WORKSPACE_FILE_TOOLS, HOSTED_GLOB_TOOL],从不调用 clientFilesDeclarations(),注册的 relay 工具永远不会被声明/派发。结果是面板显示 connected,但模型拿不到任何 client-files 工具,与该文件 :2660 附近“注册必须传到模型,否则面板会谎报 connected”的注释语义冲突。
    • 建议在 register 阶段对 external profile 返回 hosted_client_files_profile_unsupported(与 foregroundOnly 同路径),或在声明分支显式拒绝并给出原因;二者选一即可,但不要保留“可注册、永不生效”的状态。
  4. 验证覆盖说明

    • head 上 Managed Agent full / MySQL / hosted-fault 任务为 skipped,本 PR 的 external SQL ownership、drain receipt 与 lifecycle 变更主要由单元/集成测试覆盖。合并前建议确认 full-tier(ExternalPublicFilesE2E 所在 PR)与 MySQL 任务已实际运行,作为 SQL holder/退役路径的端到端证据。

安全审查结论

未发现阻塞性安全问题:无硬编码密钥/Token;SQL 使用参数化占位符;external 工具仅白名单 read_file/write_file/edit/glob;路径校验(UUID、绝对路径、段名、长度)严格;drain 回包有大小上限与严格 JSON 解析;审批模式与 planMode/skills/MCP/hooks 等闭合选项处理一致;外部存储注册与物化在事务与锁内完成。建议项 1–3 属于可维护性与一致性,不构成安全阻塞。


说明:本评审为 comment 类型,不包含 approve;阻塞项修复并补充 boundary 级测试后可再次提交复审。

qqqys
qqqys previously approved these changes Nov 15, 2026

@qqqys qqqys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at head 850a1bca5eaa5653af0d5f6612b1b16cc5ae1209 (base 6f754be6).

Approve. This PR accumulated thirteen CHANGES_REQUESTED reviews across thirty rounds, all anchored to superseded heads — none at this one, and reviewDecision reads REVIEW_REQUIRED. The five most recent of them (rounds 22, 23, 24, 25, 26) filed six Criticals between them, and round 30 at this head posted zero findings while deferring one Critical under its convergence posture. That silence is meaningful only because the earlier rounds demonstrably re-posted whatever still stood — R23-2 was carried into round 25 annotated "(still stands)" — so I treated round 30 as a closure signal to verify, not to trust. I re-derived all six historical Criticals against this head, and separately verified the deferred one, including its "new surface" claim, which is the part most likely to be wrong. All are closed or non-blocking. CI is fully settled with no failures.

The six historical Criticals at this head

R23-2 / R24-1 — class-size ratchet and the Checkstyle brace collapse. Closed, and the ratchet was not raised. class-size-ratchet.properties:66 reads RuntimeBindingProvisioning=1309 and the class at this head is exactly 1309 lines. Both values are unchanged from the merge base, where the ceiling was also 1309 and the class also 1309 — so the round-23 complaint that "the ceilings are raised again by this diff" and round 25's "1314 lines, above its 1310" describe intermediate heads. The author shrank the class back under its original ceiling instead of lifting it, which is the fix the ratchet exists to force. SDK Java (fast) / ubuntu-latest / Java 21 runs Checkstyle and the verification module and is green.

R23-1 — lenient Jackson decode of registration_json. Closed. ExternalWorkspaceMaterializationStore.java:74-82 now decodes through the shared strict decoder, with the hazard named in the comment:

// The shared strict decoder is the one every other reader of this
// column uses; a lenient scalar coercion here would commit an
// ACTIVE Workspace that every later consumer permanently refuses.
registration = ExternalStorageRegistry.decodeRegistration(registrations.getFirst());

wrapped in catch (RuntimeException unreadable) { throw conflict("external_workspace_conflict"); }. The class's remaining private ObjectMapper is used only for decode(prior.resultJson(), Receipt.class) — this store's own idempotency receipt, not the shared column — so the strict/lenient split is on the right boundary.

R26-1 — memoryStoreId was the one lane the external-files admission gate did not refuse. Closed. 'memoryStoreId' is now a member of the excluded-key list in hasHostedExternalFilesExcludedOptions (hosted-workspace-profiles.ts:146), alongside agentDefinition, sessionSkillsRef, hookCatalog, mcpServers, publicChildModelRoute, lineage and captureBytes, so an external-files session carrying a memory store is refused at admission rather than persisted by one profile and unreadable by another.

R22-1 — lock-contract sql-owners.txt inventory out of step with the tree's SQL literals. This is an arithmetic fixture asserted by a test in the verification module; SDK Java (fast) / ubuntu-latest / Java 21 executes that module and is green at this head, so the inventory and the literals agree. I am resting this one on that lane rather than on a hand re-derivation of the inventory.

The deferred Critical, checked rather than accepted

Round 30 deferred HarnessConnector.java:184 — Critical [fails-closed] [new-surface] The new supportsSavedLifecycle(String) capability…. The deferral's axis makes two factual claims, and my notes say to test the merge-base one because it is sometimes simply false. Here it is true: git grep -c supportsSavedLifecycle at base 6f754be6 returns nothing — the method does not exist there, and the callers used plain harness.supportsLifecycle(session.toolProfile()) (base ManagedAgentService.java:191, :1620).

The fails-closed half also holds, on three checks:

  • The interface default is supportsSavedLifecycle(profile) → supportsLifecycle(profile), so any connector that does not override it behaves exactly as it did before this PR.
  • Both overrides terminate and fail closed. QwenHostedHarnessConnector:326 returns the capability conjunction inside try { … } catch (DaemonException | IllegalStateException unavailable) { return false; }; HarnessPoolConnector:556 returns contract != null && contract.lifecycle() == 1 && contract.features().contains(EXTERNAL_FILES). Neither re-enters supportsLifecycle for the EXTERNAL_FILES branch, so there is no mutual recursion with supportsLifecycle's own EXTERNAL_FILES arm, which does call supportsSavedLifecycle.
  • The one implementor that overrides supportsLifecycle(String) without overriding supportsSavedLifecycle is SdkHarnessBoundary, a decorator: its override is call(() -> delegate.supportsLifecycle(profile)) (:240-242), so the inherited default resolves to the delegate's supportsLifecycle, not back into itself. For EXTERNAL_FILES that evaluates to isWorkspaceFilesAvailable() && delegate.supportsSavedLifecycle(EF) — the conjunction the caller wanted, plus one stricter term. Equivalent-or-stricter, never more permissive. UnavailableHarnessConnector overrides neither and inherits false.

The residual worth recording as follow-up rather than as a blocker: because the boundary forwards to supportsLifecycle rather than to supportsSavedLifecycle, the two capabilities are only equivalent while supportsLifecycle(EXTERNAL_FILES) keeps ANDing in the saved-lifecycle check. If that composition ever changes, the decorator would silently diverge from the direct connectors. An explicit override forwarding to delegate.supportsSavedLifecycle(profile) would remove the coupling. QwenHostedHarnessConnectorTest:928/937/938 pins the true/false/false profile behaviour.

The shared-prologue deferral is self-gating

Round 30 also deferred that ownership.requireExternalExecution(...) "sits in the shared prologue of execute()". Read at head, the guard gates itself:

public void requireExternalExecution(ContextBinding binding) {
    if (isExternal(binding) && (externalAdmission == null
            || !externalAdmission.externalFilesAllowed(binding))) {
        throw unavailable();
    }
}

(JdbcWorkspaceExecutionStore.java:127-132). For a resident or CSI binding isExternal is false and the method is a no-op, so the four call sites in WorkspaceRuntimeTransport (:144, :214, :521, :700) and the one in ManagedRuntimeCoordinator:122 cannot refuse an existing profile. For an external binding it fails closed in both directions, including when the @Autowired(required = false) admission bean is unwired — an unassembled optional dependency refuses the new capability rather than permitting it. WorkspaceRuntimeTransportTest:374 verifies the call and ExternalWorkspaceMaterializationTest:324 the throw.

The new trust surface

Because this feature lets a managed agent execute in a customer-provided workspace, I read the two largest new classes for tenant scoping rather than sampling. Both are defensive in the same shape: narrow FOR UPDATE selects, then an independent Java-side identity re-check that throws on any mismatch.

JdbcExternalWorkspaceOwnership locks ma_storage by alias_key and ma_storage_owner by storage_key, then re-verifies tenant_id and storage_id against the binding and throws unavailable() on divergence (:51-93); savedContext scopes in SQL and re-checks tenant and workspace (:170-186); the workspace query joins ma_workspace_access on tenant and workspace with a.actor_id = COALESCE(s.owner_actor_key, s.creator_actor_key), a.role IN ('OPERATOR','OWNER') and w.state = 'ACTIVE' (:197-201); held and claim both take FOR UPDATE. WorkspaceAttachmentAuthorizer scopes every query with WHERE tenant_id = ? AND session_id = ?, joins ma_turn, ma_workspace and ma_workspace_access on tenant_id, re-checks session.tenantId().equals(row.getString("tenant_id")) in a structural predicate (:116), requires parent_session_id IS NULL for the execution actor (:220-225), and routes every failure to unavailable() / unavailablePendingGrant() — no permissive default anywhere. I found no path where a tenant or workspace mismatch is tolerated.

Scope of what I read, stated plainly

The PR is 98 files, +6523/−589: 31 test files, 3 docs and 64 production files carrying roughly 2,900 changed production lines. I verified all six historical Criticals, the deferred Critical, the self-gating guard, and the two largest new authorization classes, and enumerated the production file list by module size. I did not line-by-line read every one of the 64 production files — JdbcWorkspaceExecutionStore (+175/−179), JdbcManagedWorkspaceRegistry (+167/−39), HttpRuntimeTransport (+149/−3), RuntimeDrainCoordinator (+108/−33) and ExternalWorkspaceProvisioner (+130/−9) were read only where a deferred or historical finding pointed into them.

Round 30 also disclosed that it did not converge — it hit its three-round cap with the reverse audit still producing findings, withheld its incremental anchor, and left four traces unexplored, among them the full enumeration of the ~20 lifecycleProtocol(...) call sites behind the EXTERNAL_FILES 0→1 flip and whether WorkspaceRuntimeResolver.verifyInstallable's verifyMountForProbe(...) reaches WorkspaceStorageKindGuard. Those are unconfirmed, not cleared, and I am not representing them as reviewed. Roughly 58 further [review]-graded items were deferred, including the five broken source links in design section 14 of both language versions, the unpaged read_file on the external-files profile losing its pages parameter, and a per-row JDBC read in session-page rendering. None is graded Critical and none blocks under this channel's scope, but the design-doc links and the pages parameter are the two I would fix before the next slice.

CI

Settled and clean: 28 pass, 0 fail, 0 pending, 41 skipping. Green includes SDK Java (fast) / ubuntu-latest / Java 21 (Checkstyle, the class-size ratchet and the lock-contract fixture), SDK Java (fast) / Real daemon E2E / Java 11, Flyway migration version uniqueness, Test (ubuntu-latest, Node 22.x), both Linux unit tests shards, both Integration Tests (no-AK) shards, both web-shell E2E Smoke shards, Lint & Static, Build unit-test tree, Managed Agent fast tier and the TUI parity and no-flicker gates.

The skips are the whole full tier — Runtime Broker and Managed Agent MySQL, Hosted process fault gates, Hosted failover E2E, the EventTransport broker and multi-node gates, and the Windows/macOS legs. managed-agent-gate.yml selects the full tier only on an OWNER/MEMBER/COLLABORATOR approval of this head, so for a feature whose core is new MySQL-backed ownership, materialization and registration stores, none of the MySQL-backed paths have executed in CI at this head. That is the one gap I would close before merge rather than after: approve to start the full tier, then read the MySQL and hosted-fault legs.

…y, close client-files registration on external profiles

- Add the missing supportsSavedLifecycle(String) forward in SdkHarnessBoundary
  so the production wiring no longer falls back to the interface default
  (which degrades to supportsLifecycle). Without it an external Session whose
  workspace files were disabled after creation could not close/delete because
  AgentLifecycleOperations rejected the operation with 409.
- Pin the forwarding with a boundary-level test in HarnessSdkValuesTest.
- Close the client-files registration gap on hosted-workspace-external-files/1:
  the external branch never declares relay tools, so the register route now
  returns hosted_client_files_profile_unsupported instead of leaving a
  connected-but-useless registration.
- Fix §14 design doc links to include the correct module paths (server/,
  control-plane/, contracts/, persistence/) and correct the drain-response
  description to match the implementation: non-empty receipts are accepted
  and validated, not rejected.

Review thread: #15684 (review)

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

@qqqys qqqys left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewed at head ee1ea45e56baca141ef40596fcc6f85471fae782 (base 6f754be6). My approval of 850a1bca5 was dismissed by this push; that dismissal is a stale-head artifact, not a finding.

Approve. One commit, five files, +32/−12. It closes the one follow-up I named in my previous review and one item round 30 had deferred, and it touches none of the files where I verified the six historical Criticals — so those verifications carry forward unchanged. No new blocking defect. No review or comment was filed between my approval and this head, so there is no later finding to reconcile.

What the delta changes

SdkHarnessBoundary now forwards the saved-lifecycle capability explicitly (:244-247):

@Override
public boolean supportsSavedLifecycle(String profile) {
    return call(() -> delegate.supportsSavedLifecycle(profile));
}

Previously the boundary inherited the interface default, so supportsSavedLifecycle resolved to delegate.supportsLifecycle(profile). That was equivalent-or-stricter only while supportsLifecycle(EXTERNAL_FILES) kept ANDing in the saved-lifecycle check — a coupling between two methods in two other classes, invisible at the decorator. Forwarding directly removes it. The override uses the same call(...) wrapper as its sibling supportsLifecycle(String) at :240-242, so the boundary's failure mapping is unchanged, and the default's fail-closed behaviour for every other implementor is untouched.

The added test discriminates in the direction that matters: boundaryForwardsSavedLifecycleCapability is a @ParameterizedTest over {false, true} that asserts both the returned value and verify(delegate).supportsSavedLifecycle("hosted-workspace-external-files/1"). A boundary that delegated to supportsLifecycle instead would fail the verify even though the boolean could still match.

The client-files registration gate now refuses the external-files profile (hosted-harness-session.ts:9658-9663). HOSTED_WORKSPACE_EXTERNAL_FILES_PROFILE joins foregroundOnly and !toolProfile as a condition answering 409 hosted_client_files_profile_unsupported. This closes round 30's deferral that the no-optional-lanes gate omitted clientFiles, a lane the external profile drops: without it, registering a relay client held a connection for tools no Turn would hand out while the panel reported connected.

Three checks on that change. The constant is imported at :393 and already used at sixteen other sites in the file, so it resolves. The edit only adds a refusal — unregister is still admitted in every state because the action !== 'register' check precedes it, so an already-registered client can still detach rather than being stranded by the new gate. And no test asserts a successful client-files registration for an external-files session: grepping the head's serve tests for client-files combined with the external profile returns nothing, while the two existing assertions on this code (hosted-harness-session.test.ts:44516, :44567) cover the pre-existing conditions and are unaffected.

Both design docs correct the six section-14 source links that round 30 reported as pointing at nonexistent paths. I verified all six targets exist at this head — server/.../config/ManagedAgentProperties.java, contracts/.../repository/ManagedWorkspaceRegistry.java, control-plane/.../session/SessionLifecycleCoordinator.java, contracts/.../repository/WorkspaceLifecycleStore.java, persistence/.../runtimebroker/persistence/JdbcExternalWorkspaceOwnership.java and packages/cli/src/serve/hosted-workspace-profiles.ts — in both the English and Chinese files. The drain-evidence bullet is also corrected: receipts is no longer documented as necessarily empty, each receipt must carry channelId and a same-shape manifest reference, and non-empty channels on an undrained reply stay retryable rather than yielding no receipt.

Carried forward

The delta touches two production files, one test and two docs. None of the sites I verified last round is among them, so these stand as previously established: RuntimeBindingProvisioning at exactly 1309 lines against an unchanged 1309 ceiling; ExternalWorkspaceMaterializationStore decoding registration_json through the shared strict decodeRegistration; memoryStoreId present in hasHostedExternalFilesExcludedOptions; requireExternalExecution self-gating on isExternal(binding) so it is a no-op for resident and CSI bindings; and the tenant-scoped, fail-closed shape of JdbcExternalWorkspaceOwnership and WorkspaceAttachmentAuthorizer. HarnessConnector's default and both connector overrides are unchanged, so the recursion and fail-closed analysis from the previous review still describes this head.

The remaining round-30 deferrals this commit does not address are still open and still non-blocking under this channel's scope — among them the unpaged read_file on the external-files profile losing its pages parameter, the per-row JDBC read in session-page rendering, the 19-way optional-lane disjunction witnessed by one lane, and the 16-domain journal scan that is never the deciding conjunct in its only test. Round 30 also disclosed it hit its round cap without converging and left four traces unexplored. I am not representing any of that as reviewed.

CI

9 pass, 9 pending, 0 fail at this head. Pending includes SDK Java (fast) / ubuntu-latest / Java 21 — the lane that runs the new HarnessSdkValuesTest case — plus Lint & Static, Build unit-test tree, both Managed loop legs, Serve A/B and TUI parity. So the new Java override and the new TS gate condition have no executed witness yet; the previous head was fully green at 28 pass / 0 fail, and this delta is five files, but I could not observe either change run. I did not wait on the lanes.

The full tier stays skipped as before — Runtime Broker and Managed Agent MySQL, Hosted process fault gates, Hosted failover E2E and the EventTransport gates only run on an OWNER/MEMBER/COLLABORATOR approval of this head, so the MySQL-backed ownership, materialization and registration paths still have no CI execution. That remains the gap I would close before merge rather than after.

@yiliang114
yiliang114 enabled auto-merge (squash) November 15, 2026 13:34

@doudouOUC doudouOUC left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

评审结论:通过(APPROVE)

  • 基线:head ee1ea45e56baca141ef40596fcc6f85471fae782,base 6f754be6548903e545e6ff0ed43a34927fe3bfb9;100 个文件 +6549/−595。相对上一轮评审的 850a1bca 只有 1 个提交、5 个文件(+32/−12)。
  • 历史评审:58 条 review thread 全部 resolved,无未解决线程;旧提交上的 CHANGES_REQUESTED 已不构成当前 head 的阻塞(当前 reviewDecision=REVIEW_REQUIRED)。
  • CI:必需门禁 Lint & Static、Classify PR、Test (ubuntu-latest, Node 22.x)、Integration Tests (no-AK, No Sandbox) 全部通过;Build unit-test tree、Linux unit tests (2 shards)、Managed loop、TUI parity、Serve A/B、Build and verify reference distribution、SDK Java Flyway 与 Real daemon E2E 也通过。SDK Java (fast) / ubuntu-latest(含新增 HarnessSdkValuesTest 与 Managed Agent H2 suite)与 web-shell E2E 在本评审提交时仍在运行(非必需门禁)。Runtime Broker and Managed Agent MySQL、Hosted process fault gates、Hosted failover E2E 为 skipped(fast tier 选择,见建议 2)。

上轮阻塞项(已修复)

1. SdkHarnessBoundary 未转发 supportsSavedLifecycle(String),生产装配下 files 禁用后 close/delete 会被 409 拒绝

  • 已在 packages/managed-agent-server/adapters/src/main/java/com/alibaba/qwen/code/managedagent/harness/SdkHarnessBoundary.java:244-247 增加与相邻方法一致的转发:return call(() -> delegate.supportsSavedLifecycle(profile));。
  • 生产装配 packages/managed-agent-server/server/src/main/java/com/alibaba/qwen/code/managedagent/config/HarnessConfiguration.java:76 与 :91 的两条 Connector bean 都由该边界包装,因此 ManagedAgentService.java:200/:1638、SessionLifecycleCoordinator.java:134/:771、SessionLifecycleService.java:166 现在能拿到 QwenHostedHarnessConnector.java:326-337 的 saved-lifecycle 结果;该实现只要求 lifecycle protocol 1 + EXTERNAL_FILES feature,不依赖 files 当前可用。files 被禁用后的 close/delete 不再因 supported=false 被拒绝。
  • 回归覆盖:packages/managed-agent-server/verification/src/test/java/com/alibaba/qwen/code/managedagent/harness/HarnessSdkValuesTest.java:51-59 新增 boundary 级转发断言(true/false 两分支);QwenHostedHarnessConnectorTest.java:913-943 已覆盖 files 禁用后 supportsSavedLifecycle=true、supportsLifecycle=false 的 connector 语义,两者组合覆盖生产边界。

上轮建议项(已修复)

  1. 设计文档链接已修正:docs/design/2026-10-25-external-hosted-workspace.md:269/:275、docs/design/2026-10-25-external-hosted-workspace.zh-CN.md:245/:251 的 5 个链接已补全 server/、contracts/、control-plane/、persistence/ 模块路径,已逐一确认目标文件存在。
  2. drain 回包文档已与实现对齐:docs/design/2026-10-25-external-hosted-workspace.md:255 / zh-CN.md:231 现在描述 receipts 会被接受并逐条校验(channelId + 同形状 manifest),unknown/undrained 不产生 receipt,undrained 的非空 channels 保持可重试;与 packages/managed-agent-server/runtime-http/src/main/java/com/alibaba/qwen/code/runtimebroker/adapter/HttpRuntimeTransport.java:561-583 一致。
  3. client-files 注册面已闭合:packages/cli/src/serve/hosted-harness-session.ts:9652-9663 对 external profile 返回 409 hosted_client_files_profile_unsupported,unregister 仍照常放行;与 packages/cli/src/serve/hosted-workspace-tool-turn.ts:2624-2629 external 分支不调用 clientFilesDeclarations() 的事实一致。

建议项(非阻塞)

  1. 新增的 external profile 拒绝分支缺少专用测试。packages/cli/src/serve/hosted-harness-session.test.ts:44483-44585 只覆盖 foregroundOnly 与 memory-only;建议补一个 external profile 的 register → 409 + unregister → 200 用例,防止后续改动删除该门禁。
  2. Managed Agent full / MySQL / hosted-fault 在本轮仍为 skipped;合并前建议确认真实 MySQL/full-tier 已覆盖 SQL physical holder 退役路径(这是上一轮遗留的验证建议,与本次增量无关)。

安全审查结论

本次增量只包含文档、boundary 能力转发、client-files 注册准入收紧与测试:未新增凭据、路由、SQL 或输入解析。对全量 diff 的密钥模式、Map.of(..., null)、拼接 SQL 扫描均无命中。结合上一轮全量扫描,未发现阻塞性安全问题(无硬编码密钥;SQL 参数化;external 工具白名单;路径与 drain 回包严格校验;闭合选项一致)。

总体评价

上轮唯一阻塞项与 3 条建议均已在 ee1ea45e 修复,修复方式与建议一致,未引入新的 Critical。结论:通过。

@yiliang114
yiliang114 merged commit b098616 into main Nov 15, 2026
64 of 65 checks passed
@qwen-code-review-bot

Copy link
Copy Markdown
Collaborator

Released in v0.28.0.

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

Labels

scope/sdk type/enhancement Non-bug improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants