Repository navigation
fix(Delegation): 修复误触勾玉立即完成及返回按钮死循环 - #1940
Conversation
- Raise OCR click debounce on task name from 1s to 3s so page-transition double-clicks do not hit the top-right finish-for-jade button. - Prefer GlobalGame I_UI_CANCEL (default threshold) when the jade confirm modal appears, both while entering and while exiting an in-progress task. - Replace ui_click_until_disappear(I_D_BACK) with a timed back loop that clears blocking cancel modals, avoiding GameTooManyClickError restarts. - Add enter/start timeouts so stuck states fail closed instead of looping. Refs: runhey#1162
There was a problem hiding this comment.
嘿——我发现了 3 个问题
给 AI 代理的提示
请处理这次代码审查中的评论:
## 单条评论
### 评论 1
<location path="tasks/Delegation/script_task.py" line_range="106" />
<code_context>
ui_click(self.C_D_4, self.I_D_SELECT_4)
# 委派开始
logger.info(f'Delegation: {name} start')
+ start_timer = Timer(10).start()
while 1:
self.screenshot()
</code_context>
<issue_to_address>
**委派可能无限期挂起**
如果始终没有出现队伍选择指示器,`ui_click` 就会一直等待该指示器;但 `start_timer` 只有在全部四次选择调用完成后才创建,因此任务会一直卡住。
请在选择调用开始前启动超时计时器,以限制等待时间。
</issue_to_address>
### 评论 2
<location path="tasks/Delegation/script_task.py" line_range="66" />
<code_context>
if not self.ocr_appear(self.O_D_NAME):
logger.warning(f'Delegation: {name} not found')
return False
+ enter_timer = Timer(15).start()
while 1:
</code_context>
<issue_to_address>
**委派超时后仍被报告为成功**
进入、返回或开始操作发生超时时,`delegate_one` 在某些超时情况下会返回 `False`,而只有开始操作超时时才会跳出循环;与此同时,`run` 忽略其结果并调用 `set_next_run(..., success=True)`,导致被跳过的任务仍会被安排并报告为成功。
所有超时情况都应返回失败,并让 `run` 根据该结果进行处理,而不是安排成功。
另请查看 `tasks/Delegation/script_task.py:83`、`tasks/Delegation/script_task.py:111-113`。
</issue_to_address>
### 评论 3
<location path="tasks/Delegation/script_task.py" line_range="62-69" />
<code_context>
+ enter_timer = Timer(15).start()
while 1:
self.screenshot()
if self.appear(self.I_D_START):
break
+ if enter_timer.reached():
+ logger.warning(f'Delegation: {name} enter timeout')
+ return False
+
+ # 检测到弹出的勾玉确认框,优先点击取消保护勾玉
+ if self.appear_then_click(self.I_UI_CANCEL, interval=1):
+ continue
+
</code_context>
<issue_to_address>
**确认弹窗会阻止委派**
当确认弹窗遮挡 `I_D_BACK`,或其后方仍能检测到 `I_D_START` 时,循环会先检查开始或返回指示器,再检查 `I_UI_CANCEL`,因此可能在未关闭弹窗的情况下退出,后续任务处理也会在被阻挡的屏幕上继续进行。
请在两个循环中,检查开始或返回指示器之前先检查并关闭 `I_UI_CANCEL`。
另请查看 `tasks/Delegation/script_task.py:79-85`。
</issue_to_address>Sourcery 评估
等待批准。 请先处理 3 个问题。
阻塞性问题:tasks/Delegation/script_task.py:106、tasks/Delegation/script_task.py:66、tasks/Delegation/script_task.py:69
Original comment in English
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tasks/Delegation/script_task.py" line_range="106" />
<code_context>
ui_click(self.C_D_4, self.I_D_SELECT_4)
# 委派开始
logger.info(f'Delegation: {name} start')
+ start_timer = Timer(10).start()
while 1:
self.screenshot()
</code_context>
<issue_to_address>
**Delegation can hang indefinitely**
When a team-selection indicator never appears, `ui_click` keeps waiting for the selection indicator, but `start_timer` is created only after all four selection calls finish, so the task remains stuck.
Bound the selection waits with a timeout that starts before the selection calls.
</issue_to_address>
### Comment 2
<location path="tasks/Delegation/script_task.py" line_range="66" />
<code_context>
if not self.ocr_appear(self.O_D_NAME):
logger.warning(f'Delegation: {name} not found')
return False
+ enter_timer = Timer(15).start()
while 1:
</code_context>
<issue_to_address>
**Timed-out delegation is reported successful**
When an enter, back, or start timeout fires, `delegate_one` returns `False` for some timeouts and only breaks on a start timeout, while `run` ignores its result and calls `set_next_run(..., success=True)`, so skipped work is scheduled and reported as successful.
Return failure for every timeout and make `run` handle that result instead of scheduling success.
Also at `tasks/Delegation/script_task.py:83`, `tasks/Delegation/script_task.py:111-113`.
</issue_to_address>
### Comment 3
<location path="tasks/Delegation/script_task.py" line_range="62-69" />
<code_context>
+ enter_timer = Timer(15).start()
while 1:
self.screenshot()
if self.appear(self.I_D_START):
break
+ if enter_timer.reached():
+ logger.warning(f'Delegation: {name} enter timeout')
+ return False
+
+ # 检测到弹出的勾玉确认框,优先点击取消保护勾玉
+ if self.appear_then_click(self.I_UI_CANCEL, interval=1):
+ continue
+
</code_context>
<issue_to_address>
**Confirmation modal blocks delegation**
When a confirmation modal obscures `I_D_BACK` or leaves `I_D_START` detectable behind it, the loops test the start or back indicator before `I_UI_CANCEL`, so they exit without dismissing the modal and subsequent task handling continues on a blocked screen.
Check and dismiss `I_UI_CANCEL` before testing the start or back indicators in both loops.
Also at `tasks/Delegation/script_task.py:79-85`.
</issue_to_address>Sourcery assessment
Approval pending. 3 findings to address first.
Blocking findings: tasks/Delegation/script_task.py:106, tasks/Delegation/script_task.py:66, tasks/Delegation/script_task.py:69
| ui_click(self.C_D_4, self.I_D_SELECT_4) | ||
| # 委派开始 | ||
| logger.info(f'Delegation: {name} start') | ||
| start_timer = Timer(10).start() |
There was a problem hiding this comment.
🟡 Medium · 委派可能无限期挂起
如果始终没有出现队伍选择指示器,ui_click 就会一直等待该指示器;但 start_timer 只有在全部四次选择调用完成后才创建,因此任务会一直卡住。
请在选择调用开始前启动超时计时器,以限制等待时间。
给 AI 代理的提示
在 `tasks/Delegation/script_task.py` 第 106 行:
**委派可能无限期挂起**
如果始终没有出现队伍选择指示器,`ui_click` 就会一直等待该指示器;但 `start_timer` 只有在全部四次选择调用完成后才创建,因此任务会一直卡住。
请在选择调用开始前启动超时计时器,以限制等待时间。Original comment in English
🟡 Medium · Delegation can hang indefinitely
When a team-selection indicator never appears, ui_click keeps waiting for the selection indicator, but start_timer is created only after all four selection calls finish, so the task remains stuck.
Bound the selection waits with a timeout that starts before the selection calls.
Prompt for AI agents
In `tasks/Delegation/script_task.py` at line 106:
**Delegation can hang indefinitely**
When a team-selection indicator never appears, `ui_click` keeps waiting for the selection indicator, but `start_timer` is created only after all four selection calls finish, so the task remains stuck.
Bound the selection waits with a timeout that starts before the selection calls.| break | ||
| if enter_timer.reached(): | ||
| logger.warning(f'Delegation: {name} enter timeout') | ||
| return False |
There was a problem hiding this comment.
🟡 Medium · 委派超时后仍被报告为成功
进入、返回或开始操作发生超时时,delegate_one 在某些超时情况下会返回 False,而只有开始操作超时时才会跳出循环;与此同时,run 忽略其结果并调用 set_next_run(..., success=True),导致被跳过的任务仍会被安排并报告为成功。
所有超时情况都应返回失败,并让 run 根据该结果进行处理,而不是安排成功。
另请查看 tasks/Delegation/script_task.py:83、tasks/Delegation/script_task.py:111-113。
给 AI 代理的提示
在 `tasks/Delegation/script_task.py` 第 66 行:
**委派超时后仍被报告为成功**
进入、返回或开始操作发生超时时,`delegate_one` 在某些超时情况下会返回 `False`,而只有开始操作超时时才会跳出循环;与此同时,`run` 忽略其结果并调用 `set_next_run(..., success=True)`,导致被跳过的任务仍会被安排并报告为成功。
所有超时情况都应返回失败,并让 `run` 根据该结果进行处理,而不是安排成功。
另请查看 `tasks/Delegation/script_task.py:83`、`tasks/Delegation/script_task.py:111-113`。Original comment in English
🟡 Medium · Timed-out delegation is reported successful
When an enter, back, or start timeout fires, delegate_one returns False for some timeouts and only breaks on a start timeout, while run ignores its result and calls set_next_run(..., success=True), so skipped work is scheduled and reported as successful.
Return failure for every timeout and make run handle that result instead of scheduling success.
Also at tasks/Delegation/script_task.py:83, tasks/Delegation/script_task.py:111-113.
Prompt for AI agents
In `tasks/Delegation/script_task.py` at line 66:
**Timed-out delegation is reported successful**
When an enter, back, or start timeout fires, `delegate_one` returns `False` for some timeouts and only breaks on a start timeout, while `run` ignores its result and calls `set_next_run(..., success=True)`, so skipped work is scheduled and reported as successful.
Return failure for every timeout and make `run` handle that result instead of scheduling success.
Also at `tasks/Delegation/script_task.py:83`, `tasks/Delegation/script_task.py:111-113`.| if self.appear(self.I_D_START): | ||
| break | ||
| if enter_timer.reached(): | ||
| logger.warning(f'Delegation: {name} enter timeout') | ||
| return False | ||
|
|
||
| # 检测到弹出的勾玉确认框,优先点击取消保护勾玉 | ||
| if self.appear_then_click(self.I_UI_CANCEL, interval=1): |
There was a problem hiding this comment.
🟠 High · 确认弹窗会阻止委派
当确认弹窗遮挡 I_D_BACK,或其后方仍能检测到 I_D_START 时,循环会先检查开始或返回指示器,再检查 I_UI_CANCEL,因此可能在未关闭弹窗的情况下退出,后续任务处理也会在被阻挡的屏幕上继续进行。
请在两个循环中,检查开始或返回指示器之前先检查并关闭 I_UI_CANCEL。
另请查看 tasks/Delegation/script_task.py:79-85。
给 AI 代理的提示
在 `tasks/Delegation/script_task.py` 第 62–69 行:
**确认弹窗会阻止委派**
当确认弹窗遮挡 `I_D_BACK`,或其后方仍能检测到 `I_D_START` 时,循环会先检查开始或返回指示器,再检查 `I_UI_CANCEL`,因此可能在未关闭弹窗的情况下退出,后续任务处理也会在被阻挡的屏幕上继续进行。
请在两个循环中,检查开始或返回指示器之前先检查并关闭 `I_UI_CANCEL`。
另请查看 `tasks/Delegation/script_task.py:79-85`。Original comment in English
🟠 High · Confirmation modal blocks delegation
When a confirmation modal obscures I_D_BACK or leaves I_D_START detectable behind it, the loops test the start or back indicator before I_UI_CANCEL, so they exit without dismissing the modal and subsequent task handling continues on a blocked screen.
Check and dismiss I_UI_CANCEL before testing the start or back indicators in both loops.
Also at tasks/Delegation/script_task.py:79-85.
Prompt for AI agents
In `tasks/Delegation/script_task.py` at lines 62-69:
**Confirmation modal blocks delegation**
When a confirmation modal obscures `I_D_BACK` or leaves `I_D_START` detectable behind it, the loops test the start or back indicator before `I_UI_CANCEL`, so they exit without dismissing the modal and subsequent task handling continues on a blocked screen.
Check and dismiss `I_UI_CANCEL` before testing the start or back indicators in both loops.
Also at `tasks/Delegation/script_task.py:79-85`.
Findings
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "ab.chatgpt.com"See Network Configuration for more information.
|
|
#1870 会不会是这个引入的问题 |
问题
Related #1162 (式神委派反复进出卡死)
委派任务中存在以下问题:
修复
仅修改 asks/Delegation/script_task.py:
测试
Checklist
Sourcery 摘要
通过防止意外完成 gem 操作,并确保异常界面退出而不是无限挂起,让委托导航更安全。
Bug 修复:
改进:
Original summary in English
Summary by Sourcery
Make delegation navigation safer by preventing accidental gem completion and ensuring abnormal screens exit instead of hanging indefinitely.
Bug Fixes:
Enhancements: