makecindy / makecindy/cindy

bug(desktop): end_team can race with Worker rehydrate and recreate an archived runtime

Open
#2,093 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.7k
Forks
395
Avg merge
21h 48m
Merged PRs (30d)
776

Description

## 问题

`disableOrcaInternal()` / `end_team` 关闭 Worker 时没有与该 Worker 的 `sendToSession` / active rehydrate 共用 route lock。当前 `main` 已通过 #2041 在 rehydrate suppression 窗口保留 input boundary,但关闭意图仍可能交叉。

## 可达竞态

1. Worker send 持有 `withSendToSessionLock`,active rehydrate 正在 close 旧 Session 并 bootstrap 新 Session。
2. `end_team` 同时直接读取旧 Session 并调用 `maker.closeSession()`。
3. 两次 close 由 `Session.closePromise` 合并,唯一一次 `status=closed` 发生在 rehydrate suppression 窗口。
4. rehydrate 随后仍可能 bootstrap 新 runtime,而 end_team 继续把 Worker 归档;结果是已结束团队残留 live runtime,或真正关闭未清理 input boundary。

反向顺序也有窗口:如果 end_team 先关闭 runtime、但在 DB team/worker/session 终态落盘前释放 route lock,等待中的 send 可重新 lazy-bootstrap。

## 期望

- end_team 与同一团队所有 Worker send/rehydrate 串行化。
- 从 runtime close 到 team/workers/session 终态落盘期间保持锁和 send fence。
- 底层 abort/close 卡住时有有界等待,超时后仍保留 fence,禁止 archived Worker 复活。
- 覆盖 rehydrate-first、disable-first、close timeout 回归测试。

关联讨论:#1955 的维护者关闭边界审查;#2041 已修复原始 #1930。

Contributor guide

Open the contributing guide

Research direction

Start by tracing disableOrcaInternal()/end_team alongside sendToSession, active rehydrate, withSendToSessionLock, maker.closeSession(), and Session.closePromise; the issue names no source files. Add regression coverage for rehydrate-first, disable-first, and close-timeout ordering. Done means the route lock and send fence remain effective through terminal persistence, preventing an archived Worker from bootstrapping again.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
desktop, distributed-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.