@cocorograph/hub-agent 0.7.100 → 0.7.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -65,8 +65,40 @@ export class CodexAppServerClient extends EventEmitter {
|
|
|
65
65
|
// サブコマンド (`app-server`) より前に置く必要がある(`codex app-server --help`
|
|
66
66
|
// にはこのフラグが出ない = サブコマンド固有オプションではないため)。
|
|
67
67
|
const bypassHookTrust = process.env.HUB_CODEX_BYPASS_HOOK_TRUST !== "0"
|
|
68
|
+
// sibling 連携 env 注入 (2026-07-23): app-server プロセス env には siblingEnvFor が
|
|
69
|
+
// COCKPIT_SIBLING_TOKEN/CWD/SELF_KIND を載せている (codex-stream-bridge.mjs)。だが codex の
|
|
70
|
+
// **code-mode exec (tools.exec_command)** がモデル生成コマンドを実行する際、これらは
|
|
71
|
+
// シェルに渡らない (2026-07-23 実測: rollout で `env|grep COCKPIT_SIBLING` が空・SELF=[])。
|
|
72
|
+
// classic `codex exec` は inherit=core でも通すが、app-server チャットが使う code-mode 経路は
|
|
73
|
+
// 継承ベースが異なり COCKPIT_* を落とす。結果 codex-as-reviewer の返信 `cockpit_orch.py send`
|
|
74
|
+
// が「SELF_KIND 環境変数が無い」で fail-closed になり cross-review の返信が不達になっていた。
|
|
75
|
+
//
|
|
76
|
+
// 修正: `shell_environment_policy.set.<VAR>=<値>` で 3 変数を **無条件注入** する
|
|
77
|
+
// (inherit/exclude フィルタや code-mode の env 剥がしに関係なく command env に入る。
|
|
78
|
+
// 2026-07-23 実測で **code-mode exec (custom_tool_call/exec_command) 経路でも** 注入値が
|
|
79
|
+
// コマンドシェルに出現することを確認済み = 実際に壊れていた経路で有効)。値は this.env (= siblingEnvFor が
|
|
80
|
+
// 生成した本セッションの実値) から取るので静的化されず正しい per-session token/cwd になる。
|
|
81
|
+
// inherit=all を選ばない理由: code-mode に効く保証が無い (core 継承下で全消しを実測) ため。
|
|
82
|
+
// token が argv (ps) に載るが、既に app-server/code-mode-host の env に同値があり同一ユーザー
|
|
83
|
+
// 可視・cwd スコープ・短命なので露出クラスは増えない。HUB_CODEX_SIBLING_ENV_PASSTHROUGH=0 で opt-out。
|
|
84
|
+
const siblingEnvPassthrough = process.env.HUB_CODEX_SIBLING_ENV_PASSTHROUGH !== "0"
|
|
85
|
+
const spawnEnv = this.env || process.env
|
|
86
|
+
const siblingSetArgs = []
|
|
87
|
+
if (siblingEnvPassthrough) {
|
|
88
|
+
for (const key of [
|
|
89
|
+
"COCKPIT_SIBLING_SELF_KIND",
|
|
90
|
+
"COCKPIT_SIBLING_CWD",
|
|
91
|
+
"COCKPIT_SIBLING_TOKEN",
|
|
92
|
+
]) {
|
|
93
|
+
const val = spawnEnv[key]
|
|
94
|
+
// TOML 文字列としてクォート (パスの空白/特殊文字対策)。値に " は含まれない
|
|
95
|
+
// (hex token / パス / "codex")。1 つの argv 要素として渡すのでシェル再解釈は無い。
|
|
96
|
+
if (val) siblingSetArgs.push("-c", `shell_environment_policy.set.${key}="${val}"`)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
68
99
|
const args = [
|
|
69
100
|
...(bypassHookTrust ? ["--dangerously-bypass-hook-trust"] : []),
|
|
101
|
+
...siblingSetArgs,
|
|
70
102
|
"app-server",
|
|
71
103
|
"--stdio",
|
|
72
104
|
]
|