Skip to content

feat: allow disabling API hot updates - #561

Draft
Verelse wants to merge 1 commit into
MaaAssistantArknights:mainfrom
Verelse:codex/config-disable-api-hot-update
Draft

feat: allow disabling API hot updates#561
Verelse wants to merge 1 commit into
MaaAssistantArknights:mainfrom
Verelse:codex/config-disable-api-hot-update

Conversation

@Verelse

@Verelse Verelse commented Jul 19, 2026

Copy link
Copy Markdown

Summary

  • add hot_update.auto_update, defaulting to true for backward compatibility
  • skip the automatic API hot update before task execution when the option is disabled
  • keep the explicit maa hot-update command unchanged
  • document the setting in the example config, JSON Schema, Simplified Chinese docs, and English docs

Motivation

run_core currently calls the activity/API resource hot updater before every task, including --dry-run. If api.maa.plus is unreachable or a connection is reset, task parsing and device automation abort before MaaCore can run. The existing resource.auto_update option only controls the Git-backed MaaResource updater, so it cannot disable these API requests.

This was reproduced on Windows with maa-cli 0.7.5: both dry-run and a StartUp-only task failed during the API hot update. With this patch and hot_update.auto_update = false, dry-run completes without an update request.

Impact

Existing users keep the current behavior because the new setting defaults to true. Users on offline or restricted networks can disable automatic API updates and run maa hot-update explicitly when connectivity is available.

Checks

  • cargo +nightly fmt
  • cargo clippy -p maa-cli --all-targets --offline
  • cargo x test --no-core-tests --no-ignored-tests --package maa-cli (306 passed, 26 ignored)
  • parsed the updated example TOML and JSON Schema locally

Summary by Sourcery

引入一个可配置的开关,用于控制自动活动/API 热更新,并将其接入任务执行流程,默认行为保持现有逻辑不变。

New Features:

  • 新增 hot_update.auto_update CLI 配置项,用于在运行任务前启用或禁用活动和 API 资源的自动热更新。

Enhancements:

  • 在任务执行中,将自动 API 热更新受新的配置开关控制,从而可以关闭自动更新,同时保持手动热更新命令的行为不变。

Documentation:

  • 在示例 CLI 配置、JSON Schema,以及英文和简体中文的配置指南中记录 hot_update.auto_update 设置。

Tests:

  • 扩展配置相关测试,覆盖新的 hot_update.auto_update 字段及其默认值和显式配置值。
Original summary in English

Summary by Sourcery

Introduce a configurable switch to control automatic activity/API hot updates and wire it into task execution, with defaults preserving existing behavior.

New Features:

  • Add a hot_update.auto_update CLI configuration option to enable or disable automatic activity and API resource hot updates before running tasks.

Enhancements:

  • Gate the automatic API hot update in task execution on the new configuration flag so it can be disabled while keeping manual hot-update commands unchanged.

Documentation:

  • Document the hot_update.auto_update setting in the example CLI config, JSON Schema, and both English and Simplified Chinese configuration guides.

Tests:

  • Extend configuration tests to cover the new hot_update.auto_update field and its default/explicit values.

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 14.51%. Comparing base (503d6ce) to head (7db4df5).

❗ There is a different number of reports uploaded between BASE (503d6ce) and HEAD (7db4df5). Click for more details.

HEAD has 3 uploads less than BASE
Flag BASE (503d6ce) HEAD (7db4df5)
4 1
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #561       +/-   ##
===========================================
- Coverage   72.05%   14.51%   -57.54%     
===========================================
  Files          72       11       -61     
  Lines        6674      434     -6240     
  Branches     6674      434     -6240     
===========================================
- Hits         4809       63     -4746     
+ Misses       1523      370     -1153     
+ Partials      342        1      -341     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wangl-cc

Copy link
Copy Markdown
Member

Thanks, the motivation is valid, and I think hot_update.auto_update is useful for users who want to completely disable background API requests.

However, disabling the updater and handling automatic update failures are two separate concerns. Requiring users to disable the updater in advance only provides an opt-out; with the default configuration, a temporary API failure still prevents both normal runs and dry runs.

I think the desired behavior should be:

  • hot_update.auto_update = false: do not make API requests.
  • Automatic update during run/dry-run: attempt the update, but warn and continue with available local resources if it fails.
  • Explicit maa hot-update: remain strict and return the error.

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