Conversation
无头服务器需要 --no-sandbox/--headless/--disable-gpu, 但每个部署点都手改 gateway/dev/run-gateway.cjs 会让本地源码与线上快照持续漂移. 改为统一的 OPENCODEX_HEADLESS_ELECTRON 开关, launcher 与 dev runner 共用同一个 helper, 默认关闭时行为与桌面端完全一致.
yorkane
force-pushed
the
codex/headless-env-gate
branch
from
September 17, 2026 04:39
2debc7e to
1c63704
Compare
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.
问题
在无外网、无 GPU、无 X 显示服务的服务器上跑隐藏 Electron runtime,必须传 --no-sandbox --headless --disable-gpu:缺 --no-sandbox 时 Chromium 在 root 或无 user namespace 环境直接启动失败;缺 --disable-gpu 时 GPU 进程 FATAL 并让 gateway 收到 SIGTRAP 退出。
此前每个部署点都要手改 gateway/dev/run-gateway.cjs(本地源码树)才能拿到这组参数,线上快照与仓库源码长期漂移,升级版本时靠人肉重打补丁。
改动
默认(变量缺省或非真值)返回空数组,桌面端命令行与改动前逐字节一致;只有显式设置才追加三个参数。
关于修改点
本 PR 未新增修改点,原因:这组参数必须在 Electron app ready 之前进入 argv,而 gateway 进程里兼容性服务要到 createGateway(gateway/runtime/server.cjs:819)才创建,gateway/runtime/main.cjs 调用 configureHiddenRuntimeCommandLine 时服务尚不存在,拿不到 honest 的命中上报通道。仓库里同族的两个 Chromium 开关点 gateway.runtime.chromium.hidden-services 与 gcm-profile 同样是"仅目录声明 + point-refs 引用、不上报命中"(全仓 grep 这两个 ref 只出现在 gateway/runtime/modification/point-refs.cjs:13-14)。若希望保持一致性再补一个 catalog-only 点,我可以在本 PR 追加;只是那会让 #57 与 #58 同时把同一批硬编码点数从 103 抬到 104,合并时产生不必要的冲突。
验证
241.t 生产实例(gateway 2.1.0 + codex-desktop 26.908.40834)以 OPENCODEX_HEADLESS_ELECTRON=1 运行:登录后完整工作台加载,NRestarts=0,journal 无 SIGTRAP。
独立克隆全新构建跑 pnpm test:440 tests / 434 pass / 6 fail,失败集合与基线(f6fd79c)逐字相同。