Skip to content

fix(acp): replay config observables on cold-start so selectors show current values#199

Merged
yishuiliunian merged 1 commit into
mainfrom
fix/acp-cold-start-config-replay
Jun 12, 2026
Merged

fix(acp): replay config observables on cold-start so selectors show current values#199
yishuiliunian merged 1 commit into
mainfrom
fix/acp-cold-start-config-replay

Conversation

@yishuiliunian

Copy link
Copy Markdown
Contributor

根因

permission selector 初始永久显 "—" 的真根因不在 panel.rs(#198 v0.6.2 已修「运行中切档」run_event_loop 路径),而在冷启动重放

  • session/newdrain_bootstrap_events 设计性丢弃 cold-start broadcast(含 PermissionModeChanged/ModelChanged/ModeChanged/ThinkingChanged
  • 冷启动状态唯一可靠来源 = replay_loopal_snapshotbuild_replay_events
  • build_replay_events 只重放 bgTask/crons/tasks/mcp漏发全部 config observables

∴ AgentsMesh permission selector(及 model/mode/thinking console 镜像)在用户手动切换前显 "—"/空。

修复

build_replay_eventsstate.agent.observable 补发 4 项 config observable:permission_mode / model / mode / thinkingthinking 读 snapshot 的 thinking_config 字段但以 thinking 发出,匹配 live ThinkingChanged 通知字段名。空值跳过。

测试

replays_config_observables_skipping_empty:4 项重放 + 空值跳过 + thinking_configthinking 映射 + data 字段名断言。本地 clippy + rustfmt + unit test 全绿。

…urrent values

session/new drains the bootstrap broadcast (cold_start_emit's Permission/Model/
Mode/ThinkingChanged) before the IDE subscribes, so snapshot replay is the only
reliable cold-start source — but build_replay_events only replayed
bgTask/crons/tasks/mcp, never the config observables. AgentsMesh's permission
selector (and model/mode/thinking console mirrors) showed "—"/empty until the
user manually switched.

Replay permission_mode/model/mode/thinking from state.agent.observable.
thinking reads thinking_config but emits under `thinking` to match the live
ThinkingChanged notification's field name.

v0.6.2's panel.rs arm fixed only the run_event_loop path (live switching);
this covers the session/new cold-start path.
@yishuiliunian yishuiliunian merged commit 6ce6b14 into main Jun 12, 2026
4 checks passed
@yishuiliunian yishuiliunian deleted the fix/acp-cold-start-config-replay branch June 12, 2026 09:55
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