Skip to content

fix(mobile): 稳定自定义场景会话状态切换 - #93

Merged
fj-sunny merged 1 commit into
1024XEngineer:mainfrom
fj-sunny:codex/fix-mobile-scene-state-machine
Aug 14, 2026
Merged

fix(mobile): 稳定自定义场景会话状态切换#93
fj-sunny merged 1 commit into
1024XEngineer:mainfrom
fj-sunny:codex/fix-mobile-scene-state-machine

Conversation

@fj-sunny

Copy link
Copy Markdown
Contributor

修改内容

  • 对实时会话启动 Promise 去重,并延迟确认真正卸载,避免 React StrictMode 重放导致 ending -> START 非法转换。
  • 训练阶段推进期间拦截重复 next(),并在 UI 中禁用推进按钮。
  • 补充 StrictMode 生命周期及并发阶段推进回归测试。

验证

  • npm test -- --runInBand src/features/conversation/__tests__/useFreeChatSession.test.tsx src/features/scenes/__tests__/SceneTrainingController.test.ts src/screens/__tests__/ScenesScreen.test.tsx
  • npx tsc --noEmit
  • Android 真机完成自定义场景创建、进入对话和结束会话回归。

Closes #92

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

审查了实时会话 Hook 的 StrictMode 生命周期契约,以及训练阶段推进在 Controller、UI 按钮和后端调用之间的串行化行为。启动 Promise 去重与微任务延迟清理能够避免 effect 重放时提前结束同一 controller;阶段切换期间的状态锁也能阻止重复 advanceStage 请求,未发现需要阻塞合并的正确性问题。

验证通过:3 个相关测试套件(15 个测试)、npx tsc --noEmit、固定提交范围的 git diff --check

View job run

@pionxe pionxe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ok

@fj-sunny
fj-sunny merged commit 541ac3e into 1024XEngineer:main Aug 14, 2026
12 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.

fix(mobile): 修复自定义场景会话状态切换异常

2 participants