Skip to content

fix(hub): 刚上线的节点立刻对别的节点可见(节点名单变化时清状态缓存) - #3845

Merged
vansin merged 1 commit into
mainfrom
fix/all-status-cache-roster-change
Nov 23, 2026
Merged

vansin merged 1 commit into
mainfrom
fix/all-status-cache-roster-change

Conversation

@vansin

@vansin vansin commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

为什么

「更早就坏」卡 #5402 的 P1:Node caller identity compat (Docker, agent-node .110 and .121) 失败在 timeout: 121-sends child task。

日志里的差别只有一处:

第 1 轮(通过)  16:42:53 hub → get_all_status net=…            ← 现查
第 2 轮(失败)  16:42:58 hub → get_all_status (cached) net=…   ← 5 秒前的缓存

第 2 轮的两个节点是 16:42:57 才注册的,缓存里没有它们。被要求「交给某节点」的节点查名单、查不到对象,就什么都不做。推断根因:#3415(2026-11-09)给 get_all_status 加的 10 秒缓存把「有哪些节点」也一起缓存了。待本 PR 上的这套测试证实。

对真实用户的影响:一个节点刚上线(或刚恢复在线)的 10 秒内,别的节点看不到它,这时转交给它的任务会被静默丢掉。

改动

验证

  • all-status-cache.test.ts 新增 3 条,本地 6 条通过。
  • 真正的验证是本 PR 上的 Node caller identity compat:已打 full-qa。
  • 需要 Hub 重启才在线上生效,与已预告的那次重启合并。

🤖 Generated with Claude Code

…status

The 10 s get_all_status cache (#3415) also cached who exists. A node that had
just come online was missing from every cached answer for up to 10 s, so a
peer asked to hand a task to it looked it up, found nothing and did nothing.
The cache is now dropped when a status report adds a session or moves it
across the online/offline line; heartbeats and idle/working changes still
reuse it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@vansin vansin added the full-qa Run the full QA / Docker / E2E matrix on this PR label Nov 23, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T19:30:23.881661Z 2aac7f3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2aac7f3980

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread server/src/tools.ts
// conversations), so only the dispatch-sized preview is stored here.
const sessionTask = task == null ? null : sessionTaskPreview(task); // board668-session-preview
// A node appearing, returning or leaving must be visible to the next get_all_status (all-status-cache.ts).
if (rosterChanged(db.get<{ status: string | null }>("SELECT status FROM sessions WHERE resume_id = ?1", resume_id)?.status, storedStatus)) invalidateAllStatusCache();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Account for same-alias handovers before invalidating the cache

When the SDK and Grok CLI reporters alternate for the same node, this lookup returns no row on every handover because the following DELETE removed that reporter's previous resume ID. This is an explicitly supported flow in server/src/report-status-resume-id-handover.test.ts, and agent-node/src/cli.ts supplies the distinct sdk- and grok-cli- IDs. Consequently, ordinary reports repeatedly clear every network's cache even though no node appeared or crossed the online/offline boundary, undermining the cache's protection against expensive fleet-wide serialization. Read the prior status from the same-alias, same-network handover row when the resume-ID lookup misses, rather than treating every handover as a new node.

Useful? React with 👍 / 👎.

@vansin
vansin merged commit 953c499 into main Nov 23, 2026
172 of 244 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-qa Run the full QA / Docker / E2E matrix on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant