Skip to content

Add runtime validation tier: agent-compose E2E persistence and startup check#17

Merged
zengsipei merged 3 commits into
mainfrom
runtime-check-tier
Jul 8, 2026
Merged

Add runtime validation tier: agent-compose E2E persistence and startup check#17
zengsipei merged 3 commits into
mainfrom
runtime-check-tier

Conversation

@zengsipei

Copy link
Copy Markdown
Owner

Closes #15

What

ADR 0004 决策 5-6 的运行时验证层:

  • scripts/check-runtime.sh:以 fresh Agent Home(WSL_HOME=<mktemp -d>,Host-Backed)在独立 compose project(-p template-runtime-check)里起 agent-compose 服务,等 bootstrap 走完真实路径(npm install -g 不跳过、不 mock),然后三组断言:
    1. Persistence Manifest:清单每个 dotdir 在容器 $HOME 是符号链接,readlink 精确解析进 Agent Home 挂载;
    2. 幂等性compose restart 让 bootstrap 在链接已存在的 FS 上重跑,再验 readlink 精确不变 且无嵌套链接ln -sf 嵌套只在这一步暴露;第二遍很便宜——CLI 幸存 restart,安装守卫直接跳过);
    3. Startup Install:共享安装清单里的每个 CLI 在 PATH 上。HAPI 刻意不断言(agent-compose 有意不装,devcontainer-only)。
  • 断言来源是数据,不是副本:三份运行时脚本各暴露 --print-* 查询接口(--print-manifest / --print-agent-home / --print-clis / --print-ready-marker),检查在容器内调 compose 挂载的同一份文件读取清单——新工具进清单即自动被覆盖,检查不含任何清单硬编码副本。
  • CItemplate-runtime-check.yml path-filter 到运行时布线(共享脚本、agent-compose 定义、umbrella、workflow 自身)+ 手动 dispatch,薄调用 check-template.sh runtime

安全(ADR 0004 决策 6)

  • fresh home 用 Host-Backed 临时目录,真实 dev-home 从不挂载进检查容器(本机 dev-home volume 不存在,跑完依然不存在);
  • teardown 永不 down -v,只 down --remove-orphans 限于检查自己的 project;
  • dev-cache 仍共享挂载——这是对验收 "untouched" 的一处明示解读:它是 Rebuildable Cache,npm 写缓存是其设计用途且共享加速本地检查;「不可删除」由永不 -v 保证。如需完全隔离,需给 compose.yaml 的 cache 挂载加 WSL_CACHE 参数化,可另开 issue。

突变验证(验收标准 2,本地实测)

scripts/link-agent-home.sh 逐一重引入 #10 的三个 bug 类,检查各自失败;恢复后基线通过:

突变 结果
漏清单条目(链接循环 continue 跳过 .hapi,清单仍点名它) /home/vscode/.hapi 不是符号链接(首次启动步)
条件链接([ -d ] 才链,去掉无条件 mkdir -p /home/vscode/.claude 不是符号链接(首次启动步)
ln -sfnln -sf 首次启动通过,❌ 嵌套链接 /home/vscode/wsl-home/.claude/.claude 存在(restart 幂等步,精确命中)

基线(现 main + 本分支)本地通过:三组断言全绿,teardown 后检查容器/网络/临时目录全清,dev-home 不存在、dev-cache 未删。

越界说明

check-template.shruntime_tier 从「未实现即 SKIP」改为流式执行 check-runtime.sh(不经 run_check 缓冲)——issue 把 umbrella 集成划为 out of scope,但占位分支在脚本落地后必须移除,且运行时检查耗时数分钟,CI 日志需要实时输出。

Out of scope(按 issue)

devcontainer-CLI 驱动的 post-create E2E、HAPI Local Hub 健康检查。

zengsipei added 3 commits July 8, 2026 21:14
…p check (#15)

scripts/check-runtime.sh boots the agent-compose service with a fresh
Host-Backed Agent Home (WSL_HOME=<temp dir>), lets bootstrap run its real
path (npm installs not mocked), and asserts:

1. Persistence Manifest: every manifest dotdir is a $HOME symlink whose
   readlink resolves exactly into the Agent Home mount
2. Idempotency: after a restart re-runs bootstrap on a filesystem where
   links already exist, readlink targets are unchanged and un-nested
   (catches the ln -sf nesting class)
3. Startup Install: every CLI in the shared install list is on PATH
   (HAPI deliberately not asserted: devcontainer-only)

Assertion sources are the two shared scripts, read as data via new
--print-manifest/--print-agent-home/--print-clis modes executed against
the same mounted files bootstrap ran; the check carries no list copies.

Safety (ADR 0004 decision 6): volumes are fixed-name and shared with
real use, so the check runs under its own compose project, never mounts
the real dev-home, and teardown never uses down -v. dev-cache stays
shared by design (Rebuildable Cache; never deleted).

CI: template-runtime-check.yml path-filters to the runtime wiring plus
manual dispatch and calls the umbrella, whose runtime tier now streams
the check's output live.

Closes #15
…eview)

- bootstrap.sh defines its completion message once (READY_MESSAGE) and
  exposes it via --print-ready-marker; check-runtime.sh reads the
  bootstrap-done signal from there instead of carrying a string copy
  (same dedupe-over-check reasoning as the manifest/install-list
  interfaces, ADR 0004 decision 1)
- template-runtime-check.yml also triggers on scripts/check-template.sh:
  the umbrella is what the workflow actually executes
@zengsipei zengsipei merged commit 7bbc2d1 into main Jul 8, 2026
2 checks passed
@zengsipei zengsipei deleted the runtime-check-tier branch July 8, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the runtime validation tier: agent-compose end-to-end persistence and startup check

1 participant