Repository navigation
Conversation
Task/Agent 子代理运行期间投递的输入写入 <sid>/subagents/*.jsonl,主会话 jsonl 在子代理返回前没有 user 事件,送达确认会误判失败。指纹查找新增 includeSubagentTranscripts(仅用于布尔判定,不会把子代理文件钉为监听目标)。 Co-Authored-By: Claude Code <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
73a136e to
9d6eac0
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: 9d6eac0f65
ℹ️ 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".
| const subFull = join(subDir, subName); | ||
| try { | ||
| const subSt = statSync(subFull); | ||
| if (subSt.isFile()) addCandidateFile(subFull, subSt.mtimeMs); |
There was a problem hiding this comment.
Distinguish forwarded input from subagent task instructions
When a subagent's initial role:user task instruction falls within the 60-second timestamp floor and contains the next Lark message's fingerprint, this scan treats that model-generated instruction as proof that the new input landed. A fake-clock probe using the real adapter and scanner reproduced this with sendBracketedPaste() returning false and no submit key sent: the parent's recheck() returned false, whereas this version returned true, causing settleDeferredSubmitConfirmation() to choose suppress-confirmed. This silently hides a genuine delivery failure. For child transcripts, require a newly forwarded-user-message record or an equivalent submission-specific boundary rather than accepting arbitrary task instructions as receipts.
AGENTS.md reference: AGENTS.md:L160-L161
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 28f6a89. Subagent transcript receipts now require Claude forwarded-message metadata (isMeta: true); arbitrary initial task instructions can no longer confirm a Lark input. Added a behavioral regression and mutation check. Focused suite: 144/144; build and diff-check pass.
Co-Authored-By: Claude Code <[email protected]>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 28f6a89038
ℹ️ 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".
| const subDir = join(projectDir, sid, 'subagents'); | ||
| mkdirSync(subDir, { recursive: true }); | ||
| const subagent = join(subDir, 'agent-aaaaaaaa.jsonl'); | ||
| writeFileSync(subagent, '{"type":"user","message":{"role":"user","content":"repeatable short prompt"}}\n'); |
There was a problem hiding this comment.
Use eligible forwarded events in the exclusion-test fixtures
Both this fixture and the non-session-directory fixture below omit isMeta: true, so jsonlTailMatchFingerprint() rejects them independently of the guards the tests are intended to exercise. In temporary copies running the real scanner, independently removing the minMtimeMs filter or SESSION_SUBDIR_RE check leaves both tests green; adding isMeta: true makes the respective mutation fail. Use otherwise eligible forwarded-message fixtures and positive controls so these tests actually protect the mtime and directory boundaries and satisfy the mutation-check requirement in AGENTS.md.
AGENTS.md reference: AGENTS.md:L162-L162
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 9a49411. The exclusion fixtures now use otherwise eligible isMeta forwarded events plus positive controls. Mutation checks confirm removing minMtimeMs or the UUID session-directory guard fails the targeted tests. Focused suite: 144/144; diff-check passes.
Co-Authored-By: Claude Code <[email protected]>
自动评审初步意见:1 个建议修复的问题(P2)+ 2 个收口建议感谢这个 PR,架构和守卫写得很干净。两轮评审(含一轮独立复审)在机械面上全部认可:开关默认关闭、唯一开启点是 P2:新扫描解不出 CLI 实际写下的那种记录,修复对真实现象很可能不生效
// 顶层 type 是 attachment,没有 message.role;正文在 attachment.prompt
{
"type": "attachment",
"timestamp": "2026-11-03T08:05:00.000Z",
"isSidechain": true,
"attachment": {
"type": "queued_command",
"prompt": "<用户原文>",
"origin": { "kind": "human" },
"isMeta": true
// 主会话完整形状还会带 commandMode: "prompt"
}
}代码路径在 CLI bundle 里可以对上: 本机真实数据普查(866 个项目目录、47 个子代理转录、1078 个会话转录):
即:本 PR 现在认的 建议修法(已按此写过临时补丁验证:两种 human 形状均正确命中;真实 task-notification 行、缺 isMeta 的 human 行、isMeta 但 origin 非 human 的行均正确返回 null;144 条现有测试双腿仍全绿):在
两个实现时请注意的点:
P3-1:
|
更正上一条评审意见中的两处(以本条为准)接续上一条评论(#issuecomment-6599129637),复审对建议谓词做了二次核验,发现我上一条里有两处错误,作者实现时请以本条为准: 更正 1:新分支必须靠独立的新 opt-in 与既有调用方隔离(不能靠 queue-op 差异)我上一条写"worker.ts:8987 的会话切换扫描不传 实测后果:若 attachment 解码分支不加新开关直接生效,用不开启子代理扫描的选项(即上述三个调用点的等价形态)去扫一个含人类 因此 attachment 分支必须挂在一个新的显式选项后(建议 更正 2:谓词中去掉
|
| 输入记录 | 结果 |
|---|---|
真实人类形状(commandMode:'prompt'、无 isMeta),子代理文件 |
命中 |
PDr flush 形状(isMeta:true、无 commandMode、origin:human),子代理文件 |
命中 |
| task-notification(commandMode + origin 双重排除) | null |
| 无 origin / origin:unclassified,子代理文件 | null |
| 真实人类形状,顶层 sibling 文件、不开新开关(8987/1576/1615 形态) | null(不会顶掉监听目标) |
既有 144 条测试双腿(bun:test + vitest)在该补丁下仍全绿。上一条的其余内容不变:P3-1 仍建议顺手收口——attachment 族成为权威路径后,子代理候选的 user 分支可直接不再接受任意 isMeta:true 文本(或收紧为 Tje 前缀),消除"开场指令含同前缀 + 真投递失败"被静默确认的窄窗口;P3-2(queue-operation 分支在子代理候选上无边界)仍建议处理;补可复现实证的请求不变。仍是自动评审初步意见,最终以维护者审阅为准。
|
感谢这个修复!本 PR 的完整方案已由维护者通过 #3182 合入 master(squash 提交 3f6ab73,保留了你全部 4 个原始提交的署名),本 PR 随合入自动关闭。 合入版本在你原有改动的基础上,按评审意见补齐了两点:
留两个已知的后续方向(不影响本次合入):
欢迎继续贡献。 |
改了什么
Task / Agent 子代理运行期间,用户在飞书发的新消息会被 Claude Code 投递给子代理,写进
<projectDir>/<sid>/subagents/*.jsonl("The user sent a new message while you were working: …")。主会话 jsonl 在子代理返回前没有对应的 user 事件,送达确认只扫描顶层文件,于是误报submit_unconfirmed,尽管提示其实已经送达并在执行。JsonlFingerprintSearchOptions新增includeSubagentTranscripts。开启后额外扫描会话 uuid 目录下一层的subagents/*.jsonl。只匹配 uuid 形态的目录,不遍历其它嵌套目录。jsonlTailMatchFingerprint,顶层与 subagent 文件共用同一套事件解码规则:role:user 文本、可选的 queue-operation enqueue、空白归一化、逐事件时间戳下限。影响面
services/claude-transcript.ts、adapters/cli/claude-code.ts。subagents/,每个文件最多读尾部 1MB,与顶层扫描一致。测试验证
新增用例:
minMtimeMs;🤖 Generated with Claude Code