Skip to content

fix: 启动游戏时读取 windows.launch_arguments - #52

Merged
AliceJump merged 3 commits into
mainfrom
fix/windows-launch-arguments
Dec 1, 2026
Merged

AliceJump merged 3 commits into
mainfrom
fix/windows-launch-arguments

Conversation

@AliceJump

@AliceJump AliceJump commented Dec 1, 2026 •

Copy link
Copy Markdown
Owner

问题

ok-script 使用 windows.launch_arguments 声明游戏启动参数,工具的连接入口却只读取 windows.args。从工具拉起游戏时,正式配置中的参数因此丢失。

修改

  • 优先读取 launch_arguments;只有该键缺省时才兼容旧 args 字符串/列表,显式 None 或空串不回退。
  • 原样传递参数字符串,保留引号和内部空格;配置声明后追加、更新或重新赋值的参数也从最终配置读取。
  • 仅在实际启动前求值动态配置和无参回调,按真实模块名保留相对导入,并用项目入口定位资源;已有窗口和断开连接不会触发导入或回调。
  • 导入、回调或原生参数类型错误时停止启动,不静默丢弃参数。
  • 更新 AST 探针白名单、过期启动说明和中英文配置文档;执行器继续沿用框架启动链。

回调支持保留连接辅助脚本的现有运行环境,不额外初始化完整框架服务;依赖完整应用服务的回调仍由任务执行器启动。

验证

  • 最终源码完整 npm test 通过。
  • 15 项连接 CLI 测试通过,断言实际传给 execute(arguments=...) 的内容;原始主线能复现正式字符串和回调被丢弃。
  • 窗口探针测试通过;npm run package 通过。
  • 检查 VSIX 内运行脚本与当前源码一致,未打包 Agent 指令或测试文件。

跨仓依赖

JetBrains 共享源码引用同步已通过 AliceJump/ok-script-toolkit-jetbrains#44 合并;本 PR 的 gitlink 已更新为子仓 main 上的 c26657b4e41b650fdea07b6fd07833464ff00c0c。该指针同时包含子仓 main 已有的 #42 缓存预览任务类型修复,未重新修改其实现。

共享运行代码 f7798cf68b495f94138459ec52a930f47c9557f5 与子仓 PR 均已获得覆盖对应 HEAD 的无 finding 审阅。最终 ee4293f125eb325ee021466ff99726f5662b374f 仅追加 gitlink,四项 CI 全部通过;其 CodeRabbit 增量审阅仍受额度限制时,PR 于 2026-12-01 11:22:04 UTC 合并为 b433144657e816d41e72c5d1ff5a3b4a71a48fef。最终指针提交未获得新一轮 CodeRabbit coverage,不将此前审阅误记为覆盖该提交。

已核对 squash 后的主线 tree 与最终 PR HEAD 完全一致;合并后 CI 46635746424 的 VS Code、JetBrains 和两套 PowerShell 审阅脚本检查全部通过。此次修复单独从 main 提交,与 #48 的整体审查分开。

Summary by CodeRabbit

  • 功能改进

    • 新增 windows.launch_arguments 启动参数配置,支持字符串和回调;仅在该配置未声明时才使用旧版 windows.args。
    • 参数仅在实际启动游戏时读取,已连接或断开连接时不会调用回调;配置导入或回调出错时将中止启动。
    • 窗口配置探针现在可识别新旧启动参数字段,且不会执行配置回调。
  • 测试

    • 新增启动参数相关测试,覆盖配置优先级、回调、旧版参数兼容及启动失败场景。

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 07807d98-5f44-42a3-b783-701556cb82c4
Commits

Reviewing files that changed from the base of the PR and between f7798cf and ee4293f.

Files selected for processing: 1

  • jetbrains

No actionable comments were generated in the recent review.

Walkthrough

本次更新新增 windows.launch_arguments 配置项,并调整连接脚本的参数读取时机和旧字段回退规则。窗口探针保留静态提取方式。新增端到端测试,覆盖参数解析、执行及失败路径。

Changes: 游戏启动参数

Layer / File(s) Summary
配置字段与探针提取
docs/config-reads.md, docs/config-reads.en.md, python/probe_window_config.py, python/tests/test_probe_window_config.py
配置文档新增 windows.launch_arguments,并说明 windows.args 仅在新字段缺省时作为旧版回退。窗口探针新增字段识别,并保留旧字段;测试验证探针不执行动态回调。
启动参数解析
python/connect_game.py, docs/config-reads.md, docs/config-reads.en.md
连接脚本静态读取字面值;需要动态解析时导入所选配置模块,并在实际启动前求值回调。文档说明求值时机、参数格式和错误处理。
启动调用与端到端验证
python/connect_game.py, python/run_executor.py, python/tests/test_connect_game_launch_arguments.py, package.json
连接脚本在调用 execute 前读取参数,并在读取后恢复 sys.argv。新增测试覆盖字段优先级、回调、导入、错误和连接状态;测试命令加入该测试。执行器说明更新为沿用框架对 launch_arguments 的处理。

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant ConnectGame as connect_game.py
  participant ConfigModule as 配置模块
  participant Execute as execute()
  ConnectGame->>ConfigModule: 导入配置并读取启动参数
  ConfigModule-->>ConnectGame: 返回 launch_arguments 或旧 args
  ConnectGame->>Execute: 传入程序路径和启动参数
Loading
Merge Risk: Minimal · previous review f7798

The change makes game launches read windows.launch_arguments, falling back to windows.args only when the new field is absent. No unresolved merge-blocking issue was found. Update the sub-repository gitlink and recheck the latest HEAD before merging, as the author noted.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix: 启动游戏时读取 windows.launch_arguments”与变更集的主要内容一致。变更将 connect_game.py 的启动参数来源从 windows.args 改为优先读取 windows.launch_arguments,并补充了求值规则、回退逻辑、文档与端到端测试。标题简短,指出了主要修复点。
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.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 601ef214-c6ab-4726-9a34-63e9c131de89
Commits

Reviewing files that changed from the base of the PR and between 92e4493 and f7798cf.

Files selected for processing: 8

  • docs/config-reads.en.md
  • docs/config-reads.md
  • package.json
  • python/connect_game.py
  • python/probe_window_config.py
  • python/run_executor.py
  • python/tests/test_connect_game_launch_arguments.py
  • python/tests/test_probe_window_config.py
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@AliceJump

Copy link
Copy Markdown
Owner Author

@coderabbitai rate limit

@coderabbitai

coderabbitai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Your plan includes PR reviews subject to rate limits. More reviews will be available in 5 minutes.

@AliceJump

Copy link
Copy Markdown
Owner Author

@coderabbitai rate limit

@coderabbitai

coderabbitai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Your plan includes PR reviews subject to rate limits. More reviews will be available in 15 seconds.

@AliceJump

Copy link
Copy Markdown
Owner Author

@coderabbitai rate limit

@coderabbitai

coderabbitai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Your plan includes PR reviews subject to rate limits. Reviews are available now.

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Owner Author

@coderabbitai rate limit

@coderabbitai

coderabbitai Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Your plan includes PR reviews subject to rate limits. More reviews will be available in 24 seconds.

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor
Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@AliceJump
AliceJump merged commit b433144 into main Dec 1, 2026
5 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.

1 participant