Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions tasks/Delegation/script_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,44 @@ def ui_click(click, stop):
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:
self.screenshot()
if self.appear(self.I_D_START):
break
if enter_timer.reached():
logger.warning(f'Delegation: {name} enter timeout')
return False

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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_then_click(self.I_UI_CANCEL, interval=1):
Comment on lines 62 to +69

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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`.

continue

# 如果出现’召回‘ ’返回‘ 说明这个是现在委派中
# 需要退出
if self.appear(self.I_D_BACK):
logger.warning(f'Delegation: {name} is in delegation')
self.ui_click_until_disappear(self.I_D_BACK)
self.wait_until_appear(self.I_REWARDS_MIN)
back_timer = Timer(6).start()
while 1:
self.screenshot()
if not self.appear(self.I_D_BACK):
break
if back_timer.reached():
logger.warning('Exit delegation detail timeout')
break
# 若此时被取消弹窗遮挡返回,优先点取消
if self.appear_then_click(self.I_UI_CANCEL, interval=1):
continue
if self.appear_then_click(self.I_D_BACK, interval=1.2):
continue
self.wait_until_appear(self.I_REWARDS_MIN, wait_time=3)
return False
if self.appear_then_click(self.I_D_SKIP, interval=0.8):
continue
if self.appear_then_click(self.I_D_CONFIRM, interval=0.8):
continue
if self.ocr_appear_click(self.O_D_NAME, interval=1):
# 点击委派任务名:防抖由 1s 提升至 3s,杜绝跨页面过渡时误触右上角"完成(30勾玉)"
if self.ocr_appear_click(self.O_D_NAME, interval=3):
continue
# 进入委派 fefe e fe
logger.info(f'Enter Delegation: {name}')
Expand All @@ -81,10 +103,14 @@ def ui_click(click, stop):
ui_click(self.C_D_4, self.I_D_SELECT_4)
# 委派开始
logger.info(f'Delegation: {name} start')
start_timer = Timer(10).start()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

while 1:
self.screenshot()
if not self.appear(self.I_D_START):
break
if start_timer.reached():
logger.warning(f'Delegation: {name} start timeout')
break
if self.click(self.C_D_5, interval=0.8):
continue
if self.appear_then_click(self.I_D_START, interval=1.8):
Expand Down
Loading