hapi icon indicating copy to clipboard operation
hapi copied to clipboard

支持codex的多profile模式

Open gsoyond opened this issue 8 months ago • 2 comments

What feature would you like to see?

codex配置文件中可以配置多个profile,指定不同的模型和思考量级等参数,然后通过 codex --profile=profile_name 来使用。 希望hapi能够支持给codex配置profile参数。

Additional information

No response

gsoyond avatar Mar 26 '26 11:03 gsoyond

目前代码里,这个能力只在一部分场景下成立,完整的 profile 支持还没有找到。

本地终端直接运行 hapi codex 时,未识别的参数会被收集到 codexArgs,后续继续传给 codex 进程,所以像 hapi codex --profile=profile_name 这种本地启动路径按代码看是会透传的。

但 HAPI 的远程/网页新建会话路径目前没有 profile 字段。Web 端创建会话时只会提交 agent、model、modelReasoningEffort、yolo、sessionType、worktreeName、effort;Hub 端的 /machines/:id/spawn 也只校验这些字段;Runner 启动 codex 时同样只拼接 --model、--model-reasoning-effort、--yolo 等参数。除此之外,Codex remote launcher 还明确写了:codexArgs 在 remote mode 会被忽略。

Relevant code:

  • cli/src/commands/codex.ts:40 - hapi codex 会把未识别参数放入 unknownArgs,再赋给 codexArgs
  • cli/src/codex/codexLocal.ts:59 - 本地启动时会把 codexArgs 继续传给 codex
  • web/src/components/NewSession/index.tsx:246 - Web 新建会话只整理 model / effort / modelReasoningEffort 等已知字段
  • web/src/hooks/mutations/useSpawnSession.ts:6 - Web spawn 输入类型里没有 profile
  • web/src/api/client.ts:386 - /spawn 请求体没有 profile
  • hub/src/web/routes/machines.ts:7 - Hub 的 spawnBodySchema 没有 profile
  • cli/src/runner/run.ts:362 - Runner 远程启动只拼接固定参数,没有 --profile
  • cli/src/codex/codexRemoteLauncher.ts:97 - remote mode 下 codexArgs 会被忽略

Need more info:

  • 你希望支持的入口是哪个:Web 新建会话、hapi runner 远程启动,还是两者都要?
  • 你期望的形式是只传 --profile=<name>,还是还需要在 Web UI 里提供 profile 选择器?

HAPI Bot

github-actions[bot] avatar Mar 26 '26 11:03 github-actions[bot]

主要是希望能在web端新建会话的时候可以为codex指定profile名称,形式不限,不过可以先就让用户手动输入。

gsoyond avatar Mar 27 '26 00:03 gsoyond