Repository navigation
fix(session-env): identity 锁按会话实际启动的后端判定,不再误删远程后端会话的 ZDOTDIR/BASH_ENV - #3056
Merged
Merged
Conversation
deepcoldy
requested review from
47seek,
LucasIcarus,
xiaoxueSunn and
xiongz-c
as code owners
November 7, 2026 12:14
|
🚀 Released in v3.59.0 |
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.
症状
bot 配置的后端与会话实际启动的后端不一致时(例如
backendType: 'pty'的 bot,其会话被固定到remote-runner),用户在会话环境里配置的ZDOTDIR/BASH_ENV被静默从合成 env 里删掉,而这个会话的 worker 根本没有安装受管的 lark wrapper。根因
两处「是否远程后端」的判定用了不同的输入:
usesLarkToolBinding用 init 带来的会话后端(remote-runner→ 不装 wrapper);resolveSessionEnv虽然拿到了本次启动的backendType,但传给sessionEnvLockContextForBot的仍是 bot 配置,远程闸读的是bot.backendType(pty→ 判定 identity 锁定),composeSessionEnv于是删掉了这些键。修法
resolveSessionEnv算锁时把 bot 输入的backendType换成本次启动的backendType(即resolveSessionEnvForSession传入的会话后端),与 worker 的判定一致。反方向(remote-runnerbot 的会话在本地后端启动,worker 会装 wrapper)也随之一致。未改:
botSessionEnvView、保存校验)没有具体会话,继续用 bot 配置;remote_backend,不涉及此问题;unwrapped,不加锁;网络策略预检不读这些键。验证
test/session-env-resolve.test.ts新增用例:ptybot +remote-runner启动时ZDOTDIR/BASH_ENV保留;remote-runnerbot +tmux启动时仍被锁。npx vitest run test/lark-tool-binding.test.ts test/restart-live-worker-lark-tool-binding.test.ts test/session-env-api.test.ts test/session-env-backends.test.ts test/session-env-editor-ui.test.ts test/session-env-host.test.ts test/session-env-resolve.test.ts test/session-env-store.test.ts test/session-env-worker.integration.test.ts test/session-env.test.ts test/worker-lark-tool-binding.integration.test.ts test/workflow-v3-ephemeral-pool.test.ts:通过。test/session-env-stamp-reattach.integration.test.ts在本机因 tmux socket 路径过长(File name too long)无法启动 tmux,未改动的 origin/master 上同样失败,与本改动无关。npx tsc --noEmit -p .、bun run build:通过。Fixes #2736