docs: document code agent profile inheritance

This commit is contained in:
Codex Agent
2026-06-08 10:37:56 +08:00
parent 6d1b1fd7ea
commit c0b3939624
11 changed files with 80 additions and 89 deletions
+7 -5
View File
@@ -20,7 +20,7 @@ Code Agent session 是显式资源,不再由普通 `client agent send`、Workb
- 无 Code Agent session 时,必须先显式创建 session,再发送 turn。CLI 目标入口为 `client agent session create`;Web 目标入口为“新建 session”显式动作;Cloud API 目标入口为 `POST /v1/agent/sessions`。session 创建返回 `conversationId/sessionId``threadId` 可以在首轮 turn 被 provider/AgentRun 建立后回写。
- `client agent session create|select|status` 的默认 JSON 输出必须在顶层直接暴露 `sessionId``conversationId``threadId``providerProfile``sessionStatus``sessionUsable` 这类短连接脚本高频字段;完整原始响应仍保留在 `session``body` 中。人工和 agent 不应为了拿 sessionId 手写一次性 JSON 深挖脚本,也不应依赖 `sed`/`grep` 解析 JSON。
- 显式 session 是 provider profile authority。`client agent session create --provider-profile <profile>` 创建 session 后,`client agent send --session-id <sessionId>` 在未传 `--provider-profile` 时必须先读取该 session 并继承 `providerProfile`;显式 `--provider-profile` 只作为人工有意覆盖必须在输出和 trace 中可见。workspace provider profile 只能在 workspace selected session 与本次目标 session 完全一致时作为 fallback,不能用旧 workspace 状态覆盖显式 session
- 显式 session 是用户入口的 provider profile authority。`client agent session create --provider-profile <profile>` 创建 session 后,`client agent send --session-id <sessionId>` 在未传 `--provider-profile` 时必须继承该 session `providerProfile`;显式覆盖必须在输出和 trace 中可见。AgentRun dispatch、dynamic profile slug 和 nested child `spawn` env-only 继承的权威规则见 [agentrun-code-agent-dispatch.md](agentrun-code-agent-dispatch.md)
- `client agent send` 必须携带显式 `--session-id`,或使用此前通过 `client agent session create|select` 明确选中的 workspace session;没有显式或已选 session 时返回结构化 `session_required`,不能自动生成 `conversationId/sessionId/threadId`
- 显式传入新的 `--conversation-id` 时,如果没有同时显式 `--session-id``--from-trace` 恢复出的 sessionCLI 不得从账号 workspace 继承旧 session;这种情况必须返回 `session_required`,提示先为该 conversation 创建或选择 session。只有显式 conversation 与 workspace 当前 conversation 完全一致时,才允许使用 workspace 中已显式选中的 session。
- session 失败、`thread-resume-failed`、provider continuation 失效、用户取消或运行面中断时,当前 session 必须保留为 failed/stale/canceled 证据;系统不得自动滚动到新 session、不得隐式清理后继续,也不得把下一条普通消息路由到新 session。继续工作前必须显式创建或选择另一个 session。
@@ -83,7 +83,9 @@ Code Agent session 是显式资源,不再由普通 `client agent send`、Workb
| `hwlab-cli client access tools grant/revoke USER TOOL` | `PUT/DELETE /v1/admin/access/users/{userId}/tools/{toolId}/can-use` | 授予或撤销 `hwpod``unidesk_ssh``trans_cmd`、GitHub 写工具等 capability。 |
| `hwlab-cli client access check --user USER --relation REL --object OBJECT` | `POST /v1/admin/access/check` | 管理员调试单次 authorization check,输出 decision 和 redacted actor/object。 |
| `hwlab-cli client provider-profiles list` | `GET /v1/admin/provider-profiles` | 管理页的非视觉状态入口;输出 actor、profile、SecretRef、resourceVersion、hash 后缀和最近验证结果,不输出 API Key 或 Secret data。 |
| `hwlab-cli client provider-profiles remove PROFILE` | `DELETE /v1/admin/provider-profiles/{profile}` | 删除遗留 provider profileCloud API 鉴权后委托 AgentRun 删除对应 Secret,内建 profile capability 保留、动态 slug 从列表消失。 |
| `hwlab-cli client provider-profiles config PROFILE` | `GET /v1/admin/provider-profiles/{profile}/config` | 显式读取 AgentRun profile config 文本;不输出 credential value。 |
| `hwlab-cli client provider-profiles set-config PROFILE --config-file FILE` | `PUT /v1/admin/provider-profiles/{profile}/config` | 写入 AgentRun profile config;新增动态 slug 不要求修改 Cloud API/Web 静态枚举。 |
| `hwlab-cli client provider-profiles remove PROFILE` | `DELETE /v1/admin/provider-profiles/{profile}` | 删除遗留 provider profileCloud API 鉴权后委托 AgentRun 删除对应 Secret/配置,内建 profile capability 保留、动态 slug 从列表消失。 |
| `hwlab-cli client provider-profiles set-key PROFILE --key-stdin` | `PUT /v1/admin/provider-profiles/{profile}/credential` | 从 stdin 写入 provider API KeyCloud API 鉴权后委托 AgentRun;默认只输出 resourceVersion/hash 后缀和 failureKind。 |
| `hwlab-cli client provider-profiles validate PROFILE --wait` | `POST /v1/admin/provider-profiles/{profile}/validate` + `GET /validations/{id}` | 触发 provider canary 并短连接轮询,输出 validationId、runId、commandId、jobName、traceId、status、failureKind 和 redacted bridge 摘要。 |
| `hwlab-cli client request POST /v1/hwpod-node-ops` | `POST /v1/hwpod-node-ops` | HWPOD node-ops 同路径 smokeCode Agent 侧正式业务入口仍是 `hwpod`,由 `hwpod-compiler-cli` 生成 node-ops。 |
@@ -121,7 +123,7 @@ Code Agent session 是显式资源,不再由普通 `client agent send`、Workb
## T3
阅读 docs/reference/spec-v02-hwlab-cli.md,然后在 `G14:/root/hwlab-v02` 用 cli 手动测试以下内容:先运行 `client agent session create --provider-profile minimax-m3` 显式创建 session,再运行 `client agent send --session-id <sessionId> --message "在吗?" --wait --timeout-ms 120000`,确认 send 未传 `--provider-profile` 也继承 session 的 `providerProfile=minimax-m3`,响应包含 accepted/result/trace 信息和 assistant 回复文本。未先创建或选择 session 时,`client agent send --message "在吗?"` 必须返回结构化 `session_required`,不能自动创建 session。该验收默认使用 MiniMax-M3;如果是 DeepSeek 专项才切换 provider profile
阅读 docs/reference/spec-v02-hwlab-cli.md,然后在 `G14:/root/hwlab-v02` 用 cli 手动测试以下内容:先运行 `client agent session create --provider-profile dsflash-go` 显式创建 session,再运行 `client agent send --session-id <sessionId> --message "在吗?" --wait --timeout-ms 120000`,确认 send 未传 `--provider-profile` 也继承 session 的 `providerProfile=dsflash-go`,响应包含 accepted/result/trace 信息、真实 `deepseek-v4-flash` 模型和 assistant 回复文本。未先创建或选择 session 时,`client agent send --message "在吗?"` 必须返回结构化 `session_required`,不能自动创建 session。Nested child `spawn` 继承验收见 [agentrun-code-agent-dispatch.md](agentrun-code-agent-dispatch.md)
## T3.1
@@ -153,7 +155,7 @@ Code Agent session 是显式资源,不再由普通 `client agent send`、Workb
## T5
阅读 docs/reference/spec-v02-hwlab-cli.md,然后在 `G14:/root/hwlab-v02` 用 cli 手动测试以下内容:运行 `client harness health``client harness submit --message "你好" --provider-profile deepseek --timeout-ms 120000``client harness wait <traceId>``client harness audit <traceId>`。确认它们全部是短连接 JSON 输出,不创建镜像、Job、CronJob、Deployment 或 hot-sync 写路径。
阅读 docs/reference/spec-v02-hwlab-cli.md,然后在 `G14:/root/hwlab-v02` 用 cli 手动测试以下内容:运行 `client harness health``client harness submit --message "你好" --provider-profile dsflash-go --timeout-ms 120000``client harness wait <traceId>``client harness audit <traceId>`。确认它们全部是短连接 JSON 输出,不创建镜像、Job、CronJob、Deployment 或 hot-sync 写路径。
## T6
@@ -169,7 +171,7 @@ Code Agent session 是显式资源,不再由普通 `client agent send`、Workb
## T9
阅读 docs/reference/spec-v02-provider-management.md,然后在 runtime endpoint locked 环境下运行 `client provider-profiles list``client provider-profiles set-key deepseek --key-stdin``client provider-profiles validate deepseek --wait --timeout-ms 120000`。确认全部走 Cloud Web 同源 `19666` path,先由 HWLAB 鉴权再委托 AgentRun,输出 validationId/runId/commandId/jobName/traceId/resourceVersion/hash 后缀,不输出完整 API Key、Codex auth/config、Kubernetes Secret data 或 Authorization headerDeepSeek 验证必须走 Moon Bridge 到官方 upstream,不访问 hyue。
阅读 docs/reference/spec-v02-provider-management.md,然后在 runtime endpoint locked 环境下运行 `client provider-profiles list``client provider-profiles config dsflash-go``client provider-profiles set-config dsflash-go --config-file <config.toml>``client provider-profiles set-key dsflash-go --key-stdin``client provider-profiles validate dsflash-go --wait --timeout-ms 120000`。确认全部走 Cloud Web 同源 `19666` path,先由 HWLAB 鉴权再委托 AgentRun,输出 validationId/runId/commandId/jobName/traceId/resourceVersion/hash 后缀,不输出完整 API Key、Codex auth.json、Kubernetes Secret data 或 Authorization header显式读取的 config 不得包含 credential value。
## 规格的实现情况