fix(agent): 区分规格入口点击目标不唯一 (#209)

解析阶段已收敛到唯一语义候选,点击阶段的歧义来自控件树对该目标的
重复匹配。原文案沿用「候选不唯一」,与同串中 specEntryCandidates=1
的证据自相矛盾,不利于事后排查,改为「点击目标不唯一」。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F
This commit is contained in:
QiuSW
2026-09-03 16:54:51 +08:00
co-authored by Claude Opus 5
parent ac6a57e4f3
commit 9e800ce023
2 changed files with 5 additions and 2 deletions
@@ -289,9 +289,12 @@ class PurchaseRehearsalExecutor(
}
val click = driver.clickFreshDetailed(target)
when (click.result) {
// The parser already narrowed to a single semantic candidate; the
// ambiguity here comes from the live tree matching that target more
// than once at click time, so the wording must not claim otherwise.
FreshActionResult.AMBIGUOUS -> return failure(
SPEC_ENTRY_TARGET_AMBIGUOUS,
"规格入口候选不唯一 [${specEntryEvidence(screen, candidates.size)}]",
"规格入口点击目标不唯一 [${specEntryEvidence(screen, candidates.size)}]",
)
FreshActionResult.SUCCESS -> Unit
else -> return failure(SPEC_ENTRY_CLICK_FAILED, click.reason.specEntrySubreason())
@@ -623,7 +623,7 @@ class PurchaseRehearsalExecutorTest {
assertEquals("PURCHASE_SPEC_ENTRY_TARGET_AMBIGUOUS", ambiguous.errorCode)
assertEquals(
"规格入口候选不唯一 [specEntryCandidates=1;explicit=1;nested=0;bottomPurchase=0;panelAlreadyOpen=false;reviewPage=false;pageEvidence=true]",
"规格入口点击目标不唯一 [specEntryCandidates=1;explicit=1;nested=0;bottomPurchase=0;panelAlreadyOpen=false;reviewPage=false;pageEvidence=true]",
ambiguous.message,
)
}