Skip to content

fix(web-ui): avoid wait-turn handoff prompt when first turn fails or stops - #1273

Merged
iruriQ merged 1 commit into
mainfrom
fix/issue-1263
Nov 27, 2026
Merged

iruriQ merged 1 commit into
mainfrom
fix/issue-1263

Conversation

@iruriQ

@iruriQ iruriQ commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #1263

When a new external Harness session fails on its first turn (e.g. host/rejected) or stops/aborts before any turn completes, opening the Composer Harness picker previously still showed "当前轮次完成后可交接上下文。" ("Available after the current turn finishes."), misleading users to keep waiting even though the session is no longer running.

Root Cause

resolveHandoffPoint in apps/web-ui/packages/client/ui-model-selection/src/client/handoff.ts did not inspect session.running and returned { status: "pending" } for every non-ready session without a completed turn. HarnessSelect.tsx then unconditionally mapped handoffStatus === "pending" to harness.handoffWaitTurn.

Changes

  • apps/web-ui/packages/client/ui-model-selection/src/client/slots.ts: Add "unavailable" to HarnessHandoffStatus to distinguish a stopped session with no completed context from an actively running turn ("pending").
  • apps/web-ui/packages/client/ui-model-selection/src/client/handoff.ts: Require running: boolean on HandoffSessionSnapshotLike and return "pending" only when session.running === true; otherwise return "unavailable" when no completed turn exists. Existing "ready" resolution (completed turn, fallback to last completed turn atSeq, or hasMore) is unchanged.
  • apps/web-ui/packages/client/ui-model-selection/src/client/HarnessSelect.tsx & locales.ts: Render harness.handoffNoContext ("暂无已完成的轮次可交接上下文。" / "No completed turn available to hand off yet.") for "unavailable", keeping "pending" strictly for actively running turns and "ready" unchanged.
  • apps/web-ui/packages/client/ui-model-selection/test/handoff.test.ts: Cover running vs. stopped empty/aborted/errored first turns as well as retry-in-progress cases.

UI Note

Footer label text only (no layout or styling changes): replaces the misleading "当前轮次完成后可交接上下文。" / "Available after the current turn finishes." footer label with "暂无已完成的轮次可交接上下文。" / "No completed turn available to hand off yet." when handoffStatus === "unavailable". Live screenshot capture was not run in this isolated worktree (host launch commands are intentionally skipped).

Validation

  • npx vitest run --config tests/vitest.config.js apps/web-ui/packages/client/ui-model-selection/test/ (3 files, 12 tests passed)
  • npx tsc --noEmit -p apps/web-ui/tsconfig.json (passed)
  • npx prettier --check on all 5 modified files (passed)
  • npx tsc -b packages/shared-contracts packages/desktop-control && npm run build:web:ui (passed)

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Summary

Summary by CodeRabbit

  • 功能改进
    • 交接状态现在会显示对应提示:可交接时显示交接提示,处理中时显示等待提示;没有可用交接上下文时会明确提示。
  • 问题修复
    • 会根据会话是否正在运行及已完成轮次情况判断交接状态,避免在会话已停止或没有可用上下文时显示不准确的提示。

交接状态现在根据会话运行状态和轮次事件区分为 ready、pending 或 unavailable。Harness 选择器页脚按状态显示提示,并新增中英文的无可用上下文文案。

Changes: Harness 交接状态与提示

Layer / File(s) Summary
交接状态判定与测试
apps/web-ui/packages/client/ui-model-selection/src/client/handoff.ts, apps/web-ui/packages/client/ui-model-selection/src/client/slots.ts, apps/web-ui/packages/client/ui-model-selection/test/handoff.test.ts
HandoffSessionSnapshotLike 新增必需的 running 字段,HarnessHandoffStatus 新增 unavailable。resolveHandoffPoint 和测试现在区分运行中的会话与已停止且无可用轮次的会话。
选择器页脚提示
apps/web-ui/packages/client/ui-model-selection/src/client/HarnessSelect.tsx, apps/web-ui/packages/client/ui-model-selection/src/client/locales.ts
页脚为 ready、pending 和其他状态显示不同提示。中英文词典新增无可用交接上下文的文案。

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: bytepioneer-ai

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@iruriQ
iruriQ merged commit f8c977b into main Nov 27, 2026
6 of 8 checks passed
@iruriQ
iruriQ deleted the fix/issue-1263 branch November 27, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 外部 Harness 首轮启动失败后,跨 Harness 交接菜单仍提示「当前轮次完成后可交接上下文」

2 participants