fix(acp): replay config observables on cold-start so selectors show current values#199
Merged
Merged
Conversation
…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.
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.
根因
permission selector 初始永久显 "—" 的真根因不在 panel.rs(#198 v0.6.2 已修「运行中切档」run_event_loop 路径),而在冷启动重放:
session/new→drain_bootstrap_events设计性丢弃 cold-start broadcast(含PermissionModeChanged/ModelChanged/ModeChanged/ThinkingChanged)replay_loopal_snapshot→build_replay_eventsbuild_replay_events只重放bgTask/crons/tasks/mcp,漏发全部 config observables∴ AgentsMesh permission selector(及 model/mode/thinking console 镜像)在用户手动切换前显 "—"/空。
修复
build_replay_events从state.agent.observable补发 4 项 config observable:permission_mode/model/mode/thinking。thinking读 snapshot 的thinking_config字段但以thinking发出,匹配 liveThinkingChanged通知字段名。空值跳过。测试
replays_config_observables_skipping_empty:4 项重放 + 空值跳过 +thinking_config→thinking映射 + data 字段名断言。本地 clippy + rustfmt + unit test 全绿。