Design: freeze a session's program group atomically (cgroup freezer)
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 25/100
- Issue 類型
- 功能
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- linux, typescript
- 領域
- cli, operating-systems
研究方向
Start with docs/USAGE.md, the host process-spawning and session-recording code, and the TLA+ lifecycle model at .agents/skills/verify-session-lifecycle. First evaluate delegated cgroup availability in the listed target environments and how a recorded cgroup path can be verified across processes, including sessions created by older versions. Done means an ADR documents the mechanism, fallback, and measurements; both stated gaps are addressed where supported; the model checks the lifecycle rules; and docs/USAGE.md explains remaining limits.
由索引模型根據 Issue 內容生成。
描述
Design: freeze a session's program group atomically (cgroup freezer), so destroy and gc cannot miss a fork chain.
Problem
destroy and gc end a session's program group by reading /proc, proving that the group is the session's, and killing it. A fork chain (processes that each fork a successor and exit within a few ms) can end between two reads. Since #326, #333 and #334, agent-tty sends such a group SIGSTOP, so its processes stay in view, and judges it again. SIGSTOP and the reads are separate system calls, so this remains a heuristic. Two gaps are left, and docs/USAGE.md documents both (Limits 3 and 5, and the fork-chain paragraph under destroy):
- A missed chain under a PID 1 that never reaps. When another process sends the group SIGCONT before each of the 5 freeze checks, the freeze misses the chain. Normally the wait then still finds the group id, and
destroyfails withHOST_TIMEOUT. Under a PID 1 that never reaps, the scans show only zombies, the group reads ended, anddestroyreports success while the chain still runs.gchas the same limit after its 20 frozen checks. - A false
HOST_TIMEOUT(since #334). The CLI's/procbelongs to another pid namespace, the session has no autogroup record (or uses an oldchildPidrecord), and a PID 1 that never reaps keeps the zombies. Thendestroyfails withHOST_TIMEOUTalthough the program has ended. Before #334,destroyrecordeddestroyedthere. I reproduced both sides with a real CLI undersudo unshare --pid --forkwithout--mount-proc(see #335).
A comment on 2026-11-03 in this work already concluded that a freeze without these gaps "needs the cgroup freezer or ptrace".
Direction to evaluate
- Put each session's program in its own cgroup v2 leaf (for example under the user's delegated systemd scope) when the host spawns it.
cgroup.freezethen freezes every member at once,cgroup.procslists the members without a/procscan, andcgroup.kill(Linux 5.14+) kills them all in one call. Membership is inherited on fork, so a chain cannot escape it. - Keep the current autogroup and SIGSTOP path as the fallback where no writable delegated cgroup exists (containers without delegation, older kernels, macOS, Windows).
- Questions to answer first: does a delegated cgroup exist in the environments agent-tty targets (CI runners, Coder workspaces, Docker with and without
--cgroupns)? How does the host record the cgroup path so thatdestroyfrom another process can prove it is the session's (ahost.json/program.jsonfield, and model checks for it)? What happens to a session that a version without this feature started? - The TLA+ lifecycle model (
.agents/skills/verify-session-lifecycle) needs an action for the cgroup path, and the rulesDestroyedProgramStoppedand the gc rules must hold with it.
Done when
- A design note (ADR under
docs/adr/) chooses the mechanism and the fallback, with measurements from the target environments. - Both gaps above are closed where the mechanism is available, and the model check covers them.
docs/USAGE.mdstates where the old limits still apply.
Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high
- 主要語言
- TypeScript
- 星號
- 30
- 分支
- 4
- 平均合併
- 3 小時 19 分鐘
- 30 天內合併 PR
- 107
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
coder/agent-tty 的其他 Issue
-
難度 4/5 3-5 天 新手友好度 35/100
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 38/100
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 30/100
維護者通常 1 天內回覆
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 70/100
backnotprop/plannotator#2914 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
microsoft/vscode-containers#655 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 77/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
dsh-tauri-desk/deepseek-harness-desktop#1477 · 1 則留言 ·