Skip to content

ci: finalize nanoGPT stale-completion guard #1

ci: finalize nanoGPT stale-completion guard

ci: finalize nanoGPT stale-completion guard #1

name: Finalize nanoGPT stale-completion guard
on:
push:
branches:
- "agent/fix-nanogpt-stale-completion"
paths:
- ".github/workflows/fix-nanogpt-stale-completion-final.yml"
permissions:
contents: write
jobs:
patch-test-and-publish:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
with:
ref: agent/fix-nanogpt-stale-completion
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: pip
cache-dependency-path: baseline/nanogpt_one_head/pyproject.toml
- name: Apply reviewed guard and align synthetic checkpoint inventory
shell: bash
run: |
set -euo pipefail
awk '
/- name: Reapply the reviewed patch and repair transcription typos/ {
section=1
next
}
section && /run: \|/ { capture=1; next }
capture && /^ - name:/ { exit }
capture { sub(/^ /, ""); print }
' .github/workflows/fix-nanogpt-stale-completion-retry.yml \
> /tmp/apply_guard.sh
bash /tmp/apply_guard.sh
python - <<'PY'
from pathlib import Path
path = Path("baseline/nanogpt_one_head/tests/test_completion.py")
text = path.read_text(encoding="utf-8")
needle = " return run_dir, fingerprint, total_steps\n"
if text.count(needle) != 1:
raise RuntimeError("unexpected completed-run fixture return shape")
replacement = '''\
# Keep the synthetic fixture's physical checkpoint inventory identical to
# the exact paths persisted in epoch_metrics.csv.
inventory = pd.read_csv(run_dir / "epoch_metrics.csv")

Check failure on line 56 in .github/workflows/fix-nanogpt-stale-completion-final.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/fix-nanogpt-stale-completion-final.yml

Invalid workflow file

You have an error in your yaml syntax on line 56
for value in inventory["checkpoint_path"]:
checkpoint_path = Path(str(value))
checkpoint_path.parent.mkdir(parents=True, exist_ok=True)
if not checkpoint_path.is_file():
checkpoint_path.write_bytes(b"synthetic epoch checkpoint")
return run_dir, fingerprint, total_steps
'''
path.write_text(text.replace(needle, replacement, 1), encoding="utf-8")
PY
- name: Install one-head nanoGPT test environment
run: |
python -m pip install --upgrade pip
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
python -m pip install -e './baseline/nanogpt_one_head[dev]'
python -m pip check
- name: Compile and test one-head package
env:
PYTHONPATH: baseline/nanogpt_one_head/src
MPLBACKEND: Agg
run: |
git diff --check
python -m compileall -q \
baseline/nanogpt_one_head/src \
baseline/nanogpt_one_head/tests
pytest -q baseline/nanogpt_one_head/tests
- name: Commit tested fix
shell: bash
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email \
"41898282+github-actions[bot]@users.noreply.github.com"
git add \
baseline/nanogpt_one_head/src/rg_nanogpt_one_head/completion.py \
baseline/nanogpt_one_head/src/rg_nanogpt_one_head/engine.py \
baseline/nanogpt_one_head/src/rg_nanogpt_one_head/run_utils.py \
baseline/nanogpt_one_head/tests/test_completion.py
git commit -m "Reject stale completed one-head nanoGPT runs"
git push origin HEAD:agent/fix-nanogpt-stale-completion