fix(mobile): 选目录后无法发送——worktree 偏好同步竞态与输入框 IME 组合态卡死 - #3910
Merged
Conversation
选完项目目录后 worktree 资格探测落地会翻转 supportsRecoveryKeyDiscard, 它此前在偏好播种 effect 的依赖里:cleanup 把还在飞的 get-new-maker-defaults 判为 cancelled,请求重发。eligible 目录上门禁只剩这一条,弱网下重发/重试 循环期间创建按钮灰死且无任何 caption(eligible 无提示,分支 caption 只在 出错时出现),表现为「打完字发不出去」。 - 探测标记改经 ref 读取,移出 effect 依赖,探测落地不再取消在飞请求; - 偏好门真正阻塞创建时,caption 兜底显示既有文案「正在同步 worktree 设置…」。 Signed-off-by: MagicLizi <jiali@magiclizi.com>
拼音组合未结束时点选 @ 目录等 atom,程序化 DOM 替换会打断组合,而 Android WebView 85 基线下打断不一定派发 compositionend(部分输入法发 compositioncancel,此前未监听)。composing 卡在 true 后,notify 持续早退, 后续输入可见但 change 不再上抛,发送按钮一直禁用。 - render()/insertAtSelection() 程序化改 DOM 前先清 composing; - 监听 compositioncancel,与 compositionend 同语义。 Signed-off-by: MagicLizi <jiali@magiclizi.com>
|
| Filename | Overview |
|---|---|
| apps/mobile/app/sessions/new.tsx | 修复 worktree 偏好读取被资格探测更新取消的竞态并补充阻塞提示,但 authority-unknown 冲突被误显示为正在同步。 |
| apps/mobile/src/session/composerRichInputHtml.ts | 程序化 DOM 修改前清除 IME 组合态,并新增 compositioncancel 恢复路径。 |
| apps/mobile/src/tests/newSession.test.ts | 通过源码锁定测试覆盖播种 effect 依赖和新增提示条件。 |
| apps/mobile/src/tests/composerRichInputHtml.test.ts | 覆盖程序化应用文档后组合态解除、后续输入重新上报的行为。 |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[用户选择项目目录] --> B[并行读取 worktree 偏好]
A --> C[探测目录资格与宿主能力]
C --> D[通过 ref 提供最新能力标记]
B --> E{偏好是否就绪}
D --> E
E -->|否| F[阻止创建并显示状态提示]
E -->|是| G[允许创建会话]
H[IME 正在组合输入] --> I[插入目录 atom 或应用文档]
I --> J[清除 composing 并修改 DOM]
J --> K[后续 input 正常上报]
L[compositioncancel] --> K
Prompt To Fix All With AI
### Issue 1
apps/mobile/app/sessions/new.tsx:1220
**冲突状态提示错误**
当宿主回传的权威偏好与用户刚写入的值不一致时,代码会进入 `worktreePreferenceAuthorityUnknown`。此时写入已经结束并需要用户重试,但这里仍显示“正在同步 worktree 设置…”,会让用户无法判断创建为何仍被阻止。请为该冲突状态提供失败或重试提示,或只在实际加载、保存期间使用当前文案。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "fix(mobile): 富文本输入框程序化改 DOM 时清 IME 组合态,补..." | Re-trigger Greptile
Contributor
Author
|
命中 UI 路径(apps/mobile/app/sessions/new.tsx / apps/mobile/src/session/composerRichInputHtml.ts)但 description 未附界面效果证据——建议补充改动后效果:截图/录屏,或改动后界面的 HTML 页面(```html 代码块、.html 附件或在线预览链接),便于确认界面符合 DESIGN.md 设计规范 |
宿主回传与刚写入的 worktree 偏好不一致时,写入已结束并需用户重试开关。 caption / 创建 / Goal 错误此前仍走「正在同步 worktree 设置…」,用户无法 判断创建为何仍被阻止。冲突态改用独立失败文案,仅在真正加载或保存期间 保留同步中提示。 Signed-off-by: MagicLizi <jiali@magiclizi.com>
Contributor
Author
|
本轮:合并 origin/main 后补了权威冲突提示。宿主回传与刚写入的 worktree 偏好不一致时,caption / 创建 / Goal 不再显示「正在同步 worktree 设置…」,改为失败/重试文案,并补了 Light/Dark caption 证据。 |
zqchris
approved these changes
Sep 4, 2026
Contributor
Author
|
合了。选目录后发不出去这件事,一半是 worktree 偏好被取消的 GET 卡住,一半是输入法组合态把发送钉死——现在两条都解开了,手机上选完目录就能接着打字发。 |
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.
这次改了什么
摘要
修复移动端「选完目录后,输入文字无法发送」的两条独立成因:
supportsRecoveryKeyDiscard,该值此前在偏好播种 effect 的依赖数组里——cleanup 会把还在飞的get-new-maker-defaults请求判为 cancelled 并重发。eligible 目录上创建门禁只剩偏好 ready 这一条,弱网下重发 + 1.5s 重试循环期间创建按钮灰死,且无任何 caption(eligible 无提示、分支 caption 只在出错时出现),表现为「打完字发不出去、无提示」。该门禁是设备级偏好同步,与用户目录是否使用 worktree 无关,所有项目目录建会话都会经过。修复:探测标记改经 ref 读取并移出依赖(探测落地不再作废在飞请求);偏好门真正阻塞时 caption 兜底显示既有文案「正在同步 worktree 设置…」。@目录等 atom,程序化 DOM 替换会打断组合;Android WebView 85 基线下打断不一定派发compositionend(部分输入法发compositioncancel,此前未监听)。composing卡在 true 后notify()持续早退,后续输入可见但change不再上抛,发送按钮一直禁用。修复:render()/insertAtSelection()程序化改 DOM 前先清composing;监听compositioncancel。变更类型
fix缺陷修复范围
compositioncancel监听;两侧回归测试UI 变化
session.new.worktreeSettingsSaving;权威冲突改用session.new.worktreeSettingsSyncFailed。Light / Dark 均走语义 token,无硬编码色。权威冲突后的 caption(复用既有 worktree 行,无新样式):
怎么验证的
自动验证
新增回归测试:
composerRichInputHtml.test.ts(WebView 85 stub 环境):组合期间 input 不上抛 change(既有行为锁定)→applyDocument程序化替换后组合态被清除 → 后续 input 的 change 正常上抛。newSession.test.ts(source lock):播种 effect 依赖数组不再包含worktreeHostSupportsRecoveryKeyDiscard、仍含worktreePreferenceSyncKey;missing分支判定经 ref 读取;caption 链在权威冲突时优先worktreeSettingsSyncFailed,仅其余阻塞走worktreeSettingsSaving;create / Goal 错误路径共用同一解析。手工验证
未执行。两条成因的复现分别依赖弱网 relay + git 项目目录的时序、以及真机中文输入法组合被打断的时机,本环境不具备;已通过上述结构化测试锁定行为。建议真机回归:新建任务选 git 项目目录后立即打字点发送(弱网下按钮应最多短暂灰且有「正在同步 worktree 设置…」提示);权威冲突时应看到失败/重试提示而非「正在同步」;会话内拼音组合中点选
@目录后继续输入并发送。未执行的验证
见「手工验证」:真机弱网时序与 IME 实机路径未执行,原因如上。
风险
风险分类
(纯 JS 改动,不触碰原生配置 / app.json / 依赖,不改变 runtime fingerprint,可随 OTA 热更。)
影响与回滚
提交前检查
git commit -s,见 DCO)