Skip to content

Add step_repair: repair-tactic policy for failed / no-effect actions#382

Merged
JE-Chen merged 1 commit into
devfrom
feat/step-repair-batch
Jun 23, 2026
Merged

Add step_repair: repair-tactic policy for failed / no-effect actions#382
JE-Chen merged 1 commit into
devfrom
feat/step-repair-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 23, 2026

Copy link
Copy Markdown
Member

摘要

新增 plan_repair / next_tactic / run_with_repair — 失敗 / 無效果動作的修復策略引擎self_healing / locator_repair 只修復無法解析的定位器(找不到元素);當元素找到並點擊了卻無效果時無能為力。loop_guard偵測卡住的迴圈,沒有戰術選擇或退避。

本功能是缺少的控制器:消費一個效果判定(例如來自 action_effect),並驅動有界的重試迴圈,每輪選下一個尚未嘗試的戰術——wait_retry / relocate / nudge / scroll_into_view / escalate。純標準函式庫狀態機;每個副作用(執行動作、驗證、套用戰術、睡眠)都是注入的可呼叫物件,因此完全確定性、可無裝置測試。與 action_effect + postcondition 完成 agent 自我修正三件套。Qt-free。

五層

  • 核心:utils/step_repair/RepairPolicyRepairOutcomeplan_repairnext_tacticrun_with_repair
  • Facade:由 je_auto_control 匯出 + __all__
  • Executor:AC_plan_repair({count, tactics};規劃層——run_with_repair 因接受注入 callable 由 Python 驅動)。
  • MCP:ac_plan_repair(read-only)。
  • Script Builder:Plan Repair Tactics(Native UI)。
  • 文件:v170 EN + Zh + toctree。更新日誌:root EN + zh-TW + zh-CN。

測試

test/unit_test/headless/test_step_repair_batch.py — no_op 戰術排序、changed_elsewhere 升級、接受 EffectVerdict dict、next_tactic 跳過已用、run_with_repair 第 3 次成功(用 2 戰術)、耗盡失敗、首次即成功、wiring + facade。9 passed。ruff / bandit / radon / float-scan / Qt-free 全乾淨。

self_healing/locator_repair only fix a locator that didn't resolve; loop_guard
only detects a stuck loop with no tactic selection or backoff. Consume an
effect verdict and drive a bounded retry loop, choosing the next untried tactic
(wait_retry/relocate/nudge/scroll_into_view/escalate) each round. Pure-stdlib
state machine with injected act/verify/apply_tactic/verdict_for/sleep seams.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 37 complexity · 0 duplication

Metric Results
Complexity 37
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 4856a04 into dev Jun 23, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/step-repair-batch branch June 23, 2026 20:48
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant