docs: close out runner retention repair
Pipelines as Code CI / hwlab-web-probe-sentinel-nc01- Success
Pipelines as Code CI / platform-infra-gitea-nc01- Success
Pipelines as Code CI / unidesk-host- Success

This commit is contained in:
Codex
2026-07-12 19:05:26 +02:00
parent 9d1e1c381a
commit 3ea06cabdb
4 changed files with 27 additions and 12 deletions
+2 -2
View File
@@ -71,9 +71,9 @@
### R4.3
解决 [AgentRun #330](https://github.com/pikasTech/agentrun/issues/330):修复 manager 已选定 inactive runner 后删除其关联 Secret 失败导致 dispatch 无法释放容量;只处理对象归属、NotFound 幂等和 typed failure,禁止扩展合同、租约、安全机制、围栏或容量架构,自动上线后以原 task qt_fd1c18a8bb04490d8bbb838885d1f436 成功 dispatch 验收,完成任务后将详细报告写入[任务报告](./details/agentrun-runtime-reliability/R4.3_Task_Report.md)。
### R4.4
### R4.4 [completed]
解决 [AgentRun #332](https://github.com/pikasTech/agentrun/issues/332):终态 run/command 不得被历史 claim、registration、heartbeat 或 stale-pending 窗口判为 protectedActive;最小调整 retention 分类优先级并补定向测试,不新增/扩展合同、租约、安全机制、围栏、CAS 或容量架构,自动上线后空闲 runner 容量应接近 0。,完成任务后将详细报告写入[任务报告](./details/agentrun-runtime-reliability/R4.4_Task_Report.md)。
解决 [AgentRun #332](https://github.com/pikasTech/agentrun/issues/332)修正终态 runner 与 manager 基础设施事件的假活分类,让既有周期 reconciler 自动回收所有 inactive runner;不新增合同、租约、安全机制、围栏、CAS 或容量架构,以 NC01 空闲容量收敛到 0/20 验收,完成任务后将详细报告写入[任务报告](./details/agentrun-runtime-reliability/R4.4_Task_Report.md)。
## R5 [in_progress]
完善 Artificer AipodSpec、primary workspace、resource bundle 物化与业务 turn admission,使声明式源码快照、能力 bundle 和失败可见性形成单一合同,完成任务后将详细报告写入[任务报告](./details/agentrun-runtime-reliability/R5_Task_Report.md)。
@@ -0,0 +1,7 @@
# R4.4 任务报告
- 根因一:终态 run/command 的事实晚于历史 claim、heartbeat 和 Pod 活性判定,导致 completed runner 被错误保护。
- 根因二:`runner-dispatch-retry` 被误认作业务进展,导致旧 pending runner 永久保护。
- 修复:AgentRun PR #333 调整终态分类优先级并让既有周期 reconciler 分批回收全部 inactive candidatePR #334 修正 dispatch retry 的事件分类。
- 验证:两个 PR 均经 GitHub webhook、Gitea mirror、PaC、Tekton、GitOps 和 Argo 自动上线;未人工触发 CI/CD,未强杀 runner。
- 运行面:`cleanup-runners --dry-run` 最终显示 `runnerJobCount=0``protectedActiveRunnerCount=0``usage=0/20`
+12 -4
View File
@@ -69,7 +69,6 @@ bun scripts/cli.ts agentrun control-plane status
bun scripts/cli.ts platform-infra pipelines-as-code status --target NC01 --consumer agentrun-nc01-v02
bun scripts/cli.ts platform-infra pipelines-as-code history --target NC01 --consumer agentrun-nc01-v02 --limit 10
bun scripts/cli.ts agentrun control-plane cleanup-runners --node NC01 --lane nc01-v02 --dry-run
bun scripts/cli.ts agentrun control-plane cleanup-runners --node NC01 --lane nc01-v02 --confirm
bun scripts/cli.ts agentrun control-plane cleanup-runs --min-age-minutes 30 --limit 200 --dry-run
bun scripts/cli.ts agentrun control-plane cleanup-runs --min-age-minutes 30 --limit 200 --confirm
bun scripts/cli.ts agentrun control-plane cleanup-released-pvs --limit 200 --dry-run
@@ -155,7 +154,13 @@ HWLAB 通过 NC01 `agentrun-v02` 使用 Codex profile 时,`config.toml` 应只
AgentRun Kafka closeout 需要同时验证 manager 和 runner 两条生产链路。manager 侧至少创建一个短 run,并在 manager pod 内执行 `./scripts/agentrun kafka tail agentrun --run-id <runId>` 查到 `agentrun.event.v1``agentrun.run.created` 或后续 durable eventrunner 侧必须创建真实 runner Job,并确认 Job env 中存在 `AGENTRUN_KAFKA_ENABLED``AGENTRUN_KAFKA_BOOTSTRAP_SERVERS``AGENTRUN_KAFKA_STDIO_TOPIC``AGENTRUN_KAFKA_STDIO_CLIENT_ID``AGENTRUN_KAFKA_STDIO_PRODUCE_ENABLED`,再用 `./scripts/agentrun kafka tail stdio --run-id <runId>` 查到 `codex-stdio.raw.v1` 的 stdin/stdout/stderr frame。默认查询不得展开 raw value;需要排查裸帧时才显式加 `--values`,并避免把 Secret value 写入 issue 或日志。
如果 smoke runner 被 retention 挡住,先运行 `agentrun control-plane cleanup-runners --node NC01 --lane nc01-v02 --dry-run`。该入口只做有界分类,不拥有删除 authority;必须由 AgentRun manager 在创建新 runner 前通过 DB fence 与 Kubernetes CAS 原子回收,UniDesk 不提供强杀参数,也不得为了验证 Kafka raw frame 直接裸删 Kubernetes Job/Pod。
- runner 容量异常或 dispatch 被 retention 挡住时:
- 先运行 `agentrun control-plane cleanup-runners --node NC01 --lane nc01-v02 --dry-run`
- 该入口只读展示容量、候选和保护分类;
- 回收由既有 AgentRun manager 周期 reconciler 与 pre-create retention 自动完成;
- 空闲运行面应收敛到 `runnerJobCount=0``protectedActiveRunnerCount=0`
- 终态命令仍被历史 claim、heartbeat、Pod 或 `runner-dispatch-retry` 保护时,修正 retention 分类;
- 禁止强杀 Job/Pod 或手工补 CI/CD。
AgentRun resource/session client policy 也由 `config/agentrun.yaml` 声明。`client.sessionPolicy` 是未显式选择 node/lane 时 `agentrun send session/...` 和相关 session payload 生成的默认 `tenantId``projectId``providerId``backendProfile``workspaceRef` 和 execution policy 来源;显式 `--node <node> --lane <lane>` 后,`explain session-policy``send session`、resource primitives 和 AipodSpec render 都必须改用目标 lane 的 YAML 事实。lane `secrets[].providerCredential.profile` 声明 provider credential Secret 归属,UniDesk CLI 只按 YAML 聚合 Secret name/key,不再用代码拼接 provider Secret 名称。只读入口 `bun scripts/cli.ts agentrun explain session-policy` 用于查看选中目标 lane、policy 来源、实际 executionPolicy payload 和 provider credential binding 来源;输出只能包含 Secret metadata、key 名和 `valuesPrinted=false`,不得打印 Secret value。
@@ -175,8 +180,11 @@ AgentRun resource/session client policy 也由 `config/agentrun.yaml` 声明。`
- `degradedReason`
- manager facts 或 Warning Event 查询不完整时返回 observation degraded
- `runnerJobCount === maxRunners` 时返回 at-capacity degraded,不能在下一次创建已经依赖尚未验收的 manager retention 时继续显示健康;
- UniDesk `--confirm` 固定 fail-closed不按名称删除 Job/Pod
- 真正回收只能由 AgentRun manager 在 incoming runner 创建前通过 DB fence 与 Kubernetes CAS 原子完成
- UniDesk 不提供 runner 强杀入口,也不按名称删除 Job/Pod
- AgentRun manager 的周期 reconciler 必须分批回收所有明确 inactive 的 terminal、idle 和 stale-pending runner
- run/command 终态优先于历史 claim、heartbeat 和 Pod 活性观察;
- `runner-dispatch-retry` 属于 manager 基础设施阶段,不能作为业务进展永久保护 pending runner
- stale-pending 保护窗口基于对象创建时间,持续 FailedMount Warning 不得刷新窗口;
- manager facts 不可用时继续保护,不能把 Kubernetes 创建时间冒充为完整最后活跃事实。
`cleanup-runs` 是 AgentRun `v0.2` 完成态 CI workspace retention 入口,只清理 `agentrun-ci` namespace 中超过 `--min-age-minutes``agentrun-v02-ci-*` PipelineRun,通过 Tekton ownerRef 释放临时 workspace PVC。dry-run 必须披露候选 PipelineRun、owned PVC、active mount 保护、local-path 实际估算 bytes 和 confirm 命令。默认保护最新完成的 PipelineRun,保留当前 CI/CD 状态证据。`cleanup-released-pvs` 是二次回收入口,只处理 `agentrun-ci``local-path``Delete` reclaim policy 的 `Released` PV;它不触碰 AgentRun runtime namespace、业务 PVC、Secret、registry storage 或 GitOps desired state。磁盘治理规则见 `docs/reference/gc.md`