Skip to content

fix(BetterGI): 修复未选择首领时自动首领讨伐被静默跳过、整轮仍显示完成 - #766

Closed
TCddddd wants to merge 1 commit into
AUTO-MAS-Project:devfrom
TCddddd:fix/bettergi-autoboss-missing-name-v2
Closed

TCddddd wants to merge 1 commit into
AUTO-MAS-Project:devfrom
TCddddd:fix/bettergi-autoboss-missing-name-v2

Conversation

@TCddddd

@TCddddd TCddddd commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

摘要

  • 修复右栏未选择首领时,自动首领讨伐会带着 BGI 全局旧配置里的首领静默执行、而整轮仍显示「完成」的问题:缺少必填项的战斗步骤现在会被前置拦截并跳过,不再进 BGI。
  • 缺少必填项时明确判负,并把「自动首领讨伐:未选择首领」推到调度台与日志,用户能直接看到是哪一项缺什么。
  • 属用户可见变更,已按 changelog.d/ 规范登记碎片。

验证:py_compile 通过;python scripts/changelog.py check 通过。未运行自动化测试(本模块无对应单测)。

Sourcery 总结

确保在执行 BetterGI 之前跳过缺少必需设置的战斗步骤,并将其明确报告为失败。

Bug 修复:

  • 防止在未选择 Boss 时,自动挑战 Boss 静默使用过期的全局 Boss 设置。
  • 将缺少必需战斗配置视为执行失败,并在调度日志和警告中显示具体缺失的设置。

增强功能:

  • 在执行层报告因缺少必需配置而跳过的战斗步骤。

杂项:

  • 在变更日志中记录用户可见的修复。
Original summary in English

Summary by Sourcery

Ensure combat steps with missing required settings are skipped before BetterGI execution and clearly reported as failures.

Bug Fixes:

  • Prevent automatic boss challenges from silently using stale global boss settings when no boss is selected.
  • Treat missing required combat configuration as a failed execution and surface the specific missing setting in dispatch logs and warnings.

Enhancements:

  • Add execution-layer reporting for skipped combat steps caused by missing required configuration.

Chores:

  • Record the user-visible fix in the changelog.

- main.js 新增战斗步骤必填项前置校验:缺 bossName 时不进 BGI,改打
  MAS_STEP_MISSING_CONFIG 标记并跳过该步,避免落回 AutoBossParam 无参构造
  读取 BGI 全局 autoBossConfig 的旧首领
- AutoProxy 识别该标记判负,并把「自动首领讨伐:未选择首领」推到调度台与日志

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @TCddddd, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 18 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Sep 14, 2026

Copy link
Copy Markdown

审查者指南

本 PR 在 MAS 调度层前置拦截未填写的战斗必填项,防止自动首领讨伐回退到 BetterGI 全局旧配置;同时通过专用日志标记让执行层判负并展示具体缺失原因,避免整轮被错误显示为完成。

缺失首领配置处理时序图

sequenceDiagram
    participant Scheduler as MASOneDragon
    participant BGI as BetterGI
    participant Monitor as AutoProxy
    participant Dispatch as DispatchLog

    Scheduler->>Scheduler: missingRequiredFields(step)
    alt bossName is missing
        Scheduler->>Scheduler: masLog(MAS_STEP_MISSING_CONFIG)
        Scheduler-->>Monitor: MAS_STEP_MISSING_CONFIG
        Monitor->>Monitor: _missing_config_reasons(log)
        Monitor->>Monitor: result.success = false
        Monitor->>Dispatch: _push_dispatch_log(执行层(战斗4项)有任务未执行)
        Note over Scheduler,BGI: dispatchCombat is skipped - BetterGI is not started
    else required fields are present
        Scheduler->>BGI: dispatchCombat(step)
        BGI-->>Monitor: completion or failure logs
        Monitor->>Monitor: result.success = true/false
    end
Loading

文件级变更

变更 详情 文件
在战斗步骤进入 BetterGI 前校验必填配置,避免使用 BGI 全局旧配置静默执行未配置的首领讨伐。
  • 为自动首领讨伐增加 bossName 必填校验,并在缺失时跳过 BGI 调用。
  • 输出包含步骤 UID、名称和缺失原因的 MAS_STEP_MISSING_CONFIG 标记。
  • 保持仅对当天应执行的步骤进行配置校验。
res/templates/BetterGI/MASOneDragon/main.js
将必填配置缺失纳入执行结果判定,并向用户暴露具体未执行原因。
  • 解析并去重 MAS_STEP_MISSING_CONFIG 日志。
  • 配置缺失时即使收到完成标记也判定本轮失败。
  • 将“自动首领讨伐:未选择首领”等原因推送到调度日志并记录 warning。
  • 区分配置前置错误与运行期 MAS_STEP_FAIL,后者仍沿用原有不判负策略。
app/task/BetterGI/AutoProxy.py
登记该用户可见缺陷修复。
  • 新增 BetterGI 自动首领讨伐缺少首领配置时的变更日志条目。
changelog.d/fix-bettergi-autoboss-missing-name.fix.md

提示与命令

与 Sourcery 交互

  • 触发新的审查: 在 pull request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 根据审查评论生成 GitHub issue: 回复审查评论,请 Sourcery 根据该评论创建 issue。你也可以回复审查评论并使用 @sourcery-ai issue,根据该评论创建 issue。
  • 生成 pull request 标题: 在 pull request 标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在 pull request 中评论 @sourcery-ai title,随时重新生成标题。
  • 生成 pull request 摘要: 在 pull request 正文的任意位置写入 @sourcery-ai summary,即可在指定位置随时生成 PR 摘要。你也可以在 pull request 中评论 @sourcery-ai summary,随时重新生成摘要。
  • 生成审查者指南: 在 pull request 中评论 @sourcery-ai guide,即可随时重新生成审查者指南。
  • 解决所有 Sourcery 评论: 在 pull request 中评论 @sourcery-ai resolve,即可解决所有 Sourcery 评论。如果你已经处理完所有评论且不想再看到它们,此功能会很有用。
  • 驳回所有 Sourcery 审查: 在 pull request 中评论 @sourcery-ai dismiss,即可驳回所有现有的 Sourcery 审查。如果你想从新的审查开始,这项功能尤其有用——别忘了评论 @sourcery-ai review 以触发新的审查!

自定义使用体验

访问你的控制面板以:

  • 启用或禁用审查功能,例如 Sourcery 生成的 pull request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English

Reviewer's Guide

本 PR 在 MAS 调度层前置拦截未填写的战斗必填项,防止自动首领讨伐回退到 BetterGI 全局旧配置;同时通过专用日志标记让执行层判负并展示具体缺失原因,避免整轮被错误显示为完成。

Sequence diagram for missing boss configuration handling

sequenceDiagram
    participant Scheduler as MASOneDragon
    participant BGI as BetterGI
    participant Monitor as AutoProxy
    participant Dispatch as DispatchLog

    Scheduler->>Scheduler: missingRequiredFields(step)
    alt bossName is missing
        Scheduler->>Scheduler: masLog(MAS_STEP_MISSING_CONFIG)
        Scheduler-->>Monitor: MAS_STEP_MISSING_CONFIG
        Monitor->>Monitor: _missing_config_reasons(log)
        Monitor->>Monitor: result.success = false
        Monitor->>Dispatch: _push_dispatch_log(执行层(战斗4项)有任务未执行)
        Note over Scheduler,BGI: dispatchCombat is skipped - BetterGI is not started
    else required fields are present
        Scheduler->>BGI: dispatchCombat(step)
        BGI-->>Monitor: completion or failure logs
        Monitor->>Monitor: result.success = true/false
    end
Loading

File-Level Changes

Change Details Files
在战斗步骤进入 BetterGI 前校验必填配置,避免使用 BGI 全局旧配置静默执行未配置的首领讨伐。
  • 为自动首领讨伐增加 bossName 必填校验,并在缺失时跳过 BGI 调用。
  • 输出包含步骤 UID、名称和缺失原因的 MAS_STEP_MISSING_CONFIG 标记。
  • 保持仅对当天应执行的步骤进行配置校验。
res/templates/BetterGI/MASOneDragon/main.js
将必填配置缺失纳入执行结果判定,并向用户暴露具体未执行原因。
  • 解析并去重 MAS_STEP_MISSING_CONFIG 日志。
  • 配置缺失时即使收到完成标记也判定本轮失败。
  • 将“自动首领讨伐:未选择首领”等原因推送到调度日志并记录 warning。
  • 区分配置前置错误与运行期 MAS_STEP_FAIL,后者仍沿用原有不判负策略。
app/task/BetterGI/AutoProxy.py
登记该用户可见缺陷修复。
  • 新增 BetterGI 自动首领讨伐缺少首领配置时的变更日志条目。
changelog.d/fix-bettergi-autoboss-missing-name.fix.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

TCddddd added a commit to TCddddd/AUTO-MAS that referenced this pull request Sep 14, 2026
本分支为自洽而包含了 AUTO-MAS-Project#766 的提交(执行层判负逻辑依赖它引入的 _missing_config_reasons),
但「一条 PR 恰好一个碎片」,重复登记会被 CI 判失败。故此处移除该碎片:它在 AUTO-MAS-Project#766 里保留。
待 AUTO-MAS-Project#766 合入后,本分支 rebase 到新的 dev 即可让这段重复代码一并消失。
qiyinxi added a commit that referenced this pull request Sep 15, 2026
#779/#780) (#787)

## 概述
将以下 9 个 BetterGI 相关 PR 合并为一个分支统一提交:
#756 #759 #765 #766 #767 #768 #771 #779 #780

注:#768 的提交历史已内含 #765#766,故以 #768 一次性带入三者,避免重复应用。

## 主要改动(用户可见)
- 通知统一走 AUTO-MAS 通知编排
- 掉落统计开启时强制打开首领讨伐奖励识别
- 执行层运行也留下运行记录;一条龙执行层改为单次启动,按左栏队列顺序执行
- 修复未选择首领时自动首领讨伐被静默跳过、整轮仍显示完成
- 地脉花策略设置现在生效
- 首领改为必填校验;直控配置来源与原生配置写入分离
- Plan 到原生键反向映射补充单测
- 修复一条龙战斗组开关关闭后仍运行
- 修复自定义分组脚本配置下拉框无法展开选项

## Sourcery 摘要

统一 BetterGI 的执行、配置、通知和报告行为,同时修复任务启用和验证相关问题。

新功能:
- 添加 BetterGI 掉落统计配置,并在通知和 HTML 报告中包含聚合后的奖励识别结果。
- 在单次有序启动中运行 BetterGI 执行层任务,同时记录执行层结果并支持自定义任务分段。

错误修复:
- 防止已禁用的 BetterGI 战斗组回退到原生一条龙执行。
- 将缺少必需 Boss 配置的情况报告为失败且可见的执行,而不是静默跳过。
- 使地脉花战斗策略和已清空队伍设置生效。
- 将直接控制配置的所有权与临时原生配置写入分离,并安全恢复被修改的配置。
- 修复自定义分组设置下拉框,使其选项能够正常展开。

改进:
- 通过共享的 AUTO-MAS 通知编排机制发送 BetterGI 通知。
- 添加从计划战斗设置到 BetterGI 原生配置键的反向映射,并集中处理自定义分组解析。

测试:
- 添加针对战斗组所有权、掉落统计解析、原生计划设置映射以及基于队列的分组启用功能的回归测试。

杂项:
- 将 BetterGI 相关更改整合到单个发布条目中。

<details>
<summary>Original summary in English</summary>

## Sourcery 摘要

统一 BetterGI 的执行、配置、通知和报告行为,同时修复任务启用、验证、进程处理和自定义组配置相关的问题。

新功能:
- 增加可配置的 BetterGI 掉落统计聚合功能,并将其用于通知和 HTML 报告。
- 将 BetterGI 执行层任务按队列顺序统一启动,并记录执行结果及步骤级报告。

错误修复:
- 防止已禁用或配置不完整的 BetterGI 任务意外运行或被静默跳过。
- 修复 BetterGI 进程生命周期处理问题,包括残留进程、权限相关的终止失败、自提权后的 PID 变化以及过早退出检测。
- 修复战斗策略、队伍清空、奖励识别、原生配置同步、自定义组选择、路径引用和自定义脚本下拉列表的行为。

改进:
- 通过共享的 AUTO-MAS 通知编排机制发送 BetterGI 通知。
- 将直接控制配置的所有权与临时原生配置覆盖分离,并在执行后恢复受保护的设置。
- 增加从计划战斗设置到 BetterGI 原生配置键的反向映射,并集中处理自定义组解析。

测试:
- 增加针对战斗组所有权、掉落统计解析、执行层报告、原生计划设置映射、组启用状态以及类似路径的脚本组名称的回归测试覆盖。

杂项:
- 将 BetterGI 相关更改合并为单个变更日志条目。

<details>
<summary>Original summary in English</summary>

## Sourcery 摘要

统一 BetterGI 的执行、配置、通知和报告行为,同时让任务启用状态及验证失败变得可见且可靠。

新功能:
- 支持配置 BetterGI 掉落统计聚合,并将其添加到通知和 HTML 报告中。
- 在单个按队列顺序启动的队列中运行 BetterGI 执行层任务,同时记录执行层结果和步骤报告。

错误修复:
- 防止已禁用或配置不完整的 BetterGI 任务意外运行或被静默跳过。
- 修复 BetterGI 进程生命周期处理问题,包括残留进程、权限相关的终止失败、提权后的 PID 变化以及过早退出检测。
- 修复战斗策略、已清除的队伍设置、奖励识别、原生配置同步、自定义组选择、路径引用以及自定义脚本下拉菜单行为。

改进:
- 通过共享的 AUTO-MAS 通知编排机制发送 BetterGI 通知。
- 将直接控制配置的所有权与临时原生配置覆盖分离,并在执行后恢复受保护的设置。
- 添加从计划中的战斗设置到 BetterGI 原生配置键的反向映射,并集中处理自定义组解析。

测试:
- 增加针对战斗组所有权、掉落统计解析、执行层报告、原生计划设置映射、组启用状态以及类似路径的脚本组名称的回归测试覆盖。

杂项:
- 将 BetterGI 的更改合并为单条变更日志记录。

<details>
<summary>Original summary in English</summary>

## Sourcery 摘要

统一 BetterGI 的执行、配置、通知和报告行为,同时修复任务启用、验证、进程处理和自定义组配置问题。

新功能:
- 支持配置 BetterGI 掉落物汇总方式,并应用于通知和 HTML 报告。
- 按队列顺序执行执行层任务,通过单次 BetterGI 启动完成执行,同时记录执行层结果和步骤报告。

错误修复:
- 使缺少必需设置、已禁用的战斗组、过时的进程状态、未生效的战斗设置,以及类似路径的名称或自定义组配置错误能够被明确发现并可靠处理。

增强功能:
- 将 BetterGI 通知与共享的 AUTO-MAS 通知编排统一,并将直接控制配置的所有权与临时原生配置覆盖分离,同时安全地恢复原始配置。

测试:
- 增加针对战斗组所有权、掉落物解析、执行层报告、原生 Plan 设置映射、组启用状态以及类似路径的脚本组名称的回归测试覆盖。

日常维护:
- 将 BetterGI 相关更改合并为单条变更日志条目。

<details>
<summary>Original summary in English</summary>

## Sourcery 总结

统一 BetterGI 的执行、配置、通知和报告流程,同时确保任务启用、验证和进程处理更加可靠。

新功能:
- 添加可配置的 BetterGI 掉落汇总功能,使用奖励识别日志,并将结果包含在通知和 HTML 报告中。
- 将 BetterGI 执行层任务按照队列顺序统一启动,并提供执行记录和步骤级报告。

Bug 修复:
- 使缺少必需的 Boss
设置、已禁用的战斗组、无效的战斗设置、过时的原生配置值、进程失败,以及类似路径或自定义脚本组的配置错误能够被清晰地发现并可靠处理。

增强功能:
- 通过共享的 AUTO-MAS 通知编排机制发送 BetterGI 通知,并将直接控制权与临时原生配置覆盖分离,同时安全地恢复原有配置。
- 添加从计划战斗设置到 BetterGI 原生配置的反向映射,并集中处理自定义组解析。

测试:
- 增加针对战斗组所有权、掉落解析、执行层报告、原生计划设置映射、组启用状态,以及类似路径的脚本组名称的回归测试覆盖。

日常维护:
- 将 BetterGI 相关更改合并为单条变更日志记录。

<details>
<summary>Original summary in English</summary>

## Summary by Sourcery

Unify BetterGI execution, configuration, notification, and reporting
while making task enablement, validation, and process handling reliable.

New Features:
- Add configurable BetterGI drop aggregation using reward-recognition
logs and include the results in notifications and HTML reports.
- Run BetterGI execution-layer tasks in a single queue-ordered launch
with execution records and step-level reports.

Bug Fixes:
- Make missing required Boss settings, disabled combat groups,
ineffective combat settings, stale native configuration values, process
failures, and path-like or custom script group configuration errors
visible and reliable.

Enhancements:
- Route BetterGI notifications through the shared AUTO-MAS notification
orchestration and separate direct-control ownership from temporary
native configuration overrides with safe restoration.
- Add reverse mapping from Plan combat settings to BetterGI native
configuration and centralize custom group resolution.

Tests:
- Add regression coverage for combat-group ownership, drop parsing,
execution-layer reports, native Plan-setting mappings, group enablement,
and path-like script group names.

Chores:
- Combine the BetterGI-related changes into a single changelog entry.

</details>

</details>

</details>

</details>

</details>

## 评审须知:与已合入 dev 的 #781「快速配置」语义的关系

本分支已合并最新 `dev`(含 #781 全专项「快速配置开关」)。合并后经确认,本 PR 的既定决策是
**「配置来源(`Info.Mode`)决定一切,快速配置不作为配置来源开关」**,因此有 4 处与 #781 语义分叉,
评审时请一并确认是否接受:

| # | 位置 | 本 PR 的行为 | #781 的行为 |
|---|---|---|---|
| 1 | `app/task/BetterGI/AutoProxy.py` | `use_mas_config = (config_mode
!= CONFIG_SOURCE_DIRECT)`:直控 = 用 BGI 所选原生配置,MAS 不接管 | `use_mas_config =
IfQuickConfig`:关掉快速配置即用原生配置 |
| 2 | `app/task/BetterGI/ScriptConfig.py` | 同上,并补回 `proxy_helpers` 的导入 |
同上 |
| 3 | `frontend/.../BetterGIUserEdit.vue` |
任务配置卡片常显;面板形态由配置来源决定;快速配置开关位于配置来源区内 | 卡片由 `Info.IfQuickConfig`
门控,开关置于页面顶部 |
| 4 | `frontend/.../quickConfigPanels.test.ts` | 将 `BetterGI`
移出「面板必须受开关门控」的断言列表;选择器断言改为校验「按需渲染」 | 断言包含 `BetterGI`,且禁止选择器出现快速配置字样 |

快速配置本身**没有删除**:`Info.IfQuickConfig` 仍保留,在直控下表示「是否把面板值写入 BGI 原生配置」
(`writes_native_config`)。若维护者最终倾向 #781 的语义,改动范围就是上表这 4 处,可整块翻回。

其它专项与对外契约未受影响:`GeneralConfigModeSelector` 的快速配置项仍是「调用方声明了 `quickConfig`
才渲染」,
未接入的专项不会出现死开关;其余 6 个专项页面与 MaaFW 的单测断言一字未改。

合并带来的非语义收益予以保留(均已逐条确认优于原实现):`useSaveQueue` 取代手写保存链(原实现会丢弃紧随其后的保存)、
`masConfigEnabled.value` 修正(原写法漏 `.value`,配置名会恒为 MAS 槽位)、一条龙设置写回前的快照比对、
关闭快速配置前先 flush 未保存设置。

**验证**:后端 `tests/task + tests/api` 659 passed(本地另有 5 项环境性失败:缺
`pytest-asyncio`、GBK 默认编码,CI 的 Linux/UTF-8 不受影响);
前端 `vitest` 63 files / 577 tests passed;`vue-tsc`、`scripts/changelog.py
check`、`py_compile` 均通过。

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: qiyinxi <qiyinxi@foxmail.com>
@ClozyA ClozyA closed this Sep 16, 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.

2 participants