fix: 接入 dsflash-go model catalog
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
# v0.1 Codex Stdio Backend/Profile 规格
|
||||
|
||||
Codex stdio backend 是 AgentRun `v0.1` 的第一真实 Code Agent backend kind。它用于证明 runner、backend adapter、Kubernetes Secret projection、真实 provider 调用、event normalization 和 terminal status 的完整闭环。`v0.1` 在同一个 backend kind 下支持 `codex`、`deepseek` 与 `minimax-m3` 三个 profile;三者共享 Codex CLI app-server stdio 协议,只通过 profile/config/SecretRef 隔离上游和模型。
|
||||
Codex stdio backend 是 AgentRun `v0.1` 的第一真实 Code Agent backend kind。它用于证明 runner、backend adapter、Kubernetes Secret projection、真实 provider 调用、event normalization 和 terminal status 的完整闭环。`v0.1` 在同一个 backend kind 下支持 `codex`、`deepseek`、`minimax-m3` 与 `dsflash-go` 四个 profile;四者共享 Codex CLI app-server stdio 协议,只通过 profile/config/SecretRef/model catalog 隔离上游和模型。
|
||||
|
||||
## 在系统中的职责划分
|
||||
|
||||
- 作为 `backendProfile=codex`、`backendProfile=deepseek` 与 `backendProfile=minimax-m3` 的共同具体实现。
|
||||
- 作为 `backendProfile=codex`、`backendProfile=deepseek`、`backendProfile=minimax-m3` 与 `backendProfile=dsflash-go` 的共同具体实现。
|
||||
- 使用真实 Codex/Codex-compatible 配置执行最短 turn,不使用 fake provider 作为综合联调通过证据。
|
||||
- 消费 Kubernetes Secret projection 提供的 profile 专属 Codex `auth.json` 与 `config.toml`。
|
||||
- 消费 Kubernetes Secret projection 提供的 profile 专属 Codex `auth.json`、`config.toml` 和 profile-local `model-catalog.json`。
|
||||
- 把 Codex 输出归一化为 AgentRun 标准 events 和 terminal status。
|
||||
- 将 provider/auth/protocol/timeout/cancel 错误映射为 [spec-v01-backend-adapter.md](spec-v01-backend-adapter.md) 定义的 failureKind。
|
||||
|
||||
@@ -46,15 +46,16 @@ Adapter 通过 stdin 写入换行分隔 JSON-RPC 请求,通过 stdout 逐行
|
||||
| `codex` | `agentrun-v01-provider-codex` | operator 当前 Codex `auth.json`/`config.toml` | 现有默认 profile;实现 DeepSeek 时不得改变其默认模型、config authority 或真实联调路径。 |
|
||||
| `deepseek` | `agentrun-v01-provider-deepseek` | operator 准备的 DeepSeek-compatible Codex `auth.json`/`config.toml` | 使用同一 `codex app-server --listen stdio://` 协议,通过 `config.toml` 或等价 profile overlay 指向 DeepSeek-compatible upstream/model。 |
|
||||
| `minimax-m3` | `agentrun-v01-provider-minimax-m3` | 从 HWLAB Code Queue 现有 MiniMax API key 派生的 MiniMax-M3 Codex `auth.json`/`config.toml` | 沿 DeepSeek 相同路径使用 `codex app-server --listen stdio://`;`config.toml` 指向 MiniMax OpenAI-compatible upstream,模型为 `MiniMax-M3`,wire API 必须使用当前 Codex app-server 支持的 `responses`,不得继续使用已废弃的 `chat`。 |
|
||||
| `dsflash-go` | `agentrun-v01-provider-dsflash-go` | DeepSeek V4 Flash / OpenCode Zen Go Codex `auth.json`/`config.toml`/`model-catalog.json` | 沿 DeepSeek 相同路径使用 `codex app-server --listen stdio://`;`config.toml` 必须使用 `deepseek-v4-flash`、`model_context_window=1000000`、`model_auto_compact_token_limit=900000` 和固定 `model_catalog_json=/home/agentrun/.codex-dsflash-go/model-catalog.json`。 |
|
||||
|
||||
`deepseek` 的上游形态借鉴 HWLAB v0.2:DeepSeek 是 provider profile,通过 Responses-compatible bridge、Moon Bridge 或等价稳定服务暴露给 Codex CLI;AgentRun 不在 backend adapter 里手写 DeepSeek HTTP 转换器,也不把 DeepSeek 作为绕过 Codex app-server 的独立 backend kind。`minimax-m3` 也遵循同一原则:MiniMax-M3 是 Codex-compatible provider profile,不恢复旧 UniDesk Code Queue 的 MiniMax/OpenCode 直连路线,不新增独立 HTTP backend,不作为 fallback 或 judge backend。上游 base URL、模型和 provider 名称可以作为 redacted metadata 输出;API Key 和 `auth.json`/`config.toml` 原文不得输出。
|
||||
`deepseek` 的上游形态借鉴 HWLAB v0.2:DeepSeek 是 provider profile,通过 Responses-compatible bridge、Moon Bridge 或等价稳定服务暴露给 Codex CLI;AgentRun 不在 backend adapter 里手写 DeepSeek HTTP 转换器,也不把 DeepSeek 作为绕过 Codex app-server 的独立 backend kind。`minimax-m3` 也遵循同一原则:MiniMax-M3 是 Codex-compatible provider profile,不恢复旧 UniDesk Code Queue 的 MiniMax/OpenCode 直连路线,不新增独立 HTTP backend,不作为 fallback 或 judge backend。`dsflash-go` 是同一 Codex profile 机制下的 DeepSeek V4 Flash 1M context profile,必须通过 Moon Bridge / OpenCode Zen Go compatible path 和 model catalog 暴露模型元数据;若 compact path 不支持,adapter 必须输出 `provider-compact-unsupported`。上游 base URL、模型和 provider 名称可以作为 redacted metadata 输出;API Key、`auth.json`、`config.toml` 和 `model-catalog.json` 原文不得输出。
|
||||
|
||||
Profile 切换规则:
|
||||
|
||||
- `backendProfile` 是 run 的显式字段,manager 不得静默改写。
|
||||
- runner/backend 只读取与 `backendProfile` 同名的 provider credential;缺失则 `secret-unavailable`。
|
||||
- 每次 run 必须使用 profile-scoped writable `CODEX_HOME`。Kubernetes Job 默认把选中 profile 的 Secret projection 复制到该 Job 独占的 `/home/agentrun/.codex-<profile>`;host process 或复用进程必须使用 run/profile 独占目录,避免 `codex`、`deepseek` 与 `minimax-m3` 互相污染。
|
||||
- `deepseek` 和 `minimax-m3` 不得 fallback 到 `codex` Secret、模型或 upstream;`codex` 也不得读取其他 profile Secret。
|
||||
- 每次 run 必须使用 profile-scoped writable `CODEX_HOME`。Kubernetes Job 默认把选中 profile 的 Secret projection 复制到该 Job 独占的 `/home/agentrun/.codex-<profile>`;host process 或复用进程必须使用 run/profile 独占目录,避免 `codex`、`deepseek`、`minimax-m3` 与 `dsflash-go` 互相污染。
|
||||
- `deepseek`、`minimax-m3` 和 `dsflash-go` 不得 fallback 到 `codex` Secret、模型或 upstream;`codex` 也不得读取其他 profile Secret。
|
||||
- command payload 中显式提供 model 时可以透传给 Codex turn;未显式提供时以 profile `config.toml` 为 authority,不在 adapter 中写死默认模型。
|
||||
|
||||
## 测试凭据来源
|
||||
@@ -66,25 +67,26 @@ Profile 切换规则:
|
||||
~/.codex/config.toml
|
||||
```
|
||||
|
||||
这两个文件只能作为 Kubernetes Secret 创建或轮换的输入源,不能通过 hostPath 挂载进 Pod,不能复制进镜像,不能提交到 source branch、GitOps branch、artifact catalog、issue、PR、event、trace、日志或 CLI 输出。`codex`、`deepseek` 与 `minimax-m3` 可以来自不同 operator profile 目录或显式文件参数,但进入 Kubernetes 后必须是不同 SecretRef,除非后续规格明确批准某个共享 SecretRef 场景。`minimax-m3` 的 API key 输入源为 HWLAB Code Queue 现有 MiniMax secret;迁移时只允许把值写入 Kubernetes Secret,不得打印或落库。
|
||||
这些文件只能作为 Kubernetes Secret 创建或轮换的输入源,不能通过 hostPath 挂载进 Pod,不能复制进镜像,不能提交到 source branch、GitOps branch、artifact catalog、issue、PR、event、trace、日志或 CLI 输出。`codex`、`deepseek`、`minimax-m3` 与 `dsflash-go` 可以来自不同 operator profile 目录或显式文件参数,但进入 Kubernetes 后必须是不同 SecretRef,除非后续规格明确批准某个共享 SecretRef 场景。`minimax-m3` 的 API key 输入源为 HWLAB Code Queue 现有 MiniMax secret;`dsflash-go` 的 `model-catalog.json` 可由 AgentRun manager 生成或由 operator 显式提供;迁移时只允许把值写入 Kubernetes Secret,不得打印或落库。
|
||||
|
||||
`v0.1` 默认 Kubernetes Secret:
|
||||
|
||||
| 对象 | v0.1 规格 |
|
||||
| --- | --- |
|
||||
| Namespace | `agentrun-v01` |
|
||||
| Secret name | `agentrun-v01-provider-codex`、`agentrun-v01-provider-deepseek` 或 `agentrun-v01-provider-minimax-m3` |
|
||||
| Secret name | `agentrun-v01-provider-codex`、`agentrun-v01-provider-deepseek`、`agentrun-v01-provider-minimax-m3` 或 `agentrun-v01-provider-dsflash-go` |
|
||||
| Secret key | `auth.json`,来自 `~/.codex/auth.json` |
|
||||
| Secret key | `config.toml`,来自 `~/.codex/config.toml` |
|
||||
| Secret key | `model-catalog.json`,仅 `dsflash-go` 必需 |
|
||||
| Consumer | runner 或 backend adapter Pod |
|
||||
| Projection target | 只读 projection,再复制到当前 run/profile 的 writable `CODEX_HOME/auth.json` 和 `CODEX_HOME/config.toml` |
|
||||
| Projection target | 只读 projection,再复制到当前 run/profile 的 writable `CODEX_HOME/auth.json`、`CODEX_HOME/config.toml` 和 profile 需要的额外文件 |
|
||||
| File mode | 只读,建议 `0400` 或等价最小权限 |
|
||||
|
||||
Kubernetes Secret 的创建、轮换和权限控制属于集群密钥管理流程;source branch 只声明 SecretRef 名称、key 和 mount intent。`deploy/deploy.json` 和 rendered GitOps manifest 不得包含 Secret data。
|
||||
|
||||
## Runtime 行为
|
||||
|
||||
- Adapter 必须在调用 Codex 前验证 `auth.json` 和 `config.toml` 均存在且可读;缺失时返回 `secret-unavailable`。
|
||||
- Adapter 必须在调用 Codex 前验证 `auth.json` 和 `config.toml` 均存在且可读;`config.toml` 声明 `model_catalog_json` 时还必须验证目标文件可读;`dsflash-go` 缺少 `model_catalog_json` 时也必须在 provider 调用前返回 `secret-unavailable`。
|
||||
- Codex 运行时必须使用被投影的 `.codex` 目录;不得 fallback 到镜像内默认凭据或节点宿主机 `~/.codex`。
|
||||
- Codex stdio backend 不得设置 turn/session/conversation 的总时长 timeout;`executionPolicy.timeoutMs` 只能作为无 app-server 响应、无 notification、无 assistant/tool/event activity 的 idle timeout。长程任务只要持续产生可见 activity,就必须继续等待 `turn/completed`、取消或真实 transport failure。
|
||||
- 普通 turn command 失败只终结当前 command,不得把 reusable run/session 置为 terminal;后续 command 必须仍可进入同一个 run/runner。只有显式 cancel、runner lease/claim 失效、资源装配不可恢复或运行面退出才允许终结 run。
|
||||
@@ -96,7 +98,7 @@ Kubernetes Secret 的创建、轮换和权限控制属于集群密钥管理流
|
||||
|
||||
[spec-v01-secret-distribution.md](spec-v01-secret-distribution.md) 是 SecretRef、Kubernetes projection、redaction 和 missing secret failure 的权威。本文件只定义 Codex backend 对测试凭据文件的消费方式。
|
||||
|
||||
Run 的 `executionPolicy.secretScope` 应引用与 `backendProfile` 匹配的 provider SecretRef 的 `auth.json` 和 `config.toml`,而不是携带 provider credential 或文件内容。
|
||||
Run 的 `executionPolicy.secretScope` 应引用与 `backendProfile` 匹配的 provider SecretRef 的 `auth.json`、`config.toml` 和 profile 需要的额外文件,尤其是 `dsflash-go` 的 `model-catalog.json`,而不是携带 provider credential 或文件内容。
|
||||
|
||||
## 测试规格
|
||||
|
||||
@@ -116,6 +118,10 @@ Run 的 `executionPolicy.secretScope` 应引用与 `backendProfile` 匹配的 pr
|
||||
|
||||
阅读本文、[spec-v01-secret-distribution.md](spec-v01-secret-distribution.md) 和 [spec-v01-validation.md](spec-v01-validation.md),然后用 `backendProfile=minimax-m3` 创建真实 run 并提交一个最短 `turn` command。确认 runner 仍调用 `codex app-server --listen stdio://`,但使用 `agentrun-v01-provider-minimax-m3` 的 profile SecretRef 和独立 `CODEX_HOME`;manager 可查询 profile 为 `minimax-m3` 的 backend_status、assistant 或 error event、terminal_status,且 Secret value 未泄露。
|
||||
|
||||
### T2d 真实 dsflash-go profile 最短 turn
|
||||
|
||||
阅读本文、[spec-v01-provider-profile-management.md](spec-v01-provider-profile-management.md) 和 [spec-v01-validation.md](spec-v01-validation.md),然后用 `backendProfile=dsflash-go` 创建真实 run 并提交一个最短 `turn` command。确认 runner 仍调用 `codex app-server --listen stdio://`,但使用 `agentrun-v01-provider-dsflash-go` 的 profile SecretRef、独立 `CODEX_HOME` 和 `model-catalog.json`;manager 可查询 profile 为 `dsflash-go`、model 为 `deepseek-v4-flash`、context window 为 1M 的 backend_status、assistant 或 error event、terminal_status,且 Secret value 未泄露。
|
||||
|
||||
### T3 Missing auth/config failure
|
||||
|
||||
阅读本文,然后分别移除或改名 Secret 中的 `auth.json`、`config.toml` key,启动真实 run。确认 adapter 在调用 provider 前失败为 `secret-unavailable`,failure response 为 JSON,日志不包含 Secret value。
|
||||
@@ -130,7 +136,7 @@ Run 的 `executionPolicy.secretScope` 应引用与 `backendProfile` 匹配的 pr
|
||||
|
||||
### T6 Profile switching isolation
|
||||
|
||||
阅读本文,然后在真实 `agentrun-v01` 运行面按顺序执行 `backendProfile=codex`、`backendProfile=deepseek`、`backendProfile=minimax-m3`、`backendProfile=codex` 四个最短 turn。确认第二个 run 使用 DeepSeek profile,第三个 run 使用 MiniMax-M3 profile,前后两个 `codex` run 仍使用原 Codex profile;四者的 event、log、backend_status、model/upstream metadata 和 failureKind 不互相污染,且任何一个 profile SecretRef 缺失都不会 fallback 到另一个 profile。
|
||||
阅读本文,然后在真实 `agentrun-v01` 运行面按顺序执行 `backendProfile=codex`、`backendProfile=deepseek`、`backendProfile=minimax-m3`、`backendProfile=dsflash-go`、`backendProfile=codex` 五个最短 turn。确认第二个 run 使用 DeepSeek profile,第三个 run 使用 MiniMax-M3 profile,第四个 run 使用 dsflash-go profile,前后两个 `codex` run 仍使用原 Codex profile;五者的 event、log、backend_status、model/upstream metadata 和 failureKind 不互相污染,且任何一个 profile SecretRef 缺失都不会 fallback 到另一个 profile。
|
||||
|
||||
### T7 Stale thread resume failed
|
||||
|
||||
@@ -162,4 +168,5 @@ Run 的 `executionPolicy.secretScope` 应引用与 `backendProfile` 匹配的 pr
|
||||
| 真实 provider turn | 已通过主闭环 | 真实 Codex provider turn 已经通过 RESTful API 和 CLI 综合联调;每次发布仍按 [spec-v01-validation.md](spec-v01-validation.md) 手动复验。 |
|
||||
| `deepseek` profile | 已实现/已通过主闭环 | 代码已支持 `agentrun-v01-provider-deepseek`、独立 `CODEX_HOME`、同一 `codex app-server --listen stdio://` 协议和 profile metadata;真实 Kubernetes SecretRef、runner Job 和 Codex stdio turn 已通过主闭环。 |
|
||||
| `minimax-m3` profile | 已实现/待真实主闭环 | 代码已支持 `agentrun-v01-provider-minimax-m3`、独立 `CODEX_HOME`、同一 `codex app-server --listen stdio://` 协议和 profile metadata;真实 Kubernetes SecretRef、runner Job 和 Codex stdio turn 需要完成 AgentRun CLI 手动验收。 |
|
||||
| `dsflash-go` profile | 已实现/待真实主闭环 | 代码已支持 `agentrun-v01-provider-dsflash-go`、独立 `CODEX_HOME`、`model-catalog.json`、同一 `codex app-server --listen stdio://` 协议和 profile metadata;真实 Kubernetes SecretRef、runner Job、Codex stdio turn 和 HWLAB 原入口 CaseRun 需要完成验收。 |
|
||||
| hostPath `~/.codex` | 不采用 | 只能通过 Kubernetes Secret projection 注入。 |
|
||||
|
||||
Reference in New Issue
Block a user