Repository navigation
fix(renderer): 读不到所属 Agent 的对话不再让 Composer 循环重画 / stop Threads with an unreadable owner from looping Composer renders - #1165
Conversation
…poser renders A Thread Composer starts in the draft phase and leaves it only after its owner is read. When that read fails (for example, the Harness has deleted the Thread's native Session), the Composer stays a Codex draft that is bound to a Thread. refreshDraftUsage refuses such a Composer, but reconcileHarnessAvailabilityHost checked only the phase. Every scan therefore reloaded Codex Accounts, and the reload rerendered every Composer and refreshed draft usage. The rerender changed the DOM, which scheduled the next scan, so the loop ran about ten times a second while the Composer stayed mounted. A visible new Codex draft cleared and restored its account limit chip on every pass, so the chip flickered. Share one draft usage eligibility check between the scan and refreshDraftUsage.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
感谢贡献!改动干净聚焦,真实入口单测在修复前稳定复现循环并在修复后收敛,现已通过 merge commit 合入 |
Summary
中文
codexhost/thread/inspect返回 -32079),它的 Composer 会一直停在默认的 Codex 草稿阶段,同时又绑定着这个对话。refreshDraftUsage不处理绑定了对话的 Composer,但reconcileHarnessAvailabilityHost只检查阶段,所以每次扫描都会调用loadCodexAccountsForHost。○ 93%)每一轮都会先被清空再填回,看起来就是持续闪烁。codex/draft;91 次重画中有 90 次来自loadCodexAccountsForHost的回调。isDraftUsageComposer,让扫描和refreshDraftUsage(包括其中的isCurrent)使用同一个草稿额度判断。真正的新对话草稿行为不变。English
codexhost/thread/inspectreturns -32079), its Composer stays in the default Codex draft phase while it is bound to that Thread.refreshDraftUsagerefuses a Composer that is bound to a Thread, butreconcileHarnessAvailabilityHostchecked only the phase, so every scan calledloadCodexAccountsForHost.○ 93%) on every pass, so the chip flickers.codex/draft; 90 of 91 rerenders came from theloadCodexAccountsForHostcallback.isDraftUsageComposer, so the scan andrefreshDraftUsage(including itsisCurrent) use one draft usage eligibility check. Genuine new-Thread drafts behave as before.Related issues
无 / N/A
UI Demo
中文:没有新增或修改任何界面元素和样式。修复前的现象是上面描述的额度 chip 闪烁。修复后的实机录屏未录制,原因是换上修复版需要重启 Desktop 和 Host。
English: No UI element or style is added or changed. Before the fix, the account limit chip flickers as described above. No recording after the fix was made, because running the fixed build needs a restart of Desktop and the Host.
Test plan
中文
npx vitest run --config tests/vitest.config.js packages/renderer-extension/test/renderer-binding-probe-host-catalog.test.tscodexhost/account/list请求从 1 次变成 4 次。renderer-model-client、renderer-binding-probe、renderer-usage-notifications、renderer-main-process-draft、draft-selection-order、renderer-native-thread-ownership共 7 个文件,180/180 通过(基于当前main)。npx tsc -b packages/renderer-extension通过。English
npx vitest run --config tests/vitest.config.js packages/renderer-extension/test/renderer-binding-probe-host-catalog.test.tscodexhost/account/listrequests from 1 to 4.renderer-model-client,renderer-binding-probe,renderer-usage-notifications,renderer-main-process-draft,draft-selection-orderandrenderer-native-thread-ownership, 7 files in total: 180/180 pass (on currentmain).npx tsc -b packages/renderer-extensionpasses.