Skip to content

fix: 应用退出时未正确停止自动战斗算子 - #2459

Merged
DoctorReid merged 1 commit into
OneDragon-Anything:mainfrom
kawayiYokami:fix/stop-auto-battle-on-exit
Jul 18, 2026
Merged

fix: 应用退出时未正确停止自动战斗算子#2459
DoctorReid merged 1 commit into
OneDragon-Anything:mainfrom
kawayiYokami:fix/stop-auto-battle-on-exit

Conversation

@kawayiYokami

@kawayiYokami kawayiYokami commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

修复了应用退出时,自动战斗算子没有正确停止的问题,避免资源泄漏。

Summary by CodeRabbit

  • Bug Fixes
    • 自动战斗在操作完成后会自动停止,避免后续流程继续执行。

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

AutoBattleApp 新增对 OperationResult 的导入,并新增 after_operation_done 方法覆盖实现:操作完成时先调用 stop_auto_battle 停止自动战斗,再调用基类 ZApplication.after_operation_done 继续处理。

Changes

自动战斗应用生命周期调整

Layer / File(s) Summary
操作完成后停止战斗
src/zzz_od/application/battle_assistant/auto_battle/auto_battle_app.py
新增 OperationResult 导入并实现 after_operation_done,操作结束时先停止自动战斗再委托基类处理。

Estimated code review effort: 1 (Trivial) | ~3 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了在应用退出时停止自动战斗算子的修复。
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kawayiYokami
kawayiYokami force-pushed the fix/stop-auto-battle-on-exit branch from 718c967 to f4ea44c Compare July 7, 2026 09:48
@kawayiYokami kawayiYokami changed the title 修复:应用退出时未正确停止自动战斗算子 fix: 应用退出时未正确停止自动战斗算子 Jul 7, 2026

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/zzz_od/application/battle_assistant/auto_battle/auto_battle_app.py`:
- Around line 107-109: `after_operation_done()` needs a `try/finally` so the
base cleanup in `ZApplication.after_operation_done(self, result)` always runs
even if `self.ctx.auto_battle_context.stop_auto_battle()` fails. Update
`after_operation_done()` to keep the auto-battle stop call in the `try` block
and move the `ZApplication.after_operation_done(self, result)` invocation into
`finally`, preserving the existing cleanup flow and ensuring the
`APPLICATION_STOP` handling is not skipped.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 27dafc51-7783-41dc-83aa-356c6decfada

📥 Commits

Reviewing files that changed from the base of the PR and between 8d018cf and f4ea44c.

📒 Files selected for processing (1)
  • src/zzz_od/application/battle_assistant/auto_battle/auto_battle_app.py

@DoctorReid
DoctorReid merged commit 620af51 into OneDragon-Anything:main Jul 18, 2026
8 checks passed
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants