Repository navigation
245 lines (226 loc) · 8.72 KB
/
Copy pathevals.yml
File metadata and controls
245 lines (226 loc) · 8.72 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
name: Gated evals
on:
workflow_dispatch:
inputs:
suite:
description: Eval suite to run
type: choice
required: true
default: content-parity
options:
- content-parity
- brain
- content-question-search
- all
schedule:
- cron: "0 9 * * *"
concurrency:
group: gated-evals-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
gated-evals:
name: Gated evals
runs-on: ubuntu-latest
timeout-minutes: 30
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
CONTENT_PARITY_OWNER_EMAIL: ${{ secrets.CONTENT_PARITY_OWNER_EMAIL }}
CONTENT_PARITY_ORG_ID: ${{ secrets.CONTENT_PARITY_ORG_ID }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "22"
cache: "pnpm"
- name: Restore dist + tsBuildInfo cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
packages/*/dist
packages/*/node_modules/.cache/tsbuildinfo
key: dist-${{ hashFiles('packages/*/src/**', 'pnpm-lock.yaml') }}
restore-keys: dist-
- run: pnpm install --frozen-lockfile
- name: Run requested eval suites
shell: bash
run: |
set -euo pipefail
suite="${{ inputs.suite || 'all' }}"
{
echo "## Gated evals"
echo ""
echo "Requested suite: \`$suite\`"
echo ""
} >> "$GITHUB_STEP_SUMMARY"
wants() {
[[ "$suite" == "all" || "$suite" == "$1" ]]
}
append_eval_summary() {
local title="$1"
local file="$2"
node - "$title" "$file" "$GITHUB_STEP_SUMMARY" <<'NODE'
const fs = require("fs");
const [title, file, summaryPath] = process.argv.slice(2);
const data = JSON.parse(fs.readFileSync(file, "utf8"));
if (!data.report) {
const detail = typeof data.error === "string"
? data.error
: typeof data.error?.message === "string"
? data.error.message
: "The eval output did not include a report.";
const lines = [
`### ${title}`,
"",
"Status: FAIL",
"",
`Error: ${detail}`,
"",
];
fs.appendFileSync(summaryPath, lines.join("\n") + "\n");
process.exit(0);
}
const report = data.report ?? { total: 0, passed: 0, failed: 0, skipped: 0, results: [] };
const skipped = report.skipped ?? report.results.filter((row) => row.status === "skipped").length;
const executed = report.total - skipped;
const executedPassed = report.passed - skipped;
const status = executed === 0 && skipped > 0 ? "SKIPPED" : data.ok ? "PASS" : "FAIL";
const lines = [
`### ${title}`,
"",
`Status: ${status}`,
"",
`Executed: ${executedPassed}/${executed} passed; skipped: ${skipped}; failed: ${report.failed}.`,
"",
];
for (const row of report.results) {
if (row.status === "skipped") {
lines.push(`- ${row.eval}: skipped (${row.skipReason ?? "no reason"})`);
} else {
lines.push(`- ${row.eval}: ${row.passed ? "passed" : "failed"}`);
}
}
lines.push("");
fs.appendFileSync(summaryPath, `${lines.join("\n")}\n`);
NODE
}
if wants content-parity; then
echo "Checking Content parity eval prerequisites"
if [[ -z "${ANTHROPIC_API_KEY:-}${OPENAI_API_KEY:-}${OPENROUTER_API_KEY:-}" ]]; then
skip_reason="no model provider secret is configured"
elif [[ -z "${CONTENT_PARITY_OWNER_EMAIL:-}" || -z "${CONTENT_PARITY_ORG_ID:-}" ]]; then
skip_reason="explicit production eval owner and organization secrets are not configured"
elif [[ ! -f templates/content/evals/production-context.ts ]]; then
skip_reason="Content does not provide evals/production-context.ts"
else
skip_reason=""
fi
if [[ -n "$skip_reason" ]]; then
unset CONTENT_PARITY_EVALS || true
{
echo "### Content parity"
echo ""
echo "Status: SKIPPED"
echo ""
echo "Reason: $skip_reason."
echo ""
} >> "$GITHUB_STEP_SUMMARY"
else
export CONTENT_PARITY_EVALS=1
set +e
(
cd templates/content
./node_modules/.bin/agent-native eval parity \
--owner-email "$CONTENT_PARITY_OWNER_EMAIL" \
--org-id "$CONTENT_PARITY_ORG_ID" \
--json
) | tee content-parity-evals.json
eval_status=$?
if [[ -s content-parity-evals.json ]]; then
append_eval_summary "Content parity" content-parity-evals.json
summary_status=$?
else
summary_status=1
fi
set -e
if [[ "$summary_status" -ne 0 ]]; then
{
echo "### Content parity"
echo ""
echo "Status: FAIL"
echo ""
echo "The eval command did not produce a usable JSON report; see the step logs."
echo ""
} >> "$GITHUB_STEP_SUMMARY"
if [[ "$eval_status" -eq 0 ]]; then
eval_status="$summary_status"
fi
fi
if node - content-parity-evals.json >/dev/null 2>&1 <<'NODE'
const fs = require("fs");
const data = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
if (data.ok !== true || !data.report) process.exit(1);
NODE
then
:
elif [[ "$eval_status" -eq 0 ]]; then
eval_status=1
fi
if [[ "$eval_status" -ne 0 ]]; then
exit "$eval_status"
fi
fi
fi
# A one-off comparison that calls models on every run, so only when
# asked for by name, never in the daily run.
if [[ "$suite" == "content-question-search" ]]; then
if [[ -z "${OPENAI_API_KEY:-}" ]]; then
{
echo "### Content question search"
echo ""
echo "Status: FAILED"
echo ""
echo "Reason: no OpenAI key is configured."
echo ""
} >> "$GITHUB_STEP_SUMMARY"
# It runs only when asked for, so a missing key fails the run.
exit 1
else
report_dir="$RUNNER_TEMP/question-search"
export SEARCH_QUESTION_BAKEOFF=1 SEARCH_QUESTION_BAKEOFF_REPORT="$report_dir"
# The report names the method that leaked, so a failed run keeps it.
set +e
pnpm --filter content exec vitest run evals/question-search
eval_status=$?
set -e
if [[ -f "$report_dir/question-search-bakeoff.md" ]]; then
cat "$report_dir/question-search-bakeoff.md" >> "$GITHUB_STEP_SUMMARY"
fi
if [[ "$eval_status" -ne 0 ]]; then
exit "$eval_status"
fi
fi
fi
if wants brain; then
echo "Running Brain deterministic action evals"
pnpm test:brain-evals
{
echo "### Brain"
echo ""
echo "Status: PASS"
echo ""
echo "The existing Brain eval command is action/fixture based and remains classified as deterministic in this PR."
echo ""
} >> "$GITHUB_STEP_SUMMARY"
fi
- name: Upload the question search bake-off report
if: ${{ always() && inputs.suite == 'content-question-search' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: content-question-search-bakeoff
path: ${{ runner.temp }}/question-search
if-no-files-found: ignore