Skip to content

fix(combat): 迂回按钮漏检时复检而非默认开战 - #584

Closed
kuainx wants to merge 1 commit into
mainfrom
fix/detour-recheck
Closed

kuainx wants to merge 1 commit into
mainfrom
fix/detour-recheck

Conversation

@kuainx

@kuainx kuainx commented Nov 21, 2026

Copy link
Copy Markdown
Collaborator

evidence.detour=None 视为未知而非否定: 仅当 decision.detour=True 且按钮未命中时重新截图复检 BYPASS 模板 (最多3次, 间隔0.3s), 复检仍不中则告警后按无按钮进战斗; decision.detour=False 不复检, 行为不变。

evidence.detour=None 视为未知而非否定: 仅当 decision.detour=True 且按钮未命中时重新截图复检 BYPASS 模板 (最多3次, 间隔0.3s), 复检仍不中则告警后按无按钮进战斗; decision.detour=False 不复检, 行为不变。

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review from [deepseek-v4-flash]:
- Total changes: 1
- Filtered: 1
- Reviewed: 1
- Found issues: 1

)
want_detour = can_detour and decision.detour

# 阵型规则优先

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

根据代码审核原则,我发现了以下可改进的问题:

  1. 复检条件覆盖范围过宽:if decision.detour and not can_detour: 中,not can_detour 对 False 和 None 都为 True。但 False 表示检测器明确认定“无按钮”,并非“证据未知/漏检”。这会导致在明确无按钮时也进行额外的多次截图复检,增加了不必要开销。建议将条件改为 can_detour is None 或 can_detour is not True(若需兼容 None 与 False 时可明确注释说明,但当前注释倾向只针对 None 漏检场景)。

  2. 潜在的类型语义不一致:原代码中 evidence.detour 可能为 None/True/False,而 can_detour 在 evidence is None 时通过 image_exist 直接返回布尔值。修改后,若 evidence.detour 为 None,复检成功则赋值为 True,失败则赋值为 False,类型上做了收敛,这是好的。但建议在赋值前明确注释类型,或在初始化时将 None 统一转为 False,以减少后续逻辑分支的复杂性。

  3. 日志仅覆盖复检失败场景:当复检成功时没有日志,可能不利于排查“第一次漏检但复检命中”的情况。建议在复检命中时添加一条 debug 日志,便于追踪动态决策过程。

除此之外,该修改逻辑清晰,方法抽取合理,没有发现安全风险和兼容性问题。

@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
1910 1 1909 25
View the top 1 failed test(s) by shortest run time
testing.server.test_task_manager::test_successful_rounds_mark_task_completed
Stack Traces | 0.004s run time
def test_successful_rounds_mark_task_completed() -> None:
        """A task completes only when every returned round succeeded."""
        manager = TaskManager()
        results = [
            {'round': 1, 'success': True},
            {'round': 2, 'success': True},
        ]
    
>       manager.start_task(
            task_type='normal_fight',
            total_rounds=2,
            executor=lambda _task: TaskOutcome.from_results(results),
        )

testing/server/test_task_manager.py:55: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
autowsgr/server/task_manager.py:176: in start_task
    lease_token = self._device_lease.acquire(f'task:{task_id}')
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <autowsgr.server.device_lease.DeviceOperationLease object at 0x7008809512b0>
owner = 'task:task_48d4b314'

    def acquire(self, owner: str) -> DeviceOperationToken:
        """Acquire ownership immediately or report that the device is busy."""
        with self._lock:
            if self._token is not None:
>               raise DeviceOperationBusyError(f'设备正由 {self._token.owner} 使用')
E               autowsgr.server.device_lease.DeviceOperationBusyError: 设备正由 task:task_2e3b751f 使用

autowsgr/server/device_lease.py:38: DeviceOperationBusyError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@kuainx kuainx closed this Nov 21, 2026
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