Skip to content

refactor(chat): share startup options with trusted launchers - #6441

Merged
loopx-agent merged 1 commit into
mainfrom
codex/chat-host-startup-options-20261014
Oct 14, 2026
Merged

loopx-agent merged 1 commit into
mainfrom
codex/chat-host-startup-options-20261014

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Trusted local Chat launchers can drift when they copy CLI argument conversion. An omitted startup timeout is now None, so a copied float(args.startup_timeout_seconds) can fail before the host starts even though the native CLI handles it correctly.

This change exposes chat_server_options beside the native parser and makes the CLI use the same composition. Trusted launchers can reuse it with their locally reviewed factories. Adapter-owned defaults and explicit timeout limits remain intact, along with workspace grants, filesystem restrictions, reaction settings, registry selection and scan paths. The CLI composes options before replacing an existing server, so a conversion failure retains the running host.

Validation:

  • 25 focused tests passed, including real loopback Chat startup with and without an external factory, shared native controller/return ownership, and existing real ACP subprocess timeout negatives.
  • Five before/after CLI scenarios produced identical complete server options.
  • Ruff and the configured mypy checks passed (19 source files).
  • Premerge passed all 5 direct and 14 selected checks, including semantic vocabulary, CLI output budgets, modularization, maintainability and public-boundary validation. The initial semantic check required repository npm development dependencies; it passed after npm ci --ignore-scripts.

Existing custom launchers must adopt the helper from the same installed release as the parser. Transport-owned outage catch-up is a separate follow-up; this PR introduces no message replay or listener. The timeout policy fixed in #6314 remains unchanged.

中文:统一原生 CLI 与可信启动器的启动参数组装,避免复制默认值转换在升级后失配;补默认/显式超时、权限设置、替换前失败及真实本地服务启动回归。私有启动器、运行状态和会话资料不入库。

CI follow-through at head 7a45fda5eb85d3a7aa77122733fd1f15129cb539 against base f713e0f07c571a78a7c4405ab647ba41dbc492ba: the existing pinned-consumer assertion and the three failing browser scenarios (automation-cadence, configuration-backup, explore-composition-owner) reproduce the same failures on both revisions. The six browser runs used separately built packaged assets and the same locked dependencies; the browser failures reach the unchanged Host/origin guard. Separate paired HTTP probes retain that guard: mismatched origins return 403, while aligned requests reach endpoint validation/export. No assertions or permission checks were weakened. These are bounded local comparisons on macOS/Node 24/Python 3.14, not a green Ubuntu/Python 3.11 CI claim; upstream checks remain failed/pending.

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | reasoning_effort=xhigh

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

Exact head: 7a45fda5eb85d3a7aa77122733fd1f15129cb539;完整审阅 5 个路径、+201/-49、1 个 DCO commit。

动机

需要启动本地 Chat 的可信 launcher 维护者,以及沿用原 CLI 的用户。遗漏 startup timeout 时,复制旧转换的 launcher 会在启动前报错;本次可直接复用 CLI 的同一组参数转换,普通 CLI 的默认值与显式权限保持。五组真实 CLI 分派的完整参数在 base/head 一致;真实本地 HTTP 服务及外部 transport 开关用例通过,错误组合不会先替换旧服务。本次只共享启动参数,不实现停机补消息、自动授权、真实模型启动或已安装 App 的采用。

改动思路

原生 CLI 已正确处理省略的 timeout,问题在可信 launcher 复制转换之后可能落后。最小合适边界是把现有 kwargs 组合移到紧邻 parser 的纯 helper,让两类调用者共用;继续逐个修补 launcher 会保留重复知识。helper 不启动服务,不选择外部 provider,也不拥有另一套权限或状态机。普通 CLI 仍走既有 serve_chat,只把“组合参数”放到替换旧服务之前,失败时保留原实例。Python 在这里承担既有 CLI 适配,未新增平行控制面决策 owner。

具体改动

关键代码讲解

  • chat_server_options 保留 omitted None、显式 timeout 的 0.1 下限、180/900 的 idle/hard 默认、registry/scan/assets 路径和 workspace grant/filesystem scope/private reactions 等参数。非 chat Namespace 直接拒绝;结果可绑定现有 serve_chat 签名。
  • chat 分派 先完整组合,再进行显式 replacement,最后调用原 serve_chat。原错误 payload owner 保留。
  • 失败反例 断言组合失败没有 replace/serve;另一个真实 loopback 测试通过 parser/helper 启动 HTTP 服务,并验证 transport factories 开关、共享 store/binding 和关闭路径。文档的同版本 parser/helper 示例也检查了默认 registry 可构造 Path。

独立规格依据为 docs/reference/protocols/host-integration-surface-v0.md,修订 f713e0f07c571a78a7c4405ab647ba41dbc492ba,而非本 PR 新增段落自证。原表 Loopback server adapter 的 CLI 等价权限限制已实现;CLI fallback 的原生确定路径已实现。实际补消息和会话回放不在这个启动组合切片内。

对主干的风险

最危险的回归是漏传权限、把 None 变成强制数字,或在验证参数前杀掉旧实例。真实 CLI 分派五组输入在固定 fixture 下比较了全部参数,只归一临时 HOME 与物理 checkout 位置,没有丢弃权限或诊断字段;base/head 完全一致且不创建 runtime。base 原有 transport/timeout/isolation 21 项通过,head 加启动选项后共 30 项通过;真实 HTTP/外部 transport off/on 的测试独立于参数捕获 stub。Ruff、配置范围 mypy 19 文件通过;native canary 的 5 项 direct、14 项 selected 均通过,零 failure/hold。新参数 helper 的无效输入也有无替换、无启动反例。

语义与 CI 对齐

本次复用 serve_chat 参数合同,没有新 Enum/Literal/闭合集合或 persisted vocabulary。changed-from advisory 覆盖两处 Python 来源、未发现新载体,完整 semantic smoke 也通过;空 advisory 不构成语义等价证明。没有查询 GitHub CI。作者较宽的浏览器/宿主验证限制仍保留,本次没有把它们宣布修复;真实模型、上游 ACP、安装态采用与 outage catch-up 均未验证。

我的整体评价

APPROVE。long_horizon 改善在于后续启动选项有一个真实 owner,减少复制漂移;user_experience 在既有入口保留默认与权限,可信 launcher 得到可复用路径,没有增加设置步骤。整个 PR 的成本与已证实的维护缺口相称,相关重构已通过删除 inline 重复实现完成,不需要新框架。此结论限于当前 exact head 的参数组合和既有 transport 回归,不是消息送达、模型能力或整体宿主资格的通过,也不授予合并权限。

English verdict: APPROVE - 7a45fda; shared startup composition preserves native CLI options and authority, with 30 head tests, 21 baseline tests, five full-map parity cases and local canary passing. Installed/model/replay qualification remains outside scope.

@loopx-agent
loopx-agent merged commit 3593cf1 into main Oct 14, 2026
24 of 37 checks passed
@loopx-agent
loopx-agent deleted the codex/chat-host-startup-options-20261014 branch October 14, 2026 23:26
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