feat(env): proxy_env_extra — proxyctl env 额外导出 agent 专用代理变量 - #4
Conversation
omp 的 anthropic-messages transport 只读 PI_PROXY_<PROVIDER> / PI_PROXY, 不读 HTTPS_PROXY,缺了就直连(受限地区 403 Request not allowed)。 新增 proxy_env_extra 配置:列出的变量名由 `proxyctl env` 导出为引擎的 HTTP 代理地址(http://127.0.0.1:<proxy_port>),`env --unset` 一并清除。 默认为空,现有输出不变;输出会被 eval,非法变量名跳过并在 stderr 提示, 与内置代理变量同名的项不重复导出。 替代 #3:不再维护契约文件、生命周期刷新、shell rc 注入与 doctor 规则。
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: 7e0009ff92
ℹ️ 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".
YAML 会把 yes/no/on/off/true/false/null 解析成 bool/None,str() 之后 变成 True/None 能通过变量名校验,于是被导出成 True=… / None=…。 现在列表里的非字符串项跳过并在 stderr 提示加引号;整个值既不是列表 也不是字符串时忽略并提示,不再在迭代时抛 TypeError。
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
背景
omp 18.2.11 的 Anthropic 模型请求走
transport-fetch.ts→ cowork transport,代理只取PI_PROXY_<PROVIDER>/PI_PROXY,不读HTTPS_PROXY。缺这个变量就直连,受限地区返回403 Request not allowed。根因在 omp 上游(transportFetch没有回退到标准代理变量);上游修好之后这项配置可以直接删掉。改动
proxy_env_extra(list 或逗号分隔字符串,默认空)。proxyctl env:在原有输出之后,为每个变量名追加export <NAME>=http://127.0.0.1:<proxy_port>;。proxyctl env --unset:这些变量一起unset。eval,所以变量名必须是合法的 shell 标识符,否则跳过并在 stderr 警告;与内置代理变量同名的项也跳过(避免ALL_PROXY被改写成 HTTP 地址)。config.yaml.example、README 配置示例、explain env、man、CHANGELOG[Unreleased]。与 #3 的区别(替代 #3)
HTTPS_PROXY一样指向引擎端口。引擎停了就是连接被拒(fail-closed),不会删掉变量退回直连。status段和 3 条 doctor 规则;也不按存活情况切到兜底 daemon(环境变量只在进程启动时读取,对运行中的进程做不到 failover)。proxyctl env在--json/PROXYCTL_AGENT=1下的行为不变,仍输出可 eval 的 export 行。兼容性
proxy_env_extra时,proxyctl env/--unset的输出和之前完全一致。cmd_env(config, unset=...)签名不变。验证
uv run pytest -q→ 814 passed。新增 2 条:导出 / 清除的契约;非法变量名不进 stdout、内置变量不被改写。PI_PROXY_ANTHROPIC和非法名PI_PROXY;id):