Skip to content

Commit 16de5f7

Browse files
committed
infra: explicitly seed cache and execute frozen V123
1 parent 6b6a95a commit 16de5f7

1 file changed

Lines changed: 114 additions & 10 deletions

File tree

.github/workflows/trace-ace-transcript-cache-seed.yml

Lines changed: 114 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Trace Ace Transcript Cache Seed
1+
name: Trace Ace Transcript Cache Seed and V123
22

33
on:
44
push:
@@ -7,21 +7,35 @@ on:
77
- '.github/workflows/trace-ace-transcript-cache-seed.yml'
88
workflow_dispatch:
99

10+
permissions:
11+
contents: write
12+
actions: read
13+
1014
concurrency:
1115
group: trace-ace-frozen-transcripts-v1
1216
cancel-in-progress: false
1317

1418
jobs:
15-
seed:
19+
seed-and-v123:
1620
runs-on: ubuntu-24.04
17-
timeout-minutes: 15
21+
timeout-minutes: 20
1822
steps:
19-
- name: Install gdown
20-
run: python -m pip install --disable-pip-version-check gdown
23+
- name: Check out frozen V123 experiment branch
24+
uses: actions/checkout@v4
25+
with:
26+
ref: agent/v123-cache-seeded-rerun
27+
28+
- uses: actions/setup-python@v5
29+
with:
30+
python-version: '3.12'
31+
cache: pip
32+
33+
- name: Install dependencies
34+
run: python -m pip install --disable-pip-version-check numpy pandas scipy scikit-learn gdown
2135

2236
- name: Restore frozen transcript archive from GitHub cache
2337
id: transcript-cache
24-
uses: actions/cache@v4
38+
uses: actions/cache/restore@v4
2539
with:
2640
path: transcripts.zip
2741
key: trace-ace-transcripts-v1-603547640
@@ -42,6 +56,7 @@ jobs:
4256
echo "Downloaded $bytes bytes"
4357
if [ "$bytes" = "603547640" ]; then
4458
echo "Frozen transcript archive size verified"
59+
echo "TRANSCRIPT_SOURCE_ID=$id" >> "$GITHUB_ENV"
4560
break
4661
fi
4762
echo "Unexpected transcript archive size: $bytes" >&2
@@ -53,10 +68,99 @@ jobs:
5368
unzip -tq transcripts.zip >/dev/null
5469
echo "Frozen transcript archive ZIP integrity verified"
5570
56-
- name: Report cache state
71+
- name: Validate restored/downloaded archive and record digest
72+
shell: bash
73+
run: |
74+
set -euo pipefail
75+
test -f transcripts.zip
76+
test "$(stat -c%s transcripts.zip)" = "603547640"
77+
unzip -tq transcripts.zip >/dev/null
78+
sha256sum transcripts.zip | tee transcript_sha256.txt
79+
echo "TRANSCRIPT_SHA256=$(cut -d' ' -f1 transcript_sha256.txt)" >> "$GITHUB_ENV"
80+
echo "TRANSCRIPT_BYTES=$(stat -c%s transcripts.zip)" >> "$GITHUB_ENV"
81+
if [ "${{ steps.transcript-cache.outputs.cache-hit }}" = "true" ]; then
82+
echo "TRANSCRIPT_SOURCE_ID=GITHUB_CACHE" >> "$GITHUB_ENV"
83+
fi
84+
85+
- name: Save frozen transcript archive to GitHub cache
86+
id: transcript-cache-save
87+
if: steps.transcript-cache.outputs.cache-hit != 'true'
88+
uses: actions/cache/save@v4
89+
with:
90+
path: transcripts.zip
91+
key: trace-ace-transcripts-v1-603547640
92+
93+
- name: Download metadata and extract frozen data
94+
shell: bash
95+
run: |
96+
set -euo pipefail
97+
gdown 1EpqoamY0vFI2qE57R6wdqU5HwuoVk3Zz -O metadata.zip
98+
mkdir -p data/meta data/transcripts
99+
unzip -q metadata.zip -d data/meta
100+
unzip -q transcripts.zip -d data/transcripts
101+
echo "FEATURES=$(find data/meta -type f -name 'train_features*.csv' -print -quit)" >> "$GITHUB_ENV"
102+
echo "LABELS=$(find data/meta -type f -name 'train_labels*.csv' -print -quit)" >> "$GITHUB_ENV"
103+
FIRST=$(find data/transcripts -type f -name '*.csv' -print -quit)
104+
test -n "$FIRST"
105+
echo "TRANSCRIPTS=$(dirname "$FIRST")" >> "$GITHUB_ENV"
106+
107+
- name: Preflight frozen V123
108+
run: python -m py_compile competitions/trace_the_ace/v123_official_reference_scalars.py
109+
110+
- name: Run frozen V123
111+
run: python competitions/trace_the_ace/v123_official_reference_scalars.py --features "$FEATURES" --labels "$LABELS" --transcripts "$TRANSCRIPTS" --rows 2500 --out v123_official_reference_scalars.json
112+
113+
- name: Show V123 decision
114+
if: always()
115+
run: test -f v123_official_reference_scalars.json && cat v123_official_reference_scalars.json || true
116+
117+
- name: Record authoritative run metadata
118+
if: always()
119+
env:
120+
GH_TOKEN: ${{ github.token }}
57121
shell: bash
58122
run: |
59123
set -euo pipefail
60-
echo "cache-hit=${{ steps.transcript-cache.outputs.cache-hit }}"
61-
echo "cache-key=trace-ace-transcripts-v1-603547640"
62-
echo "archive-bytes=$(stat -c%s transcripts.zip)"
124+
JOB_ID=$(python - <<'PY'
125+
import json, os, urllib.request
126+
req=urllib.request.Request(
127+
f"https://api.github.com/repos/{os.environ['GITHUB_REPOSITORY']}/actions/runs/{os.environ['GITHUB_RUN_ID']}/jobs",
128+
headers={"Authorization": f"Bearer {os.environ['GH_TOKEN']}", "Accept":"application/vnd.github+json"})
129+
with urllib.request.urlopen(req) as r:
130+
data=json.load(r)
131+
print(data['jobs'][0]['id'])
132+
PY
133+
)
134+
CACHE_HIT='${{ steps.transcript-cache.outputs.cache-hit }}'
135+
CACHE_SAVE='${{ steps.transcript-cache-save.outcome }}'
136+
python - <<PY
137+
import json, os, pathlib
138+
v={}
139+
p=pathlib.Path('v123_official_reference_scalars.json')
140+
if p.exists(): v=json.loads(p.read_text())
141+
out={
142+
'run_id': int(os.environ['GITHUB_RUN_ID']),
143+
'job_id': int('$JOB_ID'),
144+
'run_attempt': int(os.environ['GITHUB_RUN_ATTEMPT']),
145+
'cache_key': 'trace-ace-transcripts-v1-603547640',
146+
'cache_hit': '$CACHE_HIT',
147+
'cache_save_outcome': '$CACHE_SAVE',
148+
'source_id': os.environ.get('TRANSCRIPT_SOURCE_ID','UNKNOWN'),
149+
'archive_bytes': int(os.environ.get('TRANSCRIPT_BYTES','0')),
150+
'archive_sha256': os.environ.get('TRANSCRIPT_SHA256','UNKNOWN'),
151+
'validation': 'exact size 603547640 + unzip integrity; SHA256 recorded, no historical expected digest precommitted',
152+
'v123': v,
153+
}
154+
pathlib.Path('/tmp/trace_ace_v123_run_status.json').write_text(json.dumps(out,indent=2))
155+
print(json.dumps(out,indent=2))
156+
PY
157+
git fetch origin main
158+
git worktree add /tmp/status-main origin/main
159+
cd /tmp/status-main
160+
mkdir -p competitions/trace_the_ace/results
161+
cp /tmp/trace_ace_v123_run_status.json competitions/trace_the_ace/results/V123_LATEST_RUN_STATUS.json
162+
git config user.name github-actions[bot]
163+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
164+
git add competitions/trace_the_ace/results/V123_LATEST_RUN_STATUS.json
165+
git commit -m "results: record V123 run $GITHUB_RUN_ID" || true
166+
git push origin HEAD:main

0 commit comments

Comments
 (0)