Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/workflows/kaggle-real-go-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
shell: bash
run: |
set -euo pipefail
python3 -m py_compile scripts/kaggle_go_consensus_cpu.py
mkdir -p "$RUNNER_TEMP/zephyr-go-dataset" "$RUNNER_TEMP/zephyr-go-kernel" evidence
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go test -c \
-o "$RUNNER_TEMP/zephyr-go-dataset/zephyr_consensus.test" \
Expand Down Expand Up @@ -115,7 +116,17 @@ jobs:
echo "::error::Private dataset not READY within bounded wait"
exit 1
}
# Confirm actual published binary and hash pins BEFORE using CPU time.
published="$(timeout 40s kaggle datasets files "$dataset")"
for needed in zephyr_consensus.test expected_sha256.txt source_sha.txt LICENSE; do
if ! grep -Fq "$needed" <<< "$published"; then
echo "::error::Missing published Kaggle dataset file: $needed"
exit 1
fi
done
echo "Private binary dataset READY with all expected files"
- name: Run private CPU-only Kaggle notebook against pinned Go binary
id: kaggle_submission
env:
KAGGLE_API_TOKEN: ${{ secrets.KAGGLE_API_TOKEN }}
shell: bash
Expand Down Expand Up @@ -177,6 +188,41 @@ jobs:
print("Kaggle CPU compiled-Go consensus unit test gate ACCEPTED")
print("Go tests passed:", report["passed_test_cases"])
PY
- name: Retrieve sanitized remote traceback automatically on failure
if: ${{ failure() && steps.kaggle_submission.conclusion == 'success' }}
env:
KAGGLE_API_TOKEN: ${{ secrets.KAGGLE_API_TOKEN }}
shell: bash
run: |
set -euo pipefail
echo "::add-mask::$KAGGLE_API_TOKEN"
mkdir -p evidence/output
kernel="$KAGGLE_USERNAME/zephyr-chain-real-go-consensus-cpu"
timeout 90s kaggle kernels output "$kernel" -p evidence/output -o > "$RUNNER_TEMP/kaggle-error-cli.txt" 2>&1 || true
python3 - <<'PY'
import os, pathlib, re
root = pathlib.Path("evidence/output")
lines = []
for f in list(root.rglob("*.log"))[:5]:
if f.is_file() and f.stat().st_size <= 4_000_000:
lines.extend(f.read_text(errors="replace").splitlines())
lines.extend((pathlib.Path(os.environ["RUNNER_TEMP"]) / "kaggle-error-cli.txt").read_text(errors="replace").splitlines())
cues = re.compile(r"traceback|error|exception|mount|dataset|not found|denied|missing", re.I)
selected = set()
for i, line in enumerate(lines):
if cues.search(line):
selected.update(range(max(0, i-1), min(len(lines), i+3)))
report = []
for i in sorted(selected)[-70:]:
item = lines[i][:600]
if re.search(r"token|api.?key|authorization|bearer|password|secret|credential", item, re.I):
item = "[redacted sensitive-looking line]"
report.append(item)
if not report:
report.append("No remote traceback available from Kaggle CLI output")
pathlib.Path("evidence/kaggle-go-runtime-error.txt").write_text("\n".join(report) + "\n")
print("\n".join(report)[:6000])
PY
- name: Preserve only nonsecret test evidence
if: always()
uses: actions/upload-artifact@v4
Expand All @@ -185,5 +231,6 @@ jobs:
path: |
evidence/manifest.json
evidence/output/zephyr_kaggle_go_consensus.json
evidence/kaggle-go-runtime-error.txt
if-no-files-found: warn
retention-days: 14
30 changes: 25 additions & 5 deletions scripts/kaggle_go_consensus_cpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,31 @@ def main():
raise RuntimeError("Unexpected Kaggle CPU architecture")
if any(any(Path("/dev").glob(name)) for name in ("nvidia[0-9]*", "nvidiactl", "nvidia-uvm")):
raise RuntimeError("GPU device detected, refusing CPU-only job")
binary = DATA_DIR / BINARY_NAME
expected_file = DATA_DIR / "expected_sha256.txt"
source_file = DATA_DIR / "source_sha.txt"
if not binary.is_file() or not expected_file.is_file() or not source_file.is_file():
raise RuntimeError("Missing trusted private dataset binary or hash pins")
# The private Kaggle source can be mounted beneath a generated directory
# rather than the assumed dataset slug. Discover only inside /kaggle/input,
# never download network code or run unpinned executable contents.
candidates = [DATA_DIR] if DATA_DIR.is_dir() else []
root = Path("/kaggle/input")
if root.is_dir():
candidates += sorted({
p.parent for p in root.rglob("expected_sha256.txt")
if "zephyr-chain-offline-consensus-cpu" in p.parts
})
accepted = []
for folder in candidates:
binary_file = folder / BINARY_NAME
digest_file = folder / "expected_sha256.txt"
source_file_candidate = folder / "source_sha.txt"
if binary_file.is_file() and digest_file.is_file() and source_file_candidate.is_file():
accepted.append((binary_file, digest_file, source_file_candidate))
# More than one eligible bundle is ambiguous: never silently choose one.
if len(set(accepted)) != 1:
mounted = sorted(p.name for p in root.iterdir())[:30] if root.is_dir() else []
raise RuntimeError(
"Trusted private dataset mount unresolved: "
f"eligible_bundles={len(set(accepted))}; mounted_roots={mounted}"
)
binary, expected_file, source_file = accepted[0]
expected = expected_file.read_text(encoding="utf-8").strip()
actual = hashlib.sha256(binary.read_bytes()).hexdigest()
if len(expected) != 64 or actual != expected:
Expand Down
Loading