From d1e31f535ecb83f3a1e9351c8f6c6a122bf709c0 Mon Sep 17 00:00:00 2001 From: Codex Agent Date: Tue, 13 Oct 2026 18:53:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AE=E8=AF=A2=E6=9C=9F=E9=97=B4=E6=B8=85?= =?UTF-8?q?=E6=8E=89=E6=8C=A1=E8=B7=AF=E7=9A=84=E6=A8=A1=E6=80=81=E6=A1=86?= =?UTF-8?q?=EF=BC=88=E6=A8=A1=E7=BB=84=E4=B8=8D=E8=B6=B3=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2026-10-13 18:21 那轮 daily 卡死两回, 每次卡满 10 分钟才被 no_progress 判据救回。 抓屏看到真正原因 —— 游戏弹了一个 AALC 不处理的模态框: You don't have enough Enkephalin Modules. Would you like to go assemble some? [X Cancel] [Confirm] AALC 的 Luxcavation 流程不认这个框, 它一直在模态框后面点被挡住的 Enter 按钮 (实测同一坐标点了 30 次), 直到外层判超时。 修法: poll_task 每轮都调 clear_blocking_modal(), 见框就点 Cancel 拒绝去组装, AALC 就能自己往下走(该关卡过不去, 它会降级试下一关)。 踩到的细节: 手工点一次 Cancel 不够 —— AALC 马上又点 Enter, 模态框立刻重弹。 所以清道夫必须每次轮询都跑, 不能只在卡死时救一次。 清道夫点的是识别框中心(不是左上角), 且只认这一个标记, 别的一律不碰。 实测: 点掉后画面回到关卡选择页, 模态框消失; 对网格等其它画面不做任何动作。 同时确认了免费兑换路径本身是好的: make_enkephalin_module.py:153 分支会点 Confirm 完成 Enkephalin -> Modules 兑换, 与 set_lunacy_to_enkephalin 无关。这一轮之所以 没换成, 是 Enkephalin 只剩 3/126 —— 资源真的见底了, 不是被配置挡住。 新增 tests/test_auto_cycle.py 的 BlockingModalTest 3 个用例(点中心/别的不碰/OCR 粘连)。 全套 231/231 通过。 --- scripts/auto_cycle.py | 32 +++++++++++++++++++++++++++++ tests/test_auto_cycle.py | 44 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) diff --git a/scripts/auto_cycle.py b/scripts/auto_cycle.py index 70fc147..7ba117d 100644 --- a/scripts/auto_cycle.py +++ b/scripts/auto_cycle.py @@ -127,6 +127,31 @@ def ensure_team1(): return False +def clear_blocking_modal(): + """清掉挡在 AALC 前面的模态框, 返回清掉的说明或 None。 + + 2026-10-13 实测: Enkephalin Modules 不足时游戏弹出 + "You don't have enough Enkephalin Modules. / Would you like to go assemble some?" + 而 AALC 的 Luxcavation 流程不认这个框 —— 它一直在后面点被挡住的 Enter 按钮, + 每次都要等满 10 分钟被 no_progress 判据救回来。点 Cancel 拒绝去组装, + AALC 就会自己往下走(该关卡过不去, 它会降级试下一关)。 + + 只在轮询里做这件事, 不碰 AALC 自己的识别; 模态框本来就挡住了一切输入, + 点它的 Cancel 不会造成误操作。 + """ + its = items() + txt = ' '.join(i.get('text', '') for i in its).replace(' ', '') + if 'enoughEnkephalinModules' not in txt: + return None + for it in its: + if 'cancel' in it.get('text', '').lower(): + w = it.get('w') or 0 + h = it.get('h') or 0 + click(it['x'] + w / 2.0, it['y'] + h / 2.0) + return 'Enkephalin Modules 不足 -> 点 Cancel' + return None + + def poll_task(task, timeout_s, sleep=time.sleep): """轮询到任务结束。返回 (ok, 说明, 是否因卡死被停)。""" t0 = time.time() @@ -142,6 +167,13 @@ def poll_task(task, timeout_s, sleep=time.sleep): if st.get('errors'): return False, '%s: %s' % (s, st['errors'][-1]), False return s == 'succeeded', 'state=%s elapsed=%ds' % (s, el), False + try: + cleared = clear_blocking_modal() + except Exception as e: # 清道夫不该拖垮轮询 + cleared = None + log(' [warn] 清模态框时出错: %s' % e) + if cleared: + log(' [fix] %s' % cleared) stalled = stalled + 1 if st.get('stall') else 0 if stalled >= STALL_POLLS: probe('stop_task') diff --git a/tests/test_auto_cycle.py b/tests/test_auto_cycle.py index 418bfd2..7a1cb77 100644 --- a/tests/test_auto_cycle.py +++ b/tests/test_auto_cycle.py @@ -108,6 +108,50 @@ class ScreenDetectTest(unittest.TestCase): self.assertFalse(auto_cycle.on_grid(t)) +class BlockingModalTest(unittest.TestCase): + """挡路模态框清道夫。 + + 2026-10-13 实测: 模组不足时游戏弹 + "You don't have enough Enkephalin Modules. / Would you like to go assemble some?" + AALC 的 Luxcavation 流程不认它, 一直在后面点被挡住的 Enter 按钮, 每次卡满 + 10 分钟才被 no_progress 判据救回来。清道夫点 Cancel 之后 AALC 就能继续降级 + 试下一关。 + """ + + MODAL = [{'text': "You don't have enough Enkephalin Modules.", 'x': 554, 'y': 404, 'w': 460, 'h': 24}, + {'text': 'Would you like to go assemble some?', 'x': 593, 'y': 439, 'w': 380, 'h': 24}, + {'text': 'X Cancel', 'x': 592, 'y': 599, 'w': 90, 'h': 26}, + {'text': 'Confirm', 'x': 924, 'y': 599, 'w': 100, 'h': 26}] + + def test_clicks_cancel_centre(self): + clicked = [] + with mock.patch.object(auto_cycle, 'items', lambda: list(self.MODAL)), \ + mock.patch.object(auto_cycle, 'click', lambda x, y: clicked.append((x, y))): + msg = auto_cycle.clear_blocking_modal() + self.assertIn('Cancel', msg) + # 点的是识别框中心, 不是左上角 —— 实测点左上角常常落空 + self.assertEqual(clicked, [(592 + 45, 599 + 13)]) + + def test_other_screens_are_left_alone(self): + clicked = [] + grid = [{'text': 'TEAMS#1', 'x': 100, 'y': 300}, + {'text': 'IDENTITIES', 'x': 200, 'y': 300}] + with mock.patch.object(auto_cycle, 'items', lambda: grid), \ + mock.patch.object(auto_cycle, 'click', lambda x, y: clicked.append((x, y))): + self.assertIsNone(auto_cycle.clear_blocking_modal()) + self.assertEqual(clicked, []) + + def test_spaces_in_ocr_text_still_match(self): + # OCR 常把词粘在一起或拆开, 所以标记比对前先去空格 + modal = [{'text': "You don'thave enough EnkephalinModules", 'x': 10, 'y': 20, 'w': 10, 'h': 10}, + {'text': 'Cancel', 'x': 30, 'y': 40, 'w': 10, 'h': 10}] + clicked = [] + with mock.patch.object(auto_cycle, 'items', lambda: modal), \ + mock.patch.object(auto_cycle, 'click', lambda x, y: clicked.append((x, y))): + self.assertIsNotNone(auto_cycle.clear_blocking_modal()) + self.assertEqual(clicked, [(35, 45)]) + + class LunacyReadTest(unittest.TestCase): """狂气校验是"不许消费"的唯一防线, 读不到就是没校验, 所以要重试。