Skip to content

docs: state that only quit releases a session's background commands - #353

Merged
liuedcson merged 1 commit into
mainfrom
fix/process-release-docs
Nov 7, 2026
Merged

liuedcson merged 1 commit into
mainfrom
fix/process-release-docs

Conversation

@liuedcson

Copy link
Copy Markdown
Collaborator

问题

docs/orchestration-lifecycle.md 里同一节内部自相矛盾。

上面是所有权表格(#349 引入):

事件 后台命令
The owning session is deleted, replaced, or resumed away stopped

下面是「When a command is released」(#351 引入):

session_shutdown fires for five reasons, and only quit ends the session. new, resume and fork replace the runtime … Releasing on those would stop a dev server the user is still watching, so the release is gated on reason === "quit".

replaced 和 resumed away 正是 new / resume / fork 这三个 reason——代码里它们不释放(step.ts 的 if (event.reason === "quit"))。表格说的和代码相反,而表格是读者最先看的东西。

顺带:#351 加了上面那段新说明,却没删 #349 的旧表述,这是这次遗漏的直接原因。

改动

表格按真实语义拆开。 new / resume 和 fork、reload 一样属于「keeps running」;只有删除会话和宿主退出会停。

releaseSessionProcesses 的 docblock 同步修正。 原文写:

session_shutdown … fires only when the session is really going away: /new, resume, a deleted session, and quit. A session switch or a fork … never reaches this handler.

两句都不成立:这个 handler 明确会收到 new / resume / fork(SessionShutdownEvent["reason"] 就是 quit | reload | new | resume | fork),保住进程的是那个 gate,不是「到不了」。这段同样是无 gate 版本的遗留。

验证

  • tsgo --noEmit 通过
  • session-process-release / step-ps / step-subagents 共 19 个用例通过
  • git grep 确认 never reaches this handler、resumed away、really going away 已无残留

边界

只改文档和注释,无行为变更。

The new "When a command is released" section says the release is gated on
`reason === "quit"`, but the ownership table right above it still listed
"deleted, replaced, or resumed away" as stopping the tree. Those are exactly the
reasons that do not end a session, so the two statements contradict each other
and the table is the one a reader trusts.

The table now separates them: `new` and `resume` keep running like a fork and a
reload, and only a deleted session or a host exit stops the tree.

The docblock on `releaseSessionProcesses` had the same stale claim — it described
`session_shutdown` as firing only when the session is really going away, and
"a session switch or a fork never reaches this handler". The handler does receive
`new`, `resume` and `fork`; the gate is what keeps the trees alive. Both
statements were left over from the ungated version and are now gone.
@liuedcson
liuedcson merged commit c1e9e29 into main Nov 7, 2026
2 checks passed
@liuedcson
liuedcson deleted the fix/process-release-docs branch November 7, 2026 12:54
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.

1 participant