Skip to content

fix(emulator): support MuMu Android 15 instance startup - #1792

Merged
runhey merged 1 commit into
runhey:devfrom
Wuuuuulin:codex/mumu-instance-start-20260908
Sep 8, 2026
Merged

runhey merged 1 commit into
runhey:devfrom
Wuuuuulin:codex/mumu-instance-start-20260908

Conversation

@Wuuuuulin

@Wuuuuulin Wuuuuulin commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

MuMu Android 15 instances cannot be launched automatically: their names do not match the 12.0-only ID parser, and the current MuMu manager uses control rather than the legacy launcher/API commands. OAS consequently opens the manager without starting the requested instance.

Recognize 15.0 instance names and use MuMuManager.exe control -v <id> --version 15 launch/shutdown for those instances. Wait for the shutdown command to finish before launching to avoid overlapping requests. Existing Android 12 and YXArkNights behavior is preserved.

Validation:

  • Offline regression: 9 parser cases (including index zero, global/local names, legacy names and malformed input).
  • Offline capture of the actual start/stop methods: 24 command cases across Android 12/15, global/local names and multiple indices; no emulator actions in these tests.
  • Both modified modules compile; git diff --check passes.

Live verification: MuMu Global 6.5.6.0 / Android 15 on Windows. Starting the existing OAS scheduler from a stopped instance completed emulator startup and established ADB connectivity. The scheduler was left running. Android 12 command compatibility was checked offline only. No account configuration, device logs or recordings are included.

Sourcery 摘要

为 MuMu Android 15 实例实现可靠的自动生命周期管理。

新功能:

  • 支持自动启动和关闭 MuMu Android 15 实例。

错误修复:

  • 修复 MuMu Android 15 实例的模拟器调度问题,使请求的实例能够正确启动并通过 ADB 连接。

增强功能:

  • 保留现有的 MuMu Android 12 和 YXArkNights 命令行为,同时防止 Android 15 的关闭和启动请求重叠。

测试:

  • 增加离线回归测试,覆盖 MuMu 实例名称解析以及特定平台的启动/停止命令生成。
Original summary in English

Summary by Sourcery

Enable reliable automatic lifecycle management for MuMu Android 15 instances.

New Features:

  • Support automatic startup and shutdown of MuMu Android 15 instances.

Bug Fixes:

  • Fix emulator scheduling for MuMu Android 15 instances so requested instances launch and connect through ADB correctly.

Enhancements:

  • Preserve existing MuMu Android 12 and YXArkNights command behavior while preventing overlapping Android 15 shutdown and launch requests.

Tests:

  • Add offline regression coverage for MuMu instance name parsing and platform-specific start/stop command generation.

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

您好——我发现了 1 个问题

AI 代理提示
请处理本次代码审查中的评论:

## 单独评论

### 评论 1
<location path="module/device/platform2/emulator_base.py" line_range="100-107" />
<code_context>
         Convert MuMu 12 instance name to instance id.
         Example names:
             MuMuPlayer-12.0-3
+            MuMuPlayerGlobal-15.0-1
             YXArkNights-12.0-1

         Returns:
             int: Instance ID, or None if this is not a MuMu 12 instance
         """
-        res = re.search(r'MuMuPlayer(?:Global)?-12.0-(\d+)', self.name)
+        res = re.search(r'MuMuPlayer(?:Global)?-(?:12|15)\.0-(\d+)', self.name)
</code_context>
<issue_to_address>
**小问题:** 文档字符串仍然描述 `MuMuPlayer12_id` 仅将 MuMu 12 名称转换为实例 ID,并且对于非 MuMu 12 实例返回 `None`,但当前实现现在也会为 MuMu Android 15 名称返回 ID。

**建议修复:** 更新文档字符串,以说明 MuMu 12 和 15 名称以及新的返回行为。

```suggestion
        Convert MuMu 12 or 15 instance name to instance id.
        Example names:
            MuMuPlayer-12.0-3
            MuMuPlayerGlobal-15.0-1
            YXArkNights-12.0-1

        Returns:
            int: Instance ID, or None if this is not a MuMu 12 or 15 instance
```
</issue_to_address>

Sourcery 评估

已批准。


Sourcery 对开源项目免费——如果您喜欢我们的审查,请考虑分享 ✨
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/device/platform2/emulator_base.py" line_range="100-107" />
<code_context>
         Convert MuMu 12 instance name to instance id.
         Example names:
             MuMuPlayer-12.0-3
+            MuMuPlayerGlobal-15.0-1
             YXArkNights-12.0-1

         Returns:
             int: Instance ID, or None if this is not a MuMu 12 instance
         """
-        res = re.search(r'MuMuPlayer(?:Global)?-12.0-(\d+)', self.name)
+        res = re.search(r'MuMuPlayer(?:Global)?-(?:12|15)\.0-(\d+)', self.name)
</code_context>
<issue_to_address>
**nitpick:** The docstring still describes `MuMuPlayer12_id` as converting only MuMu 12 names and returning `None` for non-MuMu-12 instances, but the implementation now returns an ID for MuMu Android 15 names.

**Suggested fix:** Update the docstring to describe MuMu 12 and 15 names and the new return behavior.

```suggestion
        Convert MuMu 12 or 15 instance name to instance id.
        Example names:
            MuMuPlayer-12.0-3
            MuMuPlayerGlobal-15.0-1
            YXArkNights-12.0-1

        Returns:
            int: Instance ID, or None if this is not a MuMu 12 or 15 instance
```
</issue_to_address>

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment on lines 100 to 107
Convert MuMu 12 instance name to instance id.
Example names:
MuMuPlayer-12.0-3
MuMuPlayerGlobal-15.0-1
YXArkNights-12.0-1

Returns:
int: Instance ID, or None if this is not a MuMu 12 instance

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

小问题: 文档字符串仍然描述 MuMuPlayer12_id 仅将 MuMu 12 名称转换为实例 ID,并且对于非 MuMu 12 实例返回 None,但当前实现现在也会为 MuMu Android 15 名称返回 ID。

建议修复: 更新文档字符串,以说明 MuMu 12 和 15 名称以及新的返回行为。

Suggested change
Convert MuMu 12 instance name to instance id.
Example names:
MuMuPlayer-12.0-3
MuMuPlayerGlobal-15.0-1
YXArkNights-12.0-1
Returns:
int: Instance ID, or None if this is not a MuMu 12 instance
Convert MuMu 12 or 15 instance name to instance id.
Example names:
MuMuPlayer-12.0-3
MuMuPlayerGlobal-15.0-1
YXArkNights-12.0-1
Returns:
int: Instance ID, or None if this is not a MuMu 12 or 15 instance
Original comment in English

nitpick: The docstring still describes MuMuPlayer12_id as converting only MuMu 12 names and returning None for non-MuMu-12 instances, but the implementation now returns an ID for MuMu Android 15 names.

Suggested fix: Update the docstring to describe MuMu 12 and 15 names and the new return behavior.

Suggested change
Convert MuMu 12 instance name to instance id.
Example names:
MuMuPlayer-12.0-3
MuMuPlayerGlobal-15.0-1
YXArkNights-12.0-1
Returns:
int: Instance ID, or None if this is not a MuMu 12 instance
Convert MuMu 12 or 15 instance name to instance id.
Example names:
MuMuPlayer-12.0-3
MuMuPlayerGlobal-15.0-1
YXArkNights-12.0-1
Returns:
int: Instance ID, or None if this is not a MuMu 12 or 15 instance

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Findings

  • C7 [风险]
    位置:module/device/platform2/platform_windows.py:_emulator_stop 的 MuMu Android 15 分支
    原因:停止命令直接调用 .wait(timeout=30);实例关闭超过 30 秒时会抛出超时异常,可能中断调度流程,且与原 Android 12 的异步停止行为不一致。
    修改:捕获并处理超时,记录告警后按既有生命周期继续,或改为轮询确认并设置明确的可恢复失败路径。

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

Generated by PR Review Checklist for #1792 · codex · gpt56 · 10.7 AIC · ⌖ 1.09 AIC · ⊞ 12.2K · ◷

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Change Summary

  • 将 MuMu 实例 ID 解析从仅支持 12.0 扩展为支持 MuMu/MuMuGlobal 的 12.0 与 15.0 名称。
  • Android 15 启动改用 MuMuManager.exe control -v <id> --version 15 launch。
  • Android 15 停止改用对应的 control ... shutdown,并同步等待子进程结束;12.0 与 YXArkNights 路径保持原命令。

Reconstructed Intent

点击此处展开 - 这次改动最可能是为了让调度器能够从已发现的 MuMu Android 15 实例名称中提取正确索引,并通过新版本管理器命令真正启动目标实例,而不是只打开管理器。 - 停止阶段等待命令完成,意图是避免同一实例的 shutdown 与下一次 launch 重叠。

Observed Constraints

点击此处展开 - 实例发现必须产出形如 `MuMuPlayer[-Global]-15.0-<数字>` 的名称,且索引必须与 MuMuManager 的 `-v` 参数一致。 - Android 15 必须使用 `MuMuManager.exe` 的 `control` 子命令并显式传入 `--version 15`;旧版本仍依赖原有 `-v`/`api` 命令。 - 启动流程本身会先 stop 再 start,因此 Android 15 的 stop 命令必须在可接受时间内返回;当前实现将等待上限固定为 30 秒。

Intent Alignment

  • 基本一致,但仍有关键边界未验证:解析、命令分流和等待机制与推断 intent 对齐;不过“命令返回”是否等价于“实例已完全关闭”以及 30 秒上限是否适用于所有 Android 15 实例,代码中没有更强保证。

Release Risk

  • 风险等级:中
  • Android 15 的 stop 超过 30 秒会抛出超时异常,外层直接判定本轮启动失败;这可能把慢启动/慢关机实例变成不可自动恢复的调度失败。
  • wait() 只确认管理器进程结束,不一定确认虚拟机状态已完成关闭;若 MuMuManager 命令是异步派发,仍可能发生 launch 与实际 shutdown 的竞态。
  • 15.0 分支依赖名称格式严格包含 MuMuPlayer/可选 Global、-15.0-;其他合法的 MuMu 15 实例命名变体会继续走旧命令。

Validation Gaps

点击此处展开 - PR 描述提到离线 parser/command 回归,但当前 diff 未包含测试文件或自动化测试;无法从变更本身确认这些用例已进入 CI。 - 需要至少覆盖:Global 与非 Global、索引 0、多实例索引、Malformed/未知版本名称,以及 stop 超时和非零退出场景。 - 需要在 MuMu Android 15 的冷启动、已运行实例、慢关机后重启场景确认 ADB 连接最终稳定;同时确认 Android 12 与 YXArkNights 的原命令行为未回归。

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • ab.chatgpt.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "ab.chatgpt.com"

See Network Configuration for more information.

Generated by PR Review Intent for #1792 · codex · gpt56 · 11.1 AIC · ⌖ 2.42 AIC · ⊞ 12.4K · ◷

@runhey
runhey merged commit a0d7904 into runhey:dev Sep 8, 2026
11 checks passed
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