Files
pikasTech-HWLAB/docs/dev-m4-agent-loop.md
T
Lyon ae23972fd9 test: refresh DEV M4 agent smoke evidence (#139)
Commander review: direction is correct. This PR records DEV M4 agent-loop evidence as a bounded preflight, keeps M4 subordinate to the M3 trusted-loop mainline, and preserves blockers for DB live readiness and skill version injection. No PROD/service restart is included.
2026-05-22 20:45:23 +08:00

79 lines
2.4 KiB
Markdown

# DEV M4 Agent Loop
This document records the DEV-only M4 agent loop smoke for
`pikasTech/HWLAB#37`.
## Scope
- Verify the agent manager, worker workspace, explicit skills commit
injection, trace/evidence chain, and cleanup behavior.
- Keep the runtime path on the fixed DEV boundary at
`http://74.48.78.17:16667`.
- Avoid secret reads, PROD access, long-running agent tasks, and direct gateway
access.
## Local Checks
Run the source-only smoke first:
```sh
node scripts/m4-agent-loop-smoke.mjs
```
That smoke stays local and checks the runtime skeleton, workspace isolation,
and explicit skills commit handling.
Run the bounded M4 dry-run before live preflight:
```sh
node scripts/dev-m4-agent-loop-smoke.mjs --dry-run
```
The dry-run uses only temporary local state. It records manager, worker,
workspace, skills commit, trace, evidence, and cleanup evidence as `DRY-RUN`;
it is not `DEV-LIVE`.
## Live DEV Preflight
Run the live preflight only if the DEV route is reachable and the operator has
authorized a short read-only window:
```sh
node scripts/dev-m4-agent-loop-smoke.mjs --live --confirm-dev --confirmed-non-production
```
The live path must only observe existing DEV state. It must not read tokens or
secrets, must not try to run a real agent workload, and must stop if the M3
runtime preconditions are not ready.
On D601, the live preflight also records native k3s evidence with the explicit
kubeconfig and namespace:
```sh
KUBECONFIG=/etc/rancher/k3s/k3s.yaml kubectl -n hwlab-dev get pods,svc,deploy,job,cm -o wide
```
Worker createability is checked with server-side dry-run admission from the
existing `hwlab-agent-worker-template`. The generated Job stays suspended and is
not persisted:
```sh
KUBECONFIG=/etc/rancher/k3s/k3s.yaml kubectl -n hwlab-dev create -f - --dry-run=server -o json
```
The smoke may check Secret RBAC with `kubectl auth can-i`, but it must not read
Secret resources, kubeconfig contents, or token values.
Any hardware assistance from M4 must go through the cloud API hardware surface
and the patch-panel trusted path for `DO1 -> patch-panel -> DI1`. The agent
must not connect directly to box or gateway simulators.
## Expected Evidence
- `agent-mgr` creates a scoped worker session.
- The worker workspace is isolated per session.
- The skills artifact is tied to an explicit commit.
- Trace, evidence, and cleanup records stay linked.
- If live DEV is blocked, the report must say why and keep the blocker class
explicit.