Skip to content

fix(host-runtime): reread shared Thread lists after a routed section move - #989

Merged
BytePioneer-AI merged 1 commit into
BytePioneer-AI:mainfrom
ump45nose:pr/shared-list-section-move
Nov 21, 2026
Merged

BytePioneer-AI merged 1 commit into
BytePioneer-AI:mainfrom
ump45nose:pr/shared-list-section-move

Conversation

@ump45nose

Copy link
Copy Markdown
Contributor

Purpose

When a GUI pins or unpins a shared external Thread, SharedThreadBridge.route forwards thread/section/move to the shared Host. The GUI then rereads its lists right away. For up to 5 seconds (SHARED_LIST_REUSE_MS), bridge.list() serves the shared rows it walked before the move. So the Pinned section still shows the old state, and the pin looks like it did not take until something else refreshes the sidebar.

Root cause

The bridge only drops its cached list walks when a thread/* notification arrives from the shared Host. A section move produces no notification. For other mutations, the notification can also land after the reply that triggers the reread.

Change

After the bridge routes a request that changes list membership or order (archive, delete, fork, metadata update, rename, revert, rollback, section move, start, unarchive), it drops its cached walks before returning the reply. Notifications keep invalidating as before.

Not included: the fork also routed a native Thread's move to the shared Host when its beforeThreadId is a shared Thread. That changes which store owns a native Thread's placement, so it needs a design decision rather than a cache fix.

Validation

  • npx tsc -b
  • New case in packages/host-runtime/test/shared-thread-bridge-list.test.ts, "walks again after a routed section move, which has no Thread notification". It fails on main, where the Pinned list stays empty after the move, and passes with this change.
  • shared-thread-bridge-list.test.ts + shared-threads.test.ts: 22/22. eslint and prettier on the changed files.

Known baseline on main (unchanged by this PR)

  • lint errors in packages/adapters/antigravity/test/acp-transport.test.ts:457-458 and app-server-host.background-output.test.ts:146
  • failing tests: two Codex Usage projection tests, and "retires a running Subagent when the parent's output stream ends"

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 问题修复
    • 通过转发操作移动线程后,相关线程列表会及时更新。再次查看目标分区时,将显示已移入的线程,而不会继续显示过期的列表结果。

共享 Thread bridge 在转发指定的线程变更请求后失效列表缓存。新增测试验证 section 移动后,查询结果包含已移动的线程。

Changes: 共享 Thread 列表缓存

层 / 文件 摘要
路由变更请求并验证缓存失效
packages/host-runtime/src/shared-thread-bridge.ts, packages/host-runtime/test/shared-thread-bridge-list.test.ts
新增变更列表的方法集合。route 在转发这些方法后失效列表缓存。测试验证移动线程后,再次查询目标 section 会返回该线程。

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: bytepioneer-ai, mouzhi

Merge Risk: Minimal · up to e3fc2

This change makes shared Thread lists refresh after a Thread is moved between sections, so moved Threads no longer appear missing for up to 5 seconds. No actionable merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix(host-runtime): reread shared Thread lists after a routed section move”准确描述了主要变更:在共享 Thread 的 section 移动请求转发后重新读取列表。变更摘要显示 shared-thread-bridge.ts 新增 LIST_CHANGING_METHODS 并在转发后使列表缓存失效,测试也覆盖了这一情…
Description check Passed 描述说明了问题原因(SharedThreadBridge.route 转发 thread/section/move 后 bridge.list() 在 SHARED_LIST_REUSE_MS 内复用旧列表)、修改方式(路由请求返回前清除缓存的列表遍历结果)、新增测试以及验证步骤。这些内容与变更摘要中的 shared-thread-bridge.ts 和 shared-thread-bridge-…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

标题“fix(host-runtime): reread shared Thread lists after a routed section move”准确描述了主要变更:在共享 Thread 的 section 移动请求转发后重新读取列表。变更摘要显示 shared-thread-bridge.ts 新增 LIST_CHANGING_METHODS 并在转发后使列表缓存失效,测试也覆盖了这一情形,因此标题与变更集相关。

Full details: Description check

Explanation

描述说明了问题原因(SharedThreadBridge.route 转发 thread/section/move 后 bridge.list() 在 SHARED_LIST_REUSE_MS 内复用旧列表)、修改方式(路由请求返回前清除缓存的列表遍历结果)、新增测试以及验证步骤。这些内容与变更摘要中的 shared-thread-bridge.ts 和 shared-thread-bridge-list.test.ts 改动直接对应,因此描述与变更集相关。

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 00d0fbe and e3fc265.

Files selected for processing: 2

  • packages/host-runtime/src/shared-thread-bridge.ts
  • packages/host-runtime/test/shared-thread-bridge-list.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

Recent review details

Context from checks skipped due to timeout: 7

  • GitHub Check: CodeRabbit
  • GitHub Check: Check Linux ARM64
  • GitHub Check: Check macos-26
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Check windows-latest
  • GitHub Check: Vitest
  • GitHub Check: Web Host tests
Additional context used

Code guidelines: 2

AGENTS.md — auto-discovered
CLAUDE.md — auto-discovered
Path-based instructions: 1

Source excerpt: Host Runtime loads installed plugins through public contracts, not direct imports of concrete Adapter packages.

CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/host-runtime/src/shared-thread-bridge.ts
  • packages/host-runtime/test/shared-thread-bridge-list.test.ts
Additional comments: 2

packages/host-runtime/src/shared-thread-bridge.ts: 1

53-64: LGTM!

Also applies to: 222-224

packages/host-runtime/test/shared-thread-bridge-list.test.ts: 1

185-222: LGTM!

@BytePioneer-AI
BytePioneer-AI merged commit a0f71f9 into BytePioneer-AI:main Nov 21, 2026
4 of 8 checks passed
@BytePioneer-AI

Copy link
Copy Markdown
Owner

Merged, thanks @ump45nose! Invalidating the bridge's list cache after a forwarded list-changing method (section move has no Thread notification) is exactly the right scope, and the regression test goes through the real route()/list() path.

ump45nose added a commit to ump45nose/codex-host that referenced this pull request Nov 27, 2026
Eleven manifest lines still carried fork copies of changes that upstream has
already released. Each one names a merged PR whose head commit is an ancestor
of v0.28.2, so the line only re-applies the pre-review copy of code that the
release tag already contains, and that duplication is what turns the manifest
replay into conflicts.

Removed lines and their merged PRs:

- thin/cursor-fast-selection (BytePioneer-AI#782)
- thin/delegation-inspect-fast-models (BytePioneer-AI#986)
- thin/delegation-catalog-parent (BytePioneer-AI#970)
- thin/settings-hide-desktop-envs (BytePioneer-AI#972)
- thin/settle-turns-after-session-fault (BytePioneer-AI#969)
- thin/external-thread-turn-recency (BytePioneer-AI#973)
- thin/claude-code-todo-tools (BytePioneer-AI#976)
- thin/reasoning-summary-parts (BytePioneer-AI#967)
- thin/shared-archived-thread-revival (BytePioneer-AI#988)
- fix/desktop-mcp-session-reap-v0.22 (BytePioneer-AI#981)
- fix/macos-descriptor-mode (BytePioneer-AI#1004)

For the two lines whose comments noted that the fork copy predated the PR's
review changes (BytePioneer-AI#969, BytePioneer-AI#976), the reviewed upstream version replaces it.

Checked with `scripts/vincent-release.sh audit` (ancestor and patch-cherry
checks) and by replaying the manifest onto v0.28.2 in a scratch worktree: these
eleven lines no longer merge, and the fifteen remaining lines are fork-only
changes that need re-cutting from the new tag.

Lines for fork-only additions are untouched: the extras documented for BytePioneer-AI#470,
BytePioneer-AI#987 and BytePioneer-AI#989 stay, and the lines for the closed PRs BytePioneer-AI#576, BytePioneer-AI#783, BytePioneer-AI#784, BytePioneer-AI#785 and
BytePioneer-AI#396 stay.
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.

2 participants