Repository navigation
Conversation
生命周期变体不算「写了头部」:`/th /teach 讲讲实现` 与 `/t /goal 干活` 同形,紧跟的技能/命令必须照样转给 CLI;`/th` 与 `/tw` 都不走冷启动透传。 Co-Authored-By: Claude Code <[email protected]>
6a41f7e to
aa2d0b6
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa2d0b6376
ℹ️ 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".
| if (forceTopicMode !== 'worktree' && slashDecision.kind === 'passthrough') { | ||
| // `/th|/tw /<passthrough>`:生命周期变体的目录(当前群会话目录 / 先建的 worktree)只在 | ||
| // 下面的常规建会话路径解析,冷启动透传会直接在 bot 默认目录 fork,所以两者都不走它。 | ||
| if (forceTopicMode === 'default' && slashDecision.kind === 'passthrough') { |
There was a problem hiding this comment.
Preserve raw delivery for lifecycle-prefixed passthrough commands
With default inline injection on a Codex or Claude PTY bot, /th /goal ... now falls through to the ordinary opening path, which calls buildNewTopicCliInput and wraps /goal in <user_message> plus other context. It never sets pendingRawInput, unlike /t /goal ..., so the native command becomes model text rather than a literal slash-command invocation; /tw has the same issue after worktree setup. This contradicts the documented “forwarded verbatim” contract in src/core/passthrough-commands.ts:17-21. Resolve the lifecycle cwd/worktree first, but retain raw-opening delivery afterward.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in df13911. Lifecycle-prefixed native commands retain raw delivery; daemon-command precreate now waits for lifecycle cwd/worktree setup; copy-pinned assertions were replaced with behavior checks. Focused suites: 231/231; build and diff-check pass.
| const claimed = title !== undefined || worktree !== undefined || lifecycle !== undefined || Object.keys(directives).length > 0; | ||
| // 生命周期变体不算「写了头部」:`/th` 就是 `/t here`,`/th /teach 讲讲实现` | ||
| // 与 `/t /goal 干活` 同形,紧跟的技能/命令必须照样转给 CLI。 | ||
| const claimed = title !== undefined || worktree !== undefined || Object.keys(directives).length > 0; |
There was a problem hiding this comment.
Apply lifecycle setup to newly admitted daemon-command sessions
When the current chat cwd differs from a configured defaultWorkingDir and automatic worktrees are disabled, the newly accepted /tw /status or /th /status reaches executeNewTopicSlash's daemon-precreate branch. That branch persists the ordinary configured cwd and returns before the lifecycle resolution/worktree setup at daemon.ts:25384-25480. The following task reuses that session and launches directly in the configured cwd; /tw therefore silently loses its promised worktree isolation. Either reject unsupported lifecycle/daemon-command combinations or apply the lifecycle setup before precreating their sessions.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in df13911. Lifecycle-prefixed native commands retain raw delivery; daemon-command precreate now waits for lifecycle cwd/worktree setup; copy-pinned assertions were replaced with behavior checks. Focused suites: 231/231; build and diff-check pass.
| expect(ds?.pendingRepo).toBe(false); | ||
| expect(mocks.forkWorker).toHaveBeenCalledTimes(1); | ||
| expect(JSON.stringify(mocks.forkWorker.mock.calls[0])).toContain(forwarded); | ||
| expect(JSON.stringify(mocks.replyMessage.mock.calls)).not.toContain('未知'); |
There was a problem hiding this comment.
Replace the localized reply-copy assertion with a behavior check
This new assertion inspects the Chinese word 未知 in serialized Lark replies rather than a routing or delivery outcome. A harmless confirmation-copy change containing that word can fail a successful route, while an English unknown-directive response evades this particular assertion. The root AGENTS.md (which points to CLAUDE.md) explicitly prohibits tests pinned to copy. Rely on the existing session/fork checks or assert the structured delivery payload instead. CLAUDE.mdL149-L149
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in df13911. Lifecycle-prefixed native commands retain raw delivery; daemon-command precreate now waits for lifecycle cwd/worktree setup; copy-pinned assertions were replaced with behavior checks. Focused suites: 231/231; build and diff-check pass.
dashboard IPC 测试运行时相邻端口被其它进程占用;空提交仅重触发 CI。 Co-Authored-By: Claude Code <[email protected]>
生命周期头后的原生斜杠命令继续走 raw_input,并让预建型 daemon 命令在 cwd/worktree 准备完成后执行。补充不依赖本地化文案的行为测试。 Co-Authored-By: Claude Code <[email protected]>
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
源码切片行为测试显式提供新增的生命周期开场依赖,避免与真实路由无关的 ReferenceError。 Co-Authored-By: Claude Code <[email protected]>
|
你好,这是自动评审(Claude)的首审初步意见,最终结论以维护者复审为准。 本地已把本 PR 三个提交 rebase 到最新 master(4d3b54cba,无冲突,patch-id 与原提交恒等)。验证:tsc 净; P1:
|
复审判定:#1975 建议作者修改,暂不可合在
以下每条结论都由真实路由 + 真实 🔴 P1-a
|
| 变异 | daemon-rename-route 新增 /th /status 用例 |
|---|---|
删掉 lifecycle_daemon deferred 返回 |
咬红(workingDir 断言) |
整个 src/daemon.ts 回退到 master |
咬红 |
只补 P1-a 的最小修复(initialStartPending=false) |
仍绿 ← 缺陷仍在时也绿 |
所以它只钉住了「命令要在钉定目录之后执行」,钉不住「之后这个话题还能用」。建议补两条:
① P1-a:/th /status 后发一条真实任务 → forkWorker 1 次、queuedActivationTail 为空、initialStartPending=false(这条在我加最小修复前必须红);
② P2-a/b:/tw <命令> 后驱动真实 commitRepoSelection → pendingRepoSetup 里不含命令文本、buildNewTopicCliInput 未被调用(empty start),或 raw 场景下 pendingFollowUpInput 为 undefined。
⚪ P3-3 2d512f8bf 揭示的夹具脆弱性
test/new-topic-lark-caller.test.ts 切片执行 daemon 的 ds 字面量,新增的 lifecycleRawOpening 是自由变量 ⇒ 不补 deps 时该文件 10 条用例全红(我实测过)。2d512f8bf 补上了 deps,方向可接受;但更根本的是这段字面量不该读闭包变量——按「测试原则」这条属于需要 seam 的读源码用例,长期应把 ds 构建抽成可导入的函数。至少请在文件里保留一句说明,别让后来人以为这是随手补的 fixture。
建议修法(一处收口)
deferred daemon 命令的情形,让 ds 与既有「默认 /status 预建路径」同形:initialStartPending 从建会话起 false、pendingPrompt/pendingCodexAppText/两个 context 全部为空、skipCharge: true;命令仍在目录钉定(/th)或 journal 落盘(/tw)之后执行,或干脆按 P2-c 对 /cd /close /repo 直接拒绝。这样 P1、P2-a/b/c/d 一起消失,且 handleCommand 看到的是与默认路径一模一样的 command scratch。
影响面
改动只在新话题 slash 入口;/t 与不带变体的写法不变。happy path(/th /teach、/t /goal)我实测正常。但本次泄漏的 pendingCodexAppText 会穿过 pending-repo-journal → commitRepoSelection → codex-app sidecar 开场三处共用路径,属公共层,修完请连同 test/card-handler-repo-select.test.ts 的 raw 冷启动用例一起看一遍。
改了什么
/th(等同/t here)和/tw后面紧跟技能或斜杠命令时(例如/th /teach 讲讲实现),原先会被话题头部解析器当作「已写头部」,然后对未知的/xxxfail closed,消息被拒。这和/t /goal 干活的既有用法不一致。core/topic-header.ts:生命周期变体本身不算「用户写了头部」。只有标题、worktree 或指令出现时,才对未知/xxxfail closed。紧跟的技能或命令照常落进正文,转给 CLI。daemon.ts:冷启动透传只用于forceTopicMode === 'default'。/th和/tw的目录(当前群会话目录或先建的 worktree)只在常规建会话路径里解析,冷启动透传会直接在 bot 默认目录 fork,所以两者都改走常规路径。原来只排除了/tw。影响面
/t及不带生命周期变体的写法行为不变。变体之外又写了标题或指令时,未知/xxx仍然 fail closed。测试验证
新增用例:
/技能、/命令原样落进正文(与/t /goal一致);/xxx仍 fail closed;/th /<passthrough>走常规建会话路径并转发原文。🤖 Generated with Claude Code