fix(ths): get_balance 可见性过滤——多账户下误读其他账户资金数字 - #7
Merged
Conversation
2026-07-14 双账户切换演练发现:xiadan 多账户登录时每个账户各挂一套 同 ID 资金控件(0x3F4..),只有当前账户的可见。get_balance 是全代码库 唯一不带 visible 过滤的控件查找(_find_grid/_find_input/撤单按钮/ 策略下拉/提交按钮均为可见优先),Alt+2 已切到账户二后 balance 仍 返回账户一全套数字,真钱 sizing 输入被污染;position 因 _find_grid 带 visible=True 读数正确,两者对照坐实根因。 修法与既有模式对齐:可见优先、放宽兜底(单账户/旧皮肤兼容),兜底 命中时留 warning。新增跨平台回归用例锁定查找顺序。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
兜底在面板加载间隙同样可能抓到其他账户的隐藏副本;真钱 sizing 宁可失败重试,不可静默读错。重试结构与 get_position 对齐。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
suny911
marked this pull request as ready for review
July 13, 2026 17:16
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.
事故现场(2026-07-14 凌晨双账户演练)
xiadan 登录两个账户(Alt+1 国金 / Alt+2 银河空账户)。
switch_account发 Alt+2 切换成功(肉眼确认界面在账户二、position返回空),但balance仍返回账户一的全套数字(总资产 34915.47,账户二实际 1.65)。同屏对照实锤:position 对、balance 错。根因
多账户下每个账户各挂一套同 ID 资金控件(0x3F4..),只有当前账户的可见——ID 维度天然区分不了账户,可见性才能。
get_balance是全代码库唯一不带visible过滤的控件查找(_find_grid/_find_input/撤单按钮/策略下拉/提交按钮均为可见优先),枚举先撞到其他账户的隐藏副本。修法
只认可见控件;读不到重试后明确报失败(code 1),不做未过滤兜底——兜底在面板加载间隙同样可能抓到隐藏副本,真钱 sizing 宁可失败不可读错。重试结构与
get_position对齐。2 条跨平台回归用例锁定:① 可见副本必须优先;② 无可见控件必须失败、隐藏面板数字绝不进返回。本地 113 passed / 10 skipped。实测清单(Windows 端更新后,MCP 返回 vs 屏幕肉眼对照)
🤖 Generated with Claude Code