Conversation
## Summary by Sourcery Bug Fixes: - 修复智能调度中高优先级任务切换不正确的问题,改为使用配置中的禁用标志而不是运行时任务状态。 <details> <summary>Original summary in English</summary> ## Summary by Sourcery Bug Fixes: - Fix incorrect smart scheduling high-priority task switching by using the config disable flag instead of runtime task state. </details>
## Summary by Sourcery 通过可配置的硬币目标调度以及在基于硬币和基于行动点补充之间更清晰的状态处理,改进智能调度的硬币补充行为。 新功能: - 在智能调度中新增用于硬币目标调度和硬币补充返回阈值的配置开关。 - 引入硬币和行动点补充状态跟踪,以区分当前处于激活补充阶段以及对应的补充目标。 缺陷修复: - 修正智能调度逻辑,使硬币补充能够基于目标阈值完成,然后再回到正常的 erosion-1 升级模式。 - 调整行动点比较条件,将“达到最低保留值”视为仍然不足,从而推迟智能调度的执行。 - 修复通知和日志,使其报告硬币目标阈值和补充状态,而不是只报告保留值。 增强改进: - 优化智能调度在硬币/行动点不足时的日志与推送通知,更好地描述补充目标和补充阶段。 - 抽取辅助方法,用于封装硬币目标调度检查和补充目标计算,减少重复逻辑。 <details> <summary>Original summary in English</summary> ## Summary by Sourcery Improve smart scheduling coin replenishment behavior with configurable coin-target scheduling and clearer state handling between coin-based and action-point-based replenishment. New Features: - Add configuration switches for coin-target scheduling and coin replenishment return threshold in smart scheduling. - Introduce coin and action-point replenishment state tracking to distinguish active replenishment phases and targets. Bug Fixes: - Correct smart scheduling logic so coin replenishment completes based on a target threshold before returning to normal erosion-1 leveling. - Adjust action point comparison conditions to treat reaching the minimum reserve as insufficient and delay smart scheduling accordingly. - Fix notifications and logs to report coin-target thresholds and replenishment status instead of only preserve values. Enhancements: - Refine smart scheduling logs and push notifications for insufficient coins/action points to better describe replenishment targets and phases. - Extract helper methods to encapsulate coin-target scheduling checks and replenishment target calculation, reducing duplicated logic. </details>
PS:移动端不知道为什么有点问题 不知道咋修
## Summary by Sourcery 为 OS 自动搜索添加可配置的时间上限,用于检测并中止卡死的运行,并在策略搜索和喵喵官(Meowfficer)养成流程中传播新的卡死相关异常。 新特性: - 为 OS 地图引入可配置的自动搜索时间上限(单位:分钟),在超出时抛出卡死错误。 错误修复: - 确保长时间运行或卡死的 OS 自动搜索能够被中止,而不是无限挂起。 增强优化: - 更新策略搜索、巡逻扫描以及喵喵官养成逻辑,将 `GameStuckError` 和相关可恢复异常视为任务级信号。 - 使 `Timer.start()` 通过返回 `Timer` 实例实现可链式调用,并清理过时的自动搜索辅助逻辑。 构建: - 在生成配置和参数配置中添加 `AutoSearchTimeLimit`,并设置校验边界,同时将其接入模板和 i18n 文件。 <details> <summary>Original summary in English</summary> ## Summary by Sourcery Add a configurable time limit for OS auto-search to detect and abort stuck runs, and propagate the new stuck-related exceptions through strategic search and Meowfficer farming flows. New Features: - Introduce a configurable auto-search time limit (in minutes) for OS maps that raises a stuck error when exceeded. Bug Fixes: - Ensure long-running or stuck OS auto-search runs are aborted instead of hanging indefinitely. Enhancements: - Update strategic search, patrol scan, and Meowfficer farming logic to treat GameStuckError and related recoverable exceptions as task-level signals. - Make Timer.start() chainable by returning the Timer instance and clean up obsolete auto-search helper logic. Build: - Add AutoSearchTimeLimit to the generated and argument configuration, with validation bounds, and wire it into templates and i18n files. </details>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Reviewer's Guide引入可配置的自动搜索时间限制,并优化智能调度中的硬币/AP(体力)补充逻辑,包括基于目标硬币数量的调度模式、新阈值,以及针对卡住/溢出状态的异常传播改进。 OS 自动搜索时间限制与 GameStuckError 传播的序列图sequenceDiagram
actor User
participant OpsiScheduler as MeowfficerFarming
participant OSMap
participant Timer
User->>OpsiScheduler: _meow_handle_stay_in_zone
OpsiScheduler->>OSMap: run_strategic_search
OSMap->>OSMap: run_auto_search
OSMap->>Timer: start
Note over OSMap,Timer: auto_search_time_limit_timer
loop auto search loop
OSMap->>OSMap: handle_os_auto_search_map_option
OSMap->>OSMap: handle_retirement
OSMap->>OSMap: combat_appear / handle_map_event
OSMap->>Timer: reset
OSMap->>Timer: reached
alt Timer reached
OSMap-->>OpsiScheduler: GameStuckError
else not reached
OSMap->>OSMap: continue loop
end
end
OpsiScheduler->>OpsiScheduler: run_strategic_search
OpsiScheduler-->>User: propagate GameStuckError
更新后的智能调度硬币/AP 补充的序列图sequenceDiagram
participant Scheduler as OpsiMeowfficerFarming
participant Config
participant CoinTask
Scheduler->>Scheduler: run_smart_scheduling_once
Scheduler->>Scheduler: _get_smart_scheduling_operation_coins_preserve
Scheduler->>Scheduler: _get_effective_cl1_ap_preserve
Scheduler->>Scheduler: _get_coin_task_action_point_preserve
Scheduler->>Scheduler: _is_coin_target_scheduling_enabled
Scheduler->>Scheduler: _is_coin_replenish_active / _is_ap_replenish_active
alt coin_target_scheduling
Scheduler->>Scheduler: _get_coin_replenish_target
alt yellow_coins >= coin_target
Scheduler->>Scheduler: _clear_coin_replenish_target
Scheduler->>Scheduler: _run_scheduled_hazard1_leveling
else yellow_coins < coin_target
alt total_ap <= meow_ap_preserve
Scheduler->>Scheduler: _handle_smart_scheduling_no_task
Scheduler-->>Config: task_delay
else total_ap > meow_ap_preserve
Scheduler->>Scheduler: _dispatch_coin_task
Scheduler-->>CoinTask: proxy coin farming
end
end
else ap_based_scheduling
alt not _is_ap_replenish_active
Scheduler->>Scheduler: _set_ap_replenish_active
end
alt total_ap <= meow_ap_preserve
Scheduler->>Scheduler: _clear_ap_replenish_active
Scheduler->>Scheduler: _handle_smart_scheduling_no_task
else total_ap > meow_ap_preserve
Scheduler->>Scheduler: _dispatch_coin_task
end
end
alt total_ap <= cl1_ap_preserve
Scheduler->>Scheduler: _delay_smart_scheduling_for_ap_limit
Scheduler-->>Config: task_delay
else total_ap > cl1_ap_preserve
Scheduler->>Scheduler: _run_scheduled_hazard1_leveling
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your Experience访问你的 dashboard 来:
Getting HelpOriginal review guide in EnglishReviewer's GuideIntroduce a configurable auto-search time limit and refine smart scheduling coin/AP replenishment logic, including coin-target-based scheduling mode, new thresholds, and improved exception propagation for stuck/overflow states. Sequence diagram for OS auto-search time limit and GameStuckError propagationsequenceDiagram
actor User
participant OpsiScheduler as MeowfficerFarming
participant OSMap
participant Timer
User->>OpsiScheduler: _meow_handle_stay_in_zone
OpsiScheduler->>OSMap: run_strategic_search
OSMap->>OSMap: run_auto_search
OSMap->>Timer: start
Note over OSMap,Timer: auto_search_time_limit_timer
loop auto search loop
OSMap->>OSMap: handle_os_auto_search_map_option
OSMap->>OSMap: handle_retirement
OSMap->>OSMap: combat_appear / handle_map_event
OSMap->>Timer: reset
OSMap->>Timer: reached
alt Timer reached
OSMap-->>OpsiScheduler: GameStuckError
else not reached
OSMap->>OSMap: continue loop
end
end
OpsiScheduler->>OpsiScheduler: run_strategic_search
OpsiScheduler-->>User: propagate GameStuckError
Sequence diagram for updated smart scheduling coin/AP replenishmentsequenceDiagram
participant Scheduler as OpsiMeowfficerFarming
participant Config
participant CoinTask
Scheduler->>Scheduler: run_smart_scheduling_once
Scheduler->>Scheduler: _get_smart_scheduling_operation_coins_preserve
Scheduler->>Scheduler: _get_effective_cl1_ap_preserve
Scheduler->>Scheduler: _get_coin_task_action_point_preserve
Scheduler->>Scheduler: _is_coin_target_scheduling_enabled
Scheduler->>Scheduler: _is_coin_replenish_active / _is_ap_replenish_active
alt coin_target_scheduling
Scheduler->>Scheduler: _get_coin_replenish_target
alt yellow_coins >= coin_target
Scheduler->>Scheduler: _clear_coin_replenish_target
Scheduler->>Scheduler: _run_scheduled_hazard1_leveling
else yellow_coins < coin_target
alt total_ap <= meow_ap_preserve
Scheduler->>Scheduler: _handle_smart_scheduling_no_task
Scheduler-->>Config: task_delay
else total_ap > meow_ap_preserve
Scheduler->>Scheduler: _dispatch_coin_task
Scheduler-->>CoinTask: proxy coin farming
end
end
else ap_based_scheduling
alt not _is_ap_replenish_active
Scheduler->>Scheduler: _set_ap_replenish_active
end
alt total_ap <= meow_ap_preserve
Scheduler->>Scheduler: _clear_ap_replenish_active
Scheduler->>Scheduler: _handle_smart_scheduling_no_task
else total_ap > meow_ap_preserve
Scheduler->>Scheduler: _dispatch_coin_task
end
end
alt total_ap <= cl1_ap_preserve
Scheduler->>Scheduler: _delay_smart_scheduling_for_ap_limit
Scheduler-->>Config: task_delay
else total_ap > cl1_ap_preserve
Scheduler->>Scheduler: _run_scheduled_hazard1_leveling
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - 我发现了 1 个问题
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="module/os/tasks/scheduling.py" line_range="816-825" />
<code_context>
+ )
+ return
+
+ if not coin_target_scheduling and (yellow_coins < cl1_preserve or ap_replenish_active):
+ if not ap_replenish_active:
+ self._set_ap_replenish_active()
</code_context>
<issue_to_address>
**issue (bug_risk):** 基于 AP 的黄币补充分支可能会继续向下执行,把仍然低于阈值的黄币当成“充足”。
在基于 AP 的补充路径(`not coin_target_scheduling`)中,当 `yellow_coins < cl1_preserve` 或 `ap_replenish_active` 为 True 时,我们会进入补充逻辑块,但如果 `total_ap > meow_ap_preserve`,我们不会在此处退出,执行会继续到:
```python
if total_ap <= cl1_ap_preserve:
self._delay_smart_scheduling_for_ap_limit(...)
logger.info(f'黄币充足 ({yellow_coins} >= {cl1_preserve}),执行侵蚀1练级')
self._run_scheduled_hazard1_leveling(...)
```
这样会在 `yellow_coins < cl1_preserve` 或 `ap_replenish_active` 已被设置的情况下,错误地把黄币视为“充足”,并继续执行侵蚀1练级。请在这里添加一个提前 `return`(类似黄币目标调度分支中的逻辑),或者通过其他方式确保在黄币低于 `cl1_preserve` 或补充处于激活状态时,永远不会进入“黄币充足”这条执行路径。
</issue_to_address>帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="module/os/tasks/scheduling.py" line_range="816-825" />
<code_context>
+ )
+ return
+
+ if not coin_target_scheduling and (yellow_coins < cl1_preserve or ap_replenish_active):
+ if not ap_replenish_active:
+ self._set_ap_replenish_active()
</code_context>
<issue_to_address>
**issue (bug_risk):** AP-based coin replenishment branch can fall through and treat coins as "充足" while still below threshold.
In the AP-based replenishment path (`not coin_target_scheduling`), when `yellow_coins < cl1_preserve` or `ap_replenish_active` is True, we enter the replenishment block, but if `total_ap > meow_ap_preserve` we don’t exit and execution continues to:
```python
if total_ap <= cl1_ap_preserve:
self._delay_smart_scheduling_for_ap_limit(...)
logger.info(f'黄币充足 ({yellow_coins} >= {cl1_preserve}),执行侵蚀1练级')
self._run_scheduled_hazard1_leveling(...)
```
This can incorrectly treat coins as “充足” and run 侵蚀1练级 while `yellow_coins < cl1_preserve` or `ap_replenish_active` is set. Please add an early `return` (like the coin-target branch) or otherwise ensure we never reach the “黄币充足” path when coins are below `cl1_preserve` or replenishment is active.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| if not coin_target_scheduling and (yellow_coins < cl1_preserve or ap_replenish_active): | ||
| if not ap_replenish_active: | ||
| self._set_ap_replenish_active() | ||
| logger.info( | ||
| f'【智能调度检查】体力调度补黄币中: 黄币={yellow_coins}, ' | ||
| f'黄币阈值={cl1_preserve}, 总行动力={total_ap}, 行动力阈值={meow_ap_preserve}' | ||
| ) | ||
| if total_ap <= meow_ap_preserve: | ||
| logger.info(f'行动力已达到体力调度阈值 ({total_ap} <= {meow_ap_preserve}),停止补黄币') | ||
| self._clear_ap_replenish_active() |
There was a problem hiding this comment.
issue (bug_risk): 基于 AP 的黄币补充分支可能会继续向下执行,把仍然低于阈值的黄币当成“充足”。
在基于 AP 的补充路径(not coin_target_scheduling)中,当 yellow_coins < cl1_preserve 或 ap_replenish_active 为 True 时,我们会进入补充逻辑块,但如果 total_ap > meow_ap_preserve,我们不会在此处退出,执行会继续到:
if total_ap <= cl1_ap_preserve:
self._delay_smart_scheduling_for_ap_limit(...)
logger.info(f'黄币充足 ({yellow_coins} >= {cl1_preserve}),执行侵蚀1练级')
self._run_scheduled_hazard1_leveling(...)这样会在 yellow_coins < cl1_preserve 或 ap_replenish_active 已被设置的情况下,错误地把黄币视为“充足”,并继续执行侵蚀1练级。请在这里添加一个提前 return(类似黄币目标调度分支中的逻辑),或者通过其他方式确保在黄币低于 cl1_preserve 或补充处于激活状态时,永远不会进入“黄币充足”这条执行路径。
Original comment in English
issue (bug_risk): AP-based coin replenishment branch can fall through and treat coins as "充足" while still below threshold.
In the AP-based replenishment path (not coin_target_scheduling), when yellow_coins < cl1_preserve or ap_replenish_active is True, we enter the replenishment block, but if total_ap > meow_ap_preserve we don’t exit and execution continues to:
if total_ap <= cl1_ap_preserve:
self._delay_smart_scheduling_for_ap_limit(...)
logger.info(f'黄币充足 ({yellow_coins} >= {cl1_preserve}),执行侵蚀1练级')
self._run_scheduled_hazard1_leveling(...)This can incorrectly treat coins as “充足” and run 侵蚀1练级 while yellow_coins < cl1_preserve or ap_replenish_active is set. Please add an early return (like the coin-target branch) or otherwise ensure we never reach the “黄币充足” path when coins are below cl1_preserve or replenishment is active.
There was a problem hiding this comment.
Code Review
This pull request introduces an auto-search time limit configuration to detect game freezes during auto-search, raising a GameStuckError when exceeded, and enhances the smart scheduling system with support for both coin-target and action-point-based scheduling. Key feedback includes resetting the auto-search stuck timer when not on the map to prevent false positives during combat or loading screens, adding a check in the action-point scheduling branch to verify if yellow coins are already replenished, and using a string literal for the Timer.start() return type annotation to ensure compatibility with older Python versions.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if auto_search_time_limit_timer.reached(): | ||
| raise GameStuckError('自律寻敌卡死') |
There was a problem hiding this comment.
auto_search_time_limit_timer 在 self.is_in_map() 为 False 时(例如在战斗中、加载界面或剧情对话中)不会被重置。如果单次战斗或加载时间超过了 AutoSearchTimeLimit(用户可以设置为 1 分钟),计时器就会超时并抛出误报的 GameStuckError。为了避免这种情况,建议在非地图界面时重置该计时器,使其仅在地图上卡死时生效。
| if auto_search_time_limit_timer.reached(): | |
| raise GameStuckError('自律寻敌卡死') | |
| if not self.is_in_map(): | |
| auto_search_time_limit_timer.reset() | |
| if auto_search_time_limit_timer.reached(): | |
| raise GameStuckError('自律寻敌卡死') |
| if not coin_target_scheduling and (yellow_coins < cl1_preserve or ap_replenish_active): | ||
| if not ap_replenish_active: | ||
| self._set_ap_replenish_active() | ||
| logger.info( | ||
| f'【智能调度检查】体力调度补黄币中: 黄币={yellow_coins}, ' | ||
| f'黄币阈值={cl1_preserve}, 总行动力={total_ap}, 行动力阈值={meow_ap_preserve}' | ||
| ) | ||
| if total_ap <= meow_ap_preserve: | ||
| logger.info(f'行动力已达到体力调度阈值 ({total_ap} <= {meow_ap_preserve}),停止补黄币') | ||
| self._clear_ap_replenish_active() | ||
| self._handle_smart_scheduling_no_task( | ||
| yellow_coins, | ||
| total_ap, |
There was a problem hiding this comment.
在非黄币目标调度(即体力调度 not coin_target_scheduling)的分支中,没有检查黄币是否已经补足(即 yellow_coins >= cl1_preserve)。
如果 ap_replenish_active 为 True,但此时黄币已经达到或超过了 cl1_preserve,代码仍会进入该分支:
- 如果
total_ap <= meow_ap_preserve,它会清除ap_replenish_active并调用_handle_smart_scheduling_no_task(这会延迟任务或执行短猫),而不会继续向下执行去运行OpsiHazard1Leveling(即使我们有足够的黄币和足够的体力!)。 - 如果
total_ap > meow_ap_preserve,它会调用_dispatch_coin_task继续去刷黄币,即使黄币已经足够了。
建议像 coin_target_scheduling 分支一样,在进入该分支时先检查 if yellow_coins >= cl1_preserve:。如果已补足,则清除 ap_replenish_active 并允许代码向下运行(不 return)。
if not coin_target_scheduling and (yellow_coins < cl1_preserve or ap_replenish_active):
if yellow_coins >= cl1_preserve:
logger.info(f'黄币已补足 ({yellow_coins} >= {cl1_preserve}),恢复侵蚀1练级')
self._clear_ap_replenish_active()
else:
if not ap_replenish_active:
self._set_ap_replenish_active()
logger.info(
f'【智能调度检查】体力调度补黄币中: 黄币={yellow_coins}, '
f'黄币阈值={cl1_preserve}, 总行动力={total_ap}, 行动力阈值={meow_ap_preserve}'
)
if total_ap <= meow_ap_preserve:
logger.info(f'行动力已达到体力调度阈值 ({total_ap} <= {meow_ap_preserve}),停止补黄币')
self._clear_ap_replenish_active()
self._handle_smart_scheduling_no_task(
yellow_coins,
total_ap,| return cls(limit, count=count) | ||
|
|
||
| def start(self): | ||
| def start(self) -> Timer: |
There was a problem hiding this comment.
Summary by Sourcery
为 OS 自动搜索引入可配置的时间限制与错误处理机制,并优化基于硬币与行动点补充的智能调度行为。
New Features:
Bug Fixes:
Enhancements:
GameStuckError及相关可恢复异常,以便上层调度器进行处理。timer.start()返回Timer实例,以便实现链式调用。Original summary in English
Summary by Sourcery
Introduce configurable time limit and error handling for OS auto-search, and refine smart scheduling behavior for coin and action point replenishment.
New Features:
Bug Fixes:
Enhancements: