Add step_repair: repair-tactic policy for failed / no-effect actions#382
Merged
Conversation
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.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 37 |
| Duplication | 0 |
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



摘要
新增
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/—RepairPolicy、RepairOutcome、plan_repair、next_tactic、run_with_repair。je_auto_control匯出 +__all__。AC_plan_repair({count, tactics};規劃層——run_with_repair因接受注入 callable 由 Python 驅動)。ac_plan_repair(read-only)。測試
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 全乾淨。