-
Notifications
You must be signed in to change notification settings - Fork 4
266 lines (245 loc) · 9.57 KB
/
Copy pathe2e-kind.yaml
File metadata and controls
266 lines (245 loc) · 9.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# Copyright 2026 The Actordock Authors.
# SPDX-License-Identifier: Apache-2.0
name: e2e-kind
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.24.x"
- name: Test
run: go test ./...
e2e-functional:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.24.x"
- name: Install kind
run: |
curl -fsSL -o ./kind "https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64"
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
- name: Create cluster and deploy
env:
KIND_CLUSTER_NAME: actordock-functional
POLICY: semantic-score
run: |
chmod +x hack/*.sh
./hack/kind-up.sh
- name: Functional e2e (all four policies via SetPolicy)
env:
KIND_CLUSTER_NAME: actordock-functional
E2E_SUITE: functional
SANDBOX_COUNT: "5"
MAX_RUNNING: "4"
MIN_WORKERS: "2"
run: ./hack/verify-local.sh
- name: Dump on failure
if: failure()
run: |
kubectl --context kind-actordock-functional -n actordock get pods -o wide || true
kubectl --context kind-actordock-functional -n actordock describe pods || true
kubectl --context kind-actordock-functional -n actordock logs deploy/controlplane --all-containers=true || true
kubectl --context kind-actordock-functional -n actordock logs statefulset/worker --all-containers=true || true
- name: Teardown
if: always()
env:
KIND_CLUSTER_NAME: actordock-functional
run: ./hack/kind-down.sh || true
# Parallel ablation: one Kind cluster per policy variant (no mid-run POLICY switch).
e2e-eval:
runs-on: ubuntu-latest
timeout-minutes: 240
strategy:
fail-fast: false
matrix:
include:
- label: random
policy: random
prior_mix: ""
cluster: actordock-eval-random
- label: resource-evict
policy: resource-evict
prior_mix: ""
cluster: actordock-eval-re
- label: semantic-score-l1
policy: semantic-score
prior_mix: "0"
cluster: actordock-eval-l1
- label: semantic-score
policy: semantic-score
prior_mix: "0.3"
cluster: actordock-eval-full
name: e2e-eval (${{ matrix.label }})
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.24.x"
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install kind
run: |
curl -fsSL -o ./kind "https://kind.sigs.k8s.io/dl/v0.27.0/kind-linux-amd64"
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
- name: Create cluster and deploy
env:
KIND_CLUSTER_NAME: ${{ matrix.cluster }}
POLICY: ${{ matrix.policy }}
SEMANTIC_PRIOR_MIX: ${{ matrix.prior_mix }}
run: |
chmod +x hack/*.sh hack/replay-agent-semantic.py
./hack/kind-up.sh
- name: Agent-semantic replay (full @v2 / 2 workers)
env:
KIND_CLUSTER_NAME: ${{ matrix.cluster }}
E2E_SUITE: agent-semantic
ACTORDOCK_API: http://127.0.0.1:18080
EVAL_OUT_DIR: docs/eval/results
AGENT_SEMANTIC_LIMIT: "10"
AGENT_SEMANTIC_INFLIGHT: "8"
AGENT_SEMANTIC_MIN_WORKERS: "2"
AGENT_SEMANTIC_SPEED: "1"
AGENT_SEMANTIC_MIN_LOCK: "0.25"
AGENT_SEMANTIC_POLICIES: ${{ matrix.label }}
AGENT_SEMANTIC_SWITCH_POLICY: "0"
run: ./hack/verify-local.sh
- name: Publish policy summary on Actions page
if: success() || failure()
env:
LABEL: ${{ matrix.label }}
run: |
python3 - <<'PY'
import json, os
from pathlib import Path
label = os.environ["LABEL"]
out = Path(os.environ.get("GITHUB_STEP_SUMMARY", "/dev/null"))
p = Path(f"docs/eval/results/agent_semantic_v2__{label}.json")
lines = [f"## agent-semantic `{label}`", ""]
if not p.exists():
lines += [f"_missing {p}_", ""]
else:
r = json.loads(p.read_text())
lines += [
"| metric | value |",
"|--------|------:|",
f"| sessions ok/fail | {r.get('sessions_ok')}/{r.get('sessions_failed')} |",
f"| mid_tool | {r.get('mid_tool_suspend', 0)} |",
f"| mid_tool_rate | {float(r.get('mid_tool_rate') or 0):.2f} |",
f"| suspend | {r.get('suspend_total', 0)} |",
f"| hard_rate | {float(r.get('victim_l3_hard_rate') or 0):.2f} |",
f"| vic_hard / vic_easy | {r.get('victim_l3_hard', 0)} / {r.get('victim_l3_easy', 0)} |",
f"| resume_hard_s / resume_easy_s | {float(r.get('resume_sec_l3_hard') or 0):.3f} / {float(r.get('resume_sec_l3_easy') or 0):.3f} |",
f"| victim_cx | {float(r.get('victim_complexity_mean') or 0):.3f} |",
f"| resume_wait_s | {float(r.get('resume_wait_mean_s') or 0):.3f} |",
f"| wall_s | {float(r.get('wall_sec') or 0):.1f} |",
"",
f"victims=`{r.get('victim_by_cohort')}`",
"",
]
out.write_text("\n".join(lines) + "\n")
print("".join(line + "\n" for line in lines))
PY
- name: Upload policy result
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: agent-semantic-${{ matrix.label }}
path: docs/eval/results/agent_semantic_v2__${{ matrix.label }}.json
if-no-files-found: warn
- name: Dump on failure
if: failure()
run: |
kubectl --context kind-${{ matrix.cluster }} -n actordock get pods -o wide || true
kubectl --context kind-${{ matrix.cluster }} -n actordock describe pods || true
kubectl --context kind-${{ matrix.cluster }} -n actordock logs deploy/controlplane --all-containers=true || true
kubectl --context kind-${{ matrix.cluster }} -n actordock logs statefulset/worker --all-containers=true || true
- name: Teardown
if: always()
env:
KIND_CLUSTER_NAME: ${{ matrix.cluster }}
run: ./hack/kind-down.sh || true
e2e-eval-merge:
runs-on: ubuntu-latest
needs: e2e-eval
if: always() && !cancelled()
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Download policy artifacts
uses: actions/download-artifact@v4
with:
pattern: agent-semantic-*
path: docs/eval/results/parts
merge-multiple: true
- name: Merge compare table + gate
env:
EVAL_OUT_DIR: docs/eval/results
run: |
chmod +x hack/replay-agent-semantic.py
mkdir -p docs/eval/results
# Flatten downloaded JSONs into results/
find docs/eval/results/parts -name 'agent_semantic_v2__*.json' -exec cp -f {} docs/eval/results/ \;
ls -la docs/eval/results/agent_semantic_v2__*.json
python3 hack/replay-agent-semantic.py --merge-only --out docs/eval/results
python3 - <<'PY'
import json, os, sys
from pathlib import Path
out = Path("docs/eval/results")
want = ["random", "resource-evict", "semantic-score-l1", "semantic-score"]
failed = []
missing = []
for label in want:
p = out / f"agent_semantic_v2__{label}.json"
if not p.exists():
missing.append(label)
continue
r = json.loads(p.read_text())
if int(r.get("sessions_failed") or 0) != 0 or int(r.get("sessions_ok") or 0) <= 0:
failed.append(f"{p.name}: ok={r.get('sessions_ok')} fail={r.get('sessions_failed')}")
compare = out / "policy_compare_agent_semantic_v2.md"
if not compare.exists():
sys.exit("missing policy_compare_agent_semantic_v2.md")
body = compare.read_text()
print(body)
# Show full compare on the Actions run Summary tab (no artifact download needed).
summary = Path(os.environ.get("GITHUB_STEP_SUMMARY", ""))
if str(summary):
with summary.open("a", encoding="utf-8") as f:
f.write(body)
if missing:
f.write("\n\n**MISSING:** " + ", ".join(missing) + "\n")
if failed:
f.write("\n\n**FAILED:**\n\n- " + "\n- ".join(failed) + "\n")
if missing:
print("MISSING:", ", ".join(missing))
sys.exit(1)
if failed:
print("FAILED:", *failed, sep="\n ")
sys.exit(1)
print(f"ok: {len(want)} policy report(s)")
PY
- name: Upload merged compare (optional archive)
if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: agent-semantic-policy-compare
path: |
docs/eval/results/policy_compare_agent_semantic_v2.md
docs/eval/results/agent_semantic_v2__*.json
if-no-files-found: warn