Skip to content

fix(scripts): 打开托盘前去掉 Claude Code 会话变量 - #600

Merged
TimWongUp merged 2 commits into
mainfrom
fix/open-tray-strip-claude-env
Dec 4, 2026
Merged

TimWongUp merged 2 commits into
mainfrom
fix/open-tray-strip-claude-env

Conversation

@TimWongUp

Copy link
Copy Markdown
Owner

Summary

从 Claude Code 会话里运行 install_local.sh 或 preview_tray.sh 时,托盘会继承这个会话的变量(CLAUDE_CODE_SESSION_ID、CLAUDE_CODE_ENTRYPOINT、CLAUDE_PID 等),托盘对 Claude 的模型探测因此失败,Claude Code 卡片显示「读取失败」。open_tray.sh 原本已经会去掉 T3 和 agy 的会话标记,这次把 Claude Code 的标记也一并去掉。

 unset TMPDIR TEMP TMP CLAUDECODE ELECTRON_RUN_AS_NODE
+unset CLAUDE_PID CLAUDE_EFFORT CLAUDE_AGENT_SDK_VERSION
-/^(ANTIGRAVITY|T3_ACP_MCP|T3CODE)_…/
+/^(ANTIGRAVITY|T3_ACP_MCP|T3CODE|CLAUDE_CODE)_…/

Evidence

  • Before: 在本会话里用 install_local.sh install 装正式版后,ps eww <tray> 能看到 12 个 CLAUDE_* 变量,托盘的 Claude Code 卡片显示「读取失败」。
  • After: 在同一个 shell 里(这个 shell 本身有 12 个 CLAUDE_*)运行 sh scripts/open_tray.sh --env HOME=… --env AGENTNAVE_DATA_DIR=… /Applications/AgentNave.app,新托盘进程里 CLAUDE_*、T3CODE_* 都是 0 个。

Merge Danger

Door: two-way

Blast Radius: 本机脚本

只影响开发用的打开托盘脚本(安装和预览都走它)。从桌面启动时本来就没有这些变量,去掉后的效果和桌面启动一样。

🤖 Generated with Claude Code

TimWongUp and others added 2 commits December 4, 2026 18:24
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@TimWongUp

Copy link
Copy Markdown
Owner Author

评审记录

  • 锁定:head f581ff68618cc9078efd3f075cd9bc3d3dd34694(首审时为 431076e0d3b9c12c50287fb5ac356167e126afac,之后只追加了 R1 的整改);base 取与 main 的合并基 9fb34fa577a27f4d12692811931889c7905b9e2e。
  • 深度:快审。只改一个本机开发脚本,改动局部、可回退。唯一需要排除的失败假设是:误删用户自己配置的 Claude 变量。
  • 槽位:review-quick,来源是 App 评审槽位(T3)。实际由 codex / gpt-6.1-terra(high)在独立线程里评审,与作者(Claude Opus)是不同模型。定向复核用同一槽位,另开新任务。
id 判定 处理 结果
R1 按 CLAUDE_CODE_* 前缀整批清理,会误删用户配置(如 CLAUDE_CODE_USE_BEDROCK、CLAUDE_CODE_OAUTH_TOKEN) CONFIRMED(本次引入) 修复:改为显式 unset HOST_SESSION_ENV 清单 定向复核:已解决;15 个变量与清单一一对应
  • 检查:sh -n 通过。实机验证:在带 12 个 CLAUDE_* 的 shell 里,用首审版本的脚本重开正式版,托盘进程里 CLAUDE_* 为 0。整改后做了试跑:CLAUDE_CODE_USE_BEDROCK 保留,会话标记全部去掉。
  • 剩余风险:脚本里的清单和 HOST_SESSION_ENV 是两份,靠注释关联;以后清单有变化,需要两处一起改。

@TimWongUp
TimWongUp merged commit c5c838b into main Dec 4, 2026
8 checks passed
@TimWongUp
TimWongUp deleted the fix/open-tray-strip-claude-env branch December 4, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant