feat: log effective Windows local runtime shell - #9648
Merged
Soulter merged 2 commits intoAug 13, 2026
Conversation
C10H14N2O5
force-pushed
the
feat/log-windows-local-shell
branch
from
August 12, 2026 16:23
6d1144e to
554d4fb
Compare
C10H14N2O5
marked this pull request as ready for review
August 13, 2026 01:51
Soulter
approved these changes
Aug 13, 2026
BegoniaHe
pushed a commit
to Xero-Team/AstrBot
that referenced
this pull request
Aug 14, 2026
Upstream-Commit: 08d0b1f Upstream-Author: C10H14N2O5 <100066858+C10H14N2O5@users.noreply.github.com> Upstream-PR: AstrBotDevs#9648 Sync-Disposition: adapt Fork-Adaptation: Emit the effective Windows shell from the fork-owned ComputerRuntime when its local booter is first created. Tested: uv run ruff check astrbot/core/computer/computer_client.py
LIghtJUNction
added a commit
that referenced
this pull request
Aug 14, 2026
* chore: update readme * feat: support PowerShell 7 for Windows local shell (#9622) * feat(config): add Windows PowerShell version option * feat(computer): honor Windows PowerShell version in local runtime * fix(computer): correct stale shell comment for configurable PowerShell * refactor(computer): inline windows shell resolution per AGENTS.md * test(computer): assert windows_shell in exec_managed call * test: make shell tests cross-platform Co-authored-by: Donoym <prober13c14@gmail.com> * refactor(computer): auto-detect Windows shell instead of config * fix(computer): drop stale cmd.exe references after shell auto-detect * style: apply ruff format and import order * Update astrbot/core/astr_main_agent.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> --------- Co-authored-by: Donoym <prober13c14@gmail.com> Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * feat: add download-count sorting to plugin marketplace (#9570) * feat: 插件市场支持按下载量排序 为插件市场现有的前端本地排序补充下载量选项,复用已规范化的 download_count,不改变默认推荐顺序、后端接口和 OpenAPI。 新增稳定且不修改输入的下载量排序工具:支持升降序、未知值双向置底、非法值兜底及相同值原始顺序保留;接入市场排序控件并补齐中、英、俄三语文案。 新增 9 项专项单元测试,覆盖正常排序、零值、缺失与非法值、负数、数字字符串、小数、稳定性和输入不可变。验证通过 45 项 Dashboard Node 测试、额外性质检查、三语 JSON 校验、Vue 类型检查和生产构建。 * Delete dashboard/tests/marketPluginSort.test.mjs * refactor: 内联插件市场下载量排序 删除独立的市场下载量排序工具,将下载量比较逻辑直接放在现有市场排序分支。 缺失下载量使用默认值 0,保持前端本地排序与现有排序行为一致。 验证:vue-tsc --noEmit;pnpm run build;node --test dashboard/tests/*.test.mjs;git diff --check。 --------- Co-authored-by: C₂₂H₂₅NO₆ <Sisyphbaous-DT-Project@users.noreply.github.com> Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> * fix: improve dark theme text contrast (#9643) * fix: propagate QQ media upload failures (#9644) * feat(qqofficial): add chunked file uploads (#9646) Add a dedicated chunked uploader for large local QQ Official media. Keep C2C and group endpoints explicit, support server-provided part index bases, and retry transient upload operations. Co-authored-by: Fuyan Yuan <33221728+TheRainstorm@users.noreply.github.com> * fix(kb): support UUID fallback in get_kb_by_name and warn on missing KBs (#9636) Fixes #9529. When kb_names contains UUIDs instead of names, get_kb_by_name() would return None and check_all_kb() would silently skip retrieval with only a DEBUG-level log. Modifications: - get_kb_by_name() now falls back to UUID lookup when name match fails - check_all_kb() distinguishes None (not found) from empty KBs and logs a WARNING with the count of missing KBs - Add regression tests covering UUID lookup, name preference, and logging * fix: prevent SharedPreferences deadlocks (#9649) * fix: avoid blocking shared preference access * docs: clarify shared preference cache roles * docs: explain shared preference cache purpose * docs: link cache rationale to pull request * chore: bump version to 4.27.3 (#9650) * chore: bump version to 4.27.3 * Update changelog for version 4.27.3 Updated changelog for version 4.27.3 with new features, maintenance updates, and bug fixes. * Refactor: stat service deprecated stats (#9658) * refactor(dashboard): migrate get_stat off deprecated stats methods Rewrite StatService.get_stat to query PlatformStat directly via db_helper.get_db(), following the existing get_provider_token_stats pattern in the same file, instead of the deprecated get_base_stats/get_grouped_base_stats/get_total_message_count. - Windowed rows are fetched once with an explicit ORDER BY timestamp (the old get_base_stats relied on insertion order) - Per-platform sums and hourly time-series buckets are aggregated in Python; total message count uses func.coalesce(func.sum(...), 0) - Response shape is unchanged: platform entries keep the {name, count, timestamp} keys, now built as plain dicts so no deprecated po.Platform/Stats classes are instantiated - Verified semantically identical against the old methods with an A/B comparison over a seeded database (time series, per-platform sums, total count, and empty-window case all match) * test(dashboard): cover StatService.get_stat aggregation semantics The existing test_get_stat route test only asserts the HTTP status and the presence of the platform key, so an aggregation regression would pass unnoticed. Add focused unit tests that seed PlatformStat rows and assert the windowed per-platform sums, the global message total, the hourly time-series bucket shape, the response key set, and the empty-window behavior. * feat(provider): add SSYCloud chat completion provider (#9659) * fix: include JSON cards in group context (#9655) * fix: include JSON cards in group context * fix: allow JSON cards to trigger active replies * docs: add ShengSuanYun provider guide * fix: detect audio format from file content (#9612) * feat: log effective Windows local runtime shell (#9648) * feat: log effective Windows local runtime shell * chore: remove Windows shell logging tests --------- Co-authored-by: Soulter <905617992@qq.com> * refactor(misskey): migrate off deprecated visibility resolver alias (#9674) --------- Co-authored-by: Soulter <905617992@qq.com> Co-authored-by: Wei Chengqian <wcqqq1214@gmail.com> Co-authored-by: Donoym <prober13c14@gmail.com> Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Co-authored-by: C₂₂H₂₅NO₆ <96930391+Sisyphbaous-DT-Project@users.noreply.github.com> Co-authored-by: C₂₂H₂₅NO₆ <Sisyphbaous-DT-Project@users.noreply.github.com> Co-authored-by: Fuyan Yuan <33221728+TheRainstorm@users.noreply.github.com> Co-authored-by: lxfight <1686540385@qq.com> Co-authored-by: Ruochen Pan <badbatch0x01@gmail.com> Co-authored-by: xxshu26 <15197757832@163.com> Co-authored-by: PeiPei233 <49641967+PeiPei233@users.noreply.github.com> Co-authored-by: xiaoxuan010 <2592053474@qq.com> Co-authored-by: C10H14N2O5 <100066858+C10H14N2O5@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
Background
Fixes #9642
PR #9622 introduced automatic Windows shell selection for the Local Runtime, preferring PowerShell 7 (
pwsh.exe) when available and falling back to Windows PowerShell 5.1 (powershell.exe) otherwise.While this removes the need for an additional configuration option, the selected shell is not directly visible to users. In environments where
PATHdiffers between the process launching AstrBot and an interactive terminal—for example, when AstrBot is started by a launcher—the runtime may unexpectedly fall back to Windows PowerShell 5.1 even thoughpwsh.exeis installed and available elsewhere.Without any indication of the effective shell, this is typically only discovered later when a PowerShell 7-specific command or syntax fails.
This PR addresses that observability gap by logging the shell selected by the Windows Local Runtime.
Modifications / 改动点
This PR adds observability for the effective shell selected by the automatic shell detection introduced for the Windows Local Runtime in PR #9622.
When the Local Runtime singleton is first created, it logs the selected PowerShell executable using the existing Windows shell resolution logic:
pwsh.exeis logged;powershell.exeis logged;Example:
Or:
Unit tests are also added to cover:
Logging
pwsh.exewhen the Windows shell resolver returns it;Logging
powershell.exewhen the Windows shell resolver returns the fallback;Avoiding Windows shell resolution and the corresponding log on non-Windows platforms;
Ensuring repeated retrieval of the same Local Runtime singleton does not resolve or log the shell again.
This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
This PR does not include any UI changes, so no screenshots are provided. The following sections show the actual runtime logs and automated test results.
Test Environment
26200.91683.14.07.6.4Windows End-to-End Verification: PowerShell 7 Available
When
pwsh.execan be resolved fromPATH, the Local Runtime correctly logs:The Agent was then asked in the conversation to execute:
$PSVersionTable.PSVersion.ToString()Output:
The Agent was subsequently asked to verify PowerShell 7-specific features such as the ternary operator,
??, and$IsWindows, all of which executed successfully.It was also verified that repeated Shell Tool calls do not emit the effective shell log again, as expected since it is logged only once per singleton lifecycle.
Windows End-to-End Verification: Fallback When PowerShell 7 Is Unavailable
After temporarily removing PowerShell 7 from the current process's
PATHand restarting AstrBot, the Local Runtime correctly falls back and logs:The Agent was then asked in the conversation to execute:
$PSVersionTable.PSVersion.ToString()Output:
PowerShell 7-specific syntax was also verified to be unavailable in this environment, confirming that the actual shell being executed was Windows PowerShell 5.1.
A subsequent Shell Tool call likewise did not emit the effective shell log again.
Automated Tests
New #9642 logging tests:
Regression tests related to #9642 and #9622:
Formatting and static checks:
Five pre-existing failures were observed when running a broader set of related tests on Windows. The same five failures were reproduced unchanged in an independent detached worktree using the unmodified baseline commit
5e40eb4b522ea8cbe30ddbc2e3bff8ca18c7b166, confirming that they are not regressions introduced by this PR.Checklist / 检查清单
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Log the effective Windows shell used by the local runtime when the LocalBooter singleton is first created, and ensure this behavior is covered by unit tests.
New Features:
Tests:
Summary by Sourcery
Log the effective Windows shell used by the local runtime when the LocalBooter singleton is first created.
New Features:
Tests: