Skip to content

feat(managed-agent): a second concurrent Session on the same Workspace mount should queue, not fail the Turn terminally #13328

Description

@wenshao

feat(managed-agent): a second concurrent Session on the same Workspace mount should queue, not fail the Turn terminally

What happened?

Reproduced deterministically by the new --second-workspace-session mode of
scripts/run-managed-agent-server-e2e.ts (full packaged stack, macOS arm64).

Two Workspace-bound Sessions share one mount; both Turns are admitted and run
concurrently. The second Session's Turn fails:

qwen serve: Hosted Harness turn … failed: Error: Runtime Broker returned
HTTP 409 (workspace_busy).
{
  "completedTurns": 1,
  "failedTurns": 1,
  "busyEvidence": true,
  "crossTalk": false
}

The Broker correctly serializes the mount — but the failure surfaces as a
terminal turn.failed (hosted_turn_failed), not a queued admission or a
classified, retryable rejection. A second user (or a second Tab/agent) on the
same Workspace simply loses the Turn; the client cannot tell "busy, try
later" from a genuine execution failure, and the coordinator does not
redrive.

What did you expect to happen?

One of:

  • the second Turn queues until the mount frees (admission stays 202, the Turn
    starts after the first finishes); or
  • admission/settlement is refused with a classified workspace_busy
    code the client can retry — not the generic hosted_turn_failed.

Positives in the current behavior, pinned by the mode: no cross-Session text
leakage, and the winner's tool executes exactly once.

Client information

Packaged-stack E2E runner (--second-workspace-session), repo HEAD
1cf80d46d0, macOS arm64. The mode pins the current fail-terminal behavior
and fails loudly if both Sessions ever complete — i.e. when queueing or
serialization lands.

Anything else we need to know?

Parent: #12380. This is arguably a product decision rather than a defect;
filing so the fail-terminal shape is a conscious choice with a named code.

中文

发生了什么?

--second-workspace-session 模式确定性复现:两个 Workspace 绑定 Session 共享一个
挂卷、并发跑 Turn。Broker 正确地串行化挂卷——但第二个 Session 的 Turn 以
turn.failed(hosted_turn_failed)终态失败,根因是 Broker 409
workspace_busy。客户端无法区分「忙,稍后重试」与「真实执行失败」,协调器也不会
重驱。

期望行为

二选一:第二个 Turn 排队等挂卷释放;或者以可归因的 workspace_busy 错误码拒绝
(客户端可重试),而不是笼统的 hosted_turn_failed。当前行为的正面性质已钉住:
无跨 Session 文本泄漏,胜方工具恰好执行一次。

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions