feat: 增加 Codex Secret dry-run 工具
This commit is contained in:
@@ -30,6 +30,7 @@ bun scripts/agentrun-cli.ts runs events <runId> --after-seq <n> --limit <n>
|
||||
bun scripts/agentrun-cli.ts commands create <runId> --type turn --json-file <payload.json>
|
||||
bun scripts/agentrun-cli.ts commands show <commandId>
|
||||
bun scripts/agentrun-cli.ts runner start --run-id <runId> --backend <backendProfile>
|
||||
bun scripts/agentrun-cli.ts secrets codex render --dry-run [--codex-home <dir>]
|
||||
bun scripts/agentrun-cli.ts backends list
|
||||
bun scripts/agentrun-cli.ts server start|status|stop|logs
|
||||
```
|
||||
@@ -41,6 +42,7 @@ bun scripts/agentrun-cli.ts server start|status|stop|logs
|
||||
- 查询类命令返回当前 state、terminal_status、failureKind、event cursor 或 logPath。
|
||||
- `events` 默认分页且有界,必须支持 `afterSeq` 和 `limit`。
|
||||
- `server logs` 返回有界日志摘要,并指向完整日志文件或 Kubernetes pod identity。
|
||||
- `secrets codex render --dry-run` 返回 Codex provider Secret 创建计划、输入文件 bytes/hash、SecretRef、manifest 摘要和 apply 命令形状;它不得输出 Secret value 或执行 Kubernetes 写操作。
|
||||
|
||||
## 配置与 Secret 边界
|
||||
|
||||
|
||||
@@ -106,6 +106,25 @@ runner/backend Pod
|
||||
|
||||
Secret 创建和轮换不由 source branch 自动生成;source branch 只声明需要哪个 SecretRef。后续如果接入 External Secrets、Vault、SealedSecrets 或 SOPS,必须新增或更新本 spec,明确 controller、source of truth、rotation 和 redaction 规则。
|
||||
|
||||
## Codex Secret dry-run 工具
|
||||
|
||||
`v0.1` 提供只读 CLI 工具,用 operator 本地 `~/.codex/auth.json` 与 `~/.codex/config.toml` 构造 Kubernetes Secret 创建计划:
|
||||
|
||||
```bash
|
||||
bun scripts/agentrun-cli.ts secrets codex render --dry-run
|
||||
```
|
||||
|
||||
可选参数:
|
||||
|
||||
- `--codex-home <dir>`:覆盖默认 `~/.codex` 输入目录。
|
||||
- `--auth-file <path>` / `--config-file <path>`:分别覆盖输入文件路径。
|
||||
- `--namespace <name>`:默认 `agentrun-v01`。
|
||||
- `--secret-name <name>`:默认 `agentrun-v01-provider-codex`。
|
||||
|
||||
输出必须是 JSON,并且只包含 `namespace`、`secretName`、`keys`、每个输入文件的 `bytes`、`sha256`/`contentHash`、整体 hash、redaction 状态、apply 命令形状和 Secret manifest 摘要。输出不得包含 Secret value、`auth.json` 明文、`config.toml` 明文、base64 `data` 字段或可直接恢复 credential 的内容。工具只支持 `--dry-run`;不得执行 `kubectl apply`。
|
||||
|
||||
失败必须结构化返回 `failureKind`:缺文件、不可读文件或空 credential 归类为 `secret-unavailable`;非法 JSON/TOML 归类为 `schema-invalid`。
|
||||
|
||||
## 日志与事件 Redaction
|
||||
|
||||
- event、trace、日志、CLI 输出、health 和 diagnostics 不得打印 Secret 值。
|
||||
@@ -133,6 +152,7 @@ Secret 创建和轮换不由 source branch 自动生成;source branch 只声
|
||||
| --- | --- | --- |
|
||||
| Secret 分发规格 | 已定义 | 本文为 v0.1 provider credential 分发权威。 |
|
||||
| Kubernetes SecretRef 注入 | 未实现 | 需要后续 GitOps/runtime 实现。 |
|
||||
| Codex Secret dry-run 工具 | 已实现 | `bun scripts/agentrun-cli.ts secrets codex render --dry-run` 只输出 Secret 创建计划、hash 和 redacted manifest 摘要,不执行 apply。 |
|
||||
| Codex auth/config file projection | 未实现 | 需要后续 runner/backend adapter 实现,测试来源为 `~/.codex/auth.json` 和 `~/.codex/config.toml`。 |
|
||||
| redaction 最小规则 | 已定义 | 需要后续代码实现和测试。 |
|
||||
| redaction 最小规则 | 已定义/部分实现 | Secret dry-run 工具和自测试已覆盖不输出 `auth.json`、`config.toml` 明文;runtime 日志/event redaction 仍需随 runner/backend 补齐。 |
|
||||
| 外部 secret manager | 未采用 | 如需 Vault/ExternalSecrets/SOPS,后续单独更新规格。 |
|
||||
|
||||
Reference in New Issue
Block a user