Repository navigation
fix(cli-writer-login-shell): macOS 终端里的 agent 退出后可以转到聊天界面继续 - #63
Merged
Merged
Conversation
…ue in chat after the agent exits On macOS every terminal is spawned through /usr/bin/login for TCC attribution, so the PTY root is login and the shell is its only child. The terminal-writer census required the root itself to be a shell, so it refused to hand a conversation to Chat UI even after Codex or Claude had exited; only closing the terminal helped. The census now inspects the shell below the login wrapper and keeps every other rule (foreground, no job of any kind left). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-app validation Requirement, design, test cases and the local and SSH real-app runs for the terminal-writer census fix, plus the formatter's wrap of the new policy entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9 tasks done
…ind the login wrapper Adds the review's missing cases (background and suspended jobs under the login-wrapped shell, and the pane entry for an extra login child), the rejected reuse of inspectSpawnFileChildProcessesFromRows, and the plan to drop this fork patch once upstream ships the same fix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-writer-login-shell # Conflicts: # docs/issue/README.md
…-writer-login-shell # Conflicts: # docs/issue/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
在 Mac 上,Orca 开的每个终端外面都多套了一层系统的
login进程。「把终端里的对话转到聊天界面」之前,Orca 会先确认终端里已经没有 agent 在跑,但它检查的是最外面那层login,而不是里面真正的 shell,所以永远认为「还有东西在跑」。结果就是:哪怕 Codex 已经退出,也一直提示「Orca can't confirm Codex has exited in its terminal」,只有关掉整个终端才行。这个 PR 让检查穿过login这一层,看里面真正的 shell。What Changed
/usr/bin/login(TCC 隐私授权包装),shell 是它唯一的子进程。posixCliWriterShellAlone原来要求根进程本身是 shell。现在新增ptyShellRow(src/main/cli-writer-login-shell/):根进程是login时取它唯一的子进程作为 shell,零个或多个子进程则判不通过;后面「是 shell、在前台、没有任务」三条检查原样保留。上游文件只改 3 行。Why
rootProcessId:它有多个读者(Codex 共享服务、tmux 识别、前台进程解析),改语义影响面大。confirmShellForegroundProcess:它只要求 shell 在前台,会放过后台任务,弱于这里「一个任务都不能剩」的要求。Linked Issue
无(用户直接反馈;fork 内修复,已登记为 fork 功能
cli-writer-login-shell,文档在docs/issue/终端对话转聊天退出判定/)。Visual Proof
截图含本机工作区信息,未上传;保存在本地
.docs/cli-chat-resume-ui-validation/2026-10-23/evidence/。Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
单测
src/main/cli-writer-login-shell/login-wrapped-pty-shell.test.ts:用实测的login → zsh → codex进程链覆盖窗格与 Session History 两条入口。撤掉修复后该测试失败,修复后通过;上游structured-agent-cli-writers.test.ts也全部通过。本机真机(隐藏隔离实例,
ORCA_BACKGROUND_LAUNCH=1,真实 Codex):开启 login 包装时修复前复现、修复后通过;关闭包装的对照组修复前就能恢复,印证了根因。SSH 真机(隔离客户端 →
127.0.0.1:2222sshd → 远端 orcad,SSH 侧 HOME 隔离):SSH 工作区的终端会话在窗格和 Session History 都不提供转聊天,修复前后完全一致。上游本来就只对本机执行的终端提供这个动作。平台:macOS 实测。Linux 的根进程本身就是 shell,规则不变;Windows 走单独分支,不受影响。
门禁:
pnpm tc、check:fork-features、check:fork-docs、check:architecture-policies --base Fartown/main、三项本地化门禁、check:code-quality:changed -- fork/integration全部通过。AI Disclosure
Claude Opus 5.5(Claude Code)完成复现、修复、测试与文档。
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)🤖 Generated with Claude Code