Repository navigation
Conversation
上游 deepcoldy#1969 把 lark-cli 应用绑定改为按 bot 配置 larkToolBinding 开关(默认开), 与本分支的后台会话绑定改在同一段: - usesLarkToolBinding 采用上游语义(resume 重新评估开关),准入条件保留 larkToolIdentityEnabled,让本地 headless runner 也能绑定本应用身份 - IPC 身份路由同时校验 headless 准入与 bot 的 larkToolBinding 开关 - 测试合并两边用例:headless × larkToolBinding 组合;headless 恢复会话随开关重建绑定 Co-Authored-By: Claude Code <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Co-Authored-By: Claude Code <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
… binding Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
…n bot Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
Co-Authored-By: Claude Code <[email protected]>
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: b648054cdb
ℹ️ 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".
| * getBotClient (which only throws for apiOnly) cannot. Accepts a live | ||
| * DaemonSession or a stored Session record. Never throws. */ | ||
| function sessionTransportDisabled(s: { chatId?: string; larkAppId?: string }): boolean { | ||
| if (isHeadlessSessionChatId(s.chatId)) return false; |
There was a problem hiding this comment.
Preserve the shared no-transport guard for headless sessions
For a CLI-created headless session, this bypasses the shared transport guard for every IPC route, not just lark-tool-identity, and also skips the apiOnly check. A fixed-clock probe using the actual /project handler and real coordinator/store reproduced the regression: init now persists a project under the synthetic headless_* chat ID and attempts to send a Lark card, whereas the parent rejects it with no_feishu_transport before writing anything. The /resume handler likewise starts attempting chat lookups and sends against that synthetic ID. Keep the headless exception local to tool-identity eligibility and its post-await recheck; this shared helper must continue reporting that headless sessions lack chat transport.
AGENTS.md reference: AGENTS.md:L161-L161
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 698a895. Shared no-transport behavior is restored for headless IPC routes, with the exception scoped only to tool identity; prompt tests now compare the selected policy/template instead of copied prose. Focused suites: 92/92; build and diff-check pass.
There was a problem hiding this comment.
Follow-up CI regression fixed in 3c14931: the lark-tool-identity route now revalidates valid CLI-headless provenance after async token resolution, while ordinary IPC routes retain the shared no-transport guard. Focused identity/headless/API-only suites: 131/131; build and diff-check pass.
| }).content; | ||
| for (const prompt of [system, inline, firstRun]) { | ||
| expect(prompt).toContain(appId); | ||
| expect(prompt).toContain(locale === 'zh' ? '没有真人授权通道' : 'no human authorization channel'); |
There was a problem hiding this comment.
Test headless prompt selection without pinning its prose
AGENTS.md explicitly says “不钉文案和文档措辞”, but this new assertion hard-codes the Chinese and English explanatory wording. Rephrasing “no human authorization channel” as “no channel for human authorization” leaves the bot-only policy unchanged but makes these tests fail; the same prose dependency is duplicated in the new headless integration tests. Verify that the builders select the headless policy/template without copying its human-language wording, and retain the existing behavioral bot-token-success/user-token-denial checks.
AGENTS.md reference: AGENTS.md:L149-L149
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 698a895. Shared no-transport behavior is restored for headless IPC routes, with the exception scoped only to tool identity; prompt tests now compare the selected policy/template instead of copied prose. Focused suites: 92/92; build and diff-check pass.
There was a problem hiding this comment.
Follow-up CI regression fixed in 3c14931: the lark-tool-identity route now revalidates valid CLI-headless provenance after async token resolution, while ordinary IPC routes retain the shared no-transport guard. Focused identity/headless/API-only suites: 131/131; build and diff-check pass.
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. |
Co-Authored-By: Claude Code <[email protected]>
|
自动评审初步意见,最终以维护者审阅为准。 分支与当前 master(4d3b54cba)本地合并无冲突,以下问题在 PR head 698a895 原样复现(未改作者代码)。 P1:headless 的 bot 凭据端到端拿不到,PR 自带 2 个测试红
根因:698a8955 把 修法注意不能直接复用入口处捕获的 const stillValidSession = ds
? (findActiveBySessionId(params.sessionId) === ds && ds.session.status === 'active'
&& (ds.session.headless?.source === 'cli'
&& isHeadlessId(ds.session.headless.id)
&& headlessChatId(ds.session.headless.id) === ds.chatId
|| !sessionTransportDisabled(ds))
&& ds.larkAppId === bot.larkAppId)
: (/* detached 分支:headless 永远有 ds,维持原样即可 */);P2:daemon 侧的 binding 镜像判断没同步,和 worker 新口径分叉
P3(nit)
其余部分核对过:伪造 |
|
自动评审增量意见(针对新 head 已确认修复 ✅
新阻断项 P1:真 CLI helper 在 PATH 命中包装器时整文件炸掉
本仓库文档 对照同一台机器上当前 master:包装器形态下文件能被正常收集并执行(未安装时则温和 skip),不会整文件 Error。CI 上因为没有装 lark-cli 而全程绿——绿 CI + 按文档装过 CLI 的贡献者本地全红,比较难发现。 建议修法(保持"契约测试只认真原生二进制"的意图,只收敛 throw 的范围):
P2 仍未处理
P3(可选)
当前 head CI 首跑 10 项全绿,但 helper 问题 CI 结构上看不到,需要本地按上面的 PATH 形态自测。作者分支我这边不可写,改完 push 后会按新 head 增量重审。 |
|
补充两点(针对新 P1 修法的落地细节,避免改一半多一轮):
|
|
关于上面 P2 的修法,再补一条关键约束(避免按字面改引入反向回归): 不要只把 我用仓库里的真实纯函数做过探针(headless 来源合法的会话):
一旦 daemon 把 ZDOTDIR 锁成 建议的修法:把 worker 的完整判定抽成一个纯函数,worker 与 daemon 调同一个事实源,例如: // core/lark-tool-binding.ts
export function larkToolBindingEffective(config: BindingConfig): boolean {
return !(config.workflow || config.adoptMode || config.existingAppServerEndpoint
|| isRemoteBackendId(config.backendType)
|| !larkToolIdentityEnabled(config));
}
// usesLarkToolBinding = larkToolBindingEffective(config) && config.larkToolBinding !== false
|
|
对上一条评论的一处更正,以及 P2 修法的两个落地细节: 更正:remote-runner 那行我说早了
但这是 master 既有缺陷、不是本 PR 引入:本 PR 对 P2 修法的两个落地细节(随上一条的共享纯函数建议一起)
本 PR 范围内的 P2 定性不变(一致性/可观测性,非安全项)。 |
|
对上一条 P2 表述的更正(方向修正 + 第二个展示落点),请以这版为准: 更正:展示侧是「误报接管」,不是「漏报」
即 Dashboard 机器人页告诉运维「ZDOTDIR/BASH_ENV 已被 botmux 接管、你的配置被忽略」( 第二个落点:liveSessionEnvView 同屏用两个 ctxsession-env-host.ts:443 用无 facts 的 对修法的影响:光抽纯函数不够,两个展示调用点也要处理
定性仍是一致性/可观测性问题,非安全项;#2736 的 bot/冻结后端不一致是 master 既有问题,不在本 PR 范围。 |
|
P2 范围口径更新(本条收敛前面第三~六条评论里 P2 的具体要求,以免要求过多): 双审用生产纯函数把各形态跑通后,P2 按归属拆成两块: P2a(本 PR 必修):daemon 合成口径与 worker 对齐把 worker 的完整绑定判定抽成共享纯函数 这是本 PR 的 headless 新能力直接造成的唯一一处 worker/daemon 口径分叉,且有实际症状:按当前代码,headless 会话用户配的 P2b(建议,非本 PR 阻断):两个展示调用点
最终待办口径
|
|
补充 P2a 的一条验收断言(避免只按"展示不再误报"验收而漏掉值确实不下发这半): headless 合法来源的会话,P2a 修完后
即这两个键在合成结果里"既不在 set、也不在 unset"。对照组(headless + adoptMode / existingAppServerEndpoint / remote 冻结后端)则保持用户值仍在 composed.set。 |
|
补一条上一条 P2a 验收断言的用例边界:「ZDOTDIR/BASH_ENV 既不在 set 也不在 unset」要覆盖 三种 bot 配置,否则只测
对照组(headless + adoptMode / existingAppServerEndpoint / remote 冻结后端,binding OFF):用户在 |
test/trigger-user-shell-env.test.ts 冲突按两边并集解:new Function 形参保留本 PR 的 perBotInjectEnv / sandboxRequested / effectiveResume,并追加 master 的 isMessageListenerTaskAnchor;调用处保留本 PR 的 cliId / wrapperCli / PATH 实参, 末尾追加 isMessageListenerTaskAnchor。两边用例全部保留。 Co-Authored-By: Claude Fable 5 <[email protected]>
|
感谢 @wzono 的这份修复!本 PR 的改动已由维护者在 #3180 接管并合入 master(squash 提交 fd494d9,保留了你的 Co-authored-by 署名)。 接管时在你原有提交的基础上做了:同步最新 master 并解决冲突;让 daemon 侧的 session-env 锁判断与身份存储模型判断都识别可信后台会话,与 worker 端的 Lark 工具绑定判断保持一致;补了对应的回归测试。 留作后续跟进的点:
因此关闭本 PR,再次感谢! |
可信后台会话在调用 Lark 工具时,原先会落到机器默认应用;直连 TraeX 还会重新建立工具进程的 PATH,使受管工具入口失效。本改动为符合来源校验的持久后台会话绑定本应用身份,并在未使用 wrapperCli、未启用 sandbox 的直连 TraeX 会话中显式保留受管工具目录及原有 PATH 顺序。
后台会话仍独立运行。用户凭证不提供给后台会话;API-only、远程后端、workflow、adopt 及旧未绑定恢复沿用既有边界。PATH 追加仅作用于上述直连 TraeX 条件;Codex、网关、wrapperCli 与 sandbox 路径不扩展。
验证:最终跟进改动的 42 项定向检查、13 项实际 worker 集成检查通过;更广的 11 文件 / 291 项检查、构建及 diff check 通过。独立复核另运行 55 项定向与集成检查,通过。较早身份绑定改动的 306 项检查属于不同测试集合。两套实际原生 TraeX 后台会话已通过普通工具调用解析受管入口并确认应用身份,本地账本与白板读取成功;目标文档均返回资源查看权限拒绝,未声称文档发布或完整同步验收通过。
该修复已在受控宿主部署并确认服务归属与进程身份;公开 PR 仍为草稿、未合并。这里只修复后台工具身份和命令解析,不包含模型代理连接或重启后未结束 turn 的恢复修复。