Skip to content

chore: document and package research v1 artifacts - #6

Merged
Ian747-tw merged 1 commit into
mainfrom
chore/research-v1-release-artifacts
May 21, 2026
Merged

Ian747-tw merged 1 commit into
mainfrom
chore/research-v1-release-artifacts

Conversation

@Ian747-tw

@Ian747-tw Ian747-tw commented May 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR adds tooling and docs for distributing the Research V1 generated foundation artifacts through GitHub Releases instead of committing them to git.

Changes:

  • Adds scripts/package_research_v1_artifacts.py.
  • Adds scripts/download_research_v1_artifacts.py.
  • Adds Make targets for package/download/validate.
  • Updates README and Research V1 docs with release download instructions.
  • Adds tests for artifact packaging/download behavior.
  • Keeps generated checkpoints, eval CSVs, and failure buffers out of git.

Shared artifacts

Release:

research-v1-foundation-v1

Assets:

research_v1_foundation_artifacts.tar.gz
research_v1_artifact_manifest.json

Extracted expected paths:

runs/research_v1/base_pretrain_s42/checkpoints/final.zip
runs/research_v1/eval_base_pretrain/eval/heldout_random.csv
runs/research_v1/base_explore_large/buffers/failure_buffer.jsonl

Local release validation

  • python scripts/check_research_v1_ready.py --root runs/research_v1 --checkpoint runs/research_v1/base_pretrain_s42/checkpoints/final.zip --eval-csv runs/research_v1/eval_base_pretrain/eval/heldout_random.csv --buffer runs/research_v1/base_explore_large/buffers/failure_buffer.jsonl --min-failures 1000 --min-episodes 100 --min-success-rate 0.10 --min-route-completion 0.35 --max-timeout-rate 0.95 -> PASS
  • python scripts/package_research_v1_artifacts.py --root runs/research_v1 --output dist/research_v1_foundation_artifacts.tar.gz --release-name research-v1-foundation-v1 -> PASS
  • tar -tzf dist/research_v1_foundation_artifacts.tar.gz | head -50 showed the manifest plus the three expected artifact paths
  • Release created: https://github.com/Ian747-tw/MetaDrive-Experiment-Framework/releases/tag/research-v1-foundation-v1
  • Download smoke test in /tmp/fasb_release_download_test downloaded and extracted the archive from GitHub successfully

Artifact metrics

Base checkpoint eval:

  • success_rate: 0.44
  • route_completion_mean: 0.6997981008191991
  • timeout_rate: 0.56

Large buffer:

  • record_count: 2178
  • distinct_seed_count: 2178
  • unknown_fraction: 0.04178145087235996
  • failure_mode_counts: {'collision': 855, 'offroad': 992, 'solved': 1, 'timeout_or_hesitation': 239, 'unknown': 91}

Source validation

  • python -m compileall fasb tests scripts examples -q
  • python -m pytest tests/test_component_validation.py tests/test_failure_buffer.py tests/test_metrics.py tests/test_training_stability_patch.py tests/test_plugin_loading.py tests/test_run_dir.py tests/test_research_plugins.py tests/test_aggregate_results.py tests/test_base_checkpoint_quality.py tests/test_failure_buffer_quality.py tests/test_research_v1_ready.py tests/test_research_v1_artifact_scripts.py -q -> 52 passed
  • python scripts/validate_components.py --config configs/train/fasb_ppo.yaml -> PASS
  • python scripts/check_env.py --require-metadrive -> PASS
  • python scripts/run_e2e_stress.py --clean-runs -> PASS

Review focus

Please review:

  • Whether release-based sharing is clear enough for teammates.
  • Whether scripts avoid committing generated artifacts.
  • Whether manifest/checksum behavior is safe.
  • Whether download script protects existing local artifacts, validates safe extraction/canonical repo provenance, handles manifest fallback safely, validates replacements before force overwrite, honors archive directory paths, and remains compatible with supported Python 3.10 runtimes.
  • Whether Axis 1-4 docs clearly require the same release-provided checkpoint and buffer.

@Ian747-tw

Copy link
Copy Markdown
Owner Author

@codex review this PR. Focus on Research V1 artifact distribution: GitHub Release packaging, teammate download workflow, manifest/checksum safety, docs clarity, and ensuring generated checkpoints/buffers stay out of git while remaining unified for Axis 1-4.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: beafe8e051

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +60 to +62
target = (destination / member.name).resolve()
if not str(target).startswith(str(destination_resolved)):
raise ValueError(f"archive member escapes destination: {member.name}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use path-bound checks instead of string prefix for tar members

The extraction guard compares str(target).startswith(str(destination_resolved)), which is bypassable for sibling paths that share the same prefix (for example, a resolved target under /tmp/research_v1_extract_xxx_evil still starts with /tmp/research_v1_extract_xxx). In that case a crafted archive member can escape the temp extraction directory and write outside the intended sandbox during teammate downloads. This should use a true path containment check (e.g., target.is_relative_to(destination_resolved) or equivalent) rather than string prefix matching.

Useful? React with 👍 / 👎.

Comment on lines +43 to +47
"gh",
"release",
"download",
release,
"--pattern",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pin release downloads to canonical repository

The download command does not pass --repo, so gh release download resolves against whatever repository context the user has locally. In fork-based workflows, the same release tag can exist with different artifacts, and this script will accept those as long as readiness thresholds pass, which breaks the Axis 1–4 requirement to use the shared canonical checkpoint/buffer set. Please pin downloads to the expected repo (or validate manifest["repo"] before copying files) to avoid silent divergence.

Useful? React with 👍 / 👎.

@Ian747-tw
Ian747-tw force-pushed the chore/research-v1-release-artifacts branch from beafe8e to f4298f8 Compare May 21, 2026 11:33
@Ian747-tw

Copy link
Copy Markdown
Owner Author

@codex review this PR again. I addressed both prior findings in f4298f8: tar extraction now uses a real path containment check, release downloads are pinned to Ian747-tw/MetaDrive-Experiment-Framework, and manifests with a different repo are rejected with tests. Please check for remaining blockers.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4298f87c0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

raise FileNotFoundError(f"archive missing artifact: {entry['path']}")
path.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(source, path)
shutil.copy2(extracted_manifest, manifest_path)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Skip manifest copy when source already equals destination

When the archive does not contain research_v1_artifact_manifest.json but a local manifest exists, extracted_manifest is reassigned to manifest_path and this line then calls shutil.copy2 with the same source and destination. Python raises SameFileError in that case, so the fallback path always fails even though the files are otherwise valid. This makes the intended “archive missing manifest, use working-directory manifest” recovery path unusable.

Useful? React with 👍 / 👎.

@Ian747-tw
Ian747-tw force-pushed the chore/research-v1-release-artifacts branch from f4298f8 to a3b0863 Compare May 21, 2026 11:41
@Ian747-tw

Copy link
Copy Markdown
Owner Author

@codex review this PR again. I addressed the latest manifest fallback issue in a3b0863: the downloader skips manifest copy when source and destination are the same file and has regression coverage. Please check for remaining blockers.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3b0863043

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +157 to +161
prepare_existing_targets(manifest, args.force)
for path, entry in manifest_artifact_paths(manifest).items():
source = extract_dir / entry["path"]
if not source.exists():
raise FileNotFoundError(f"archive missing artifact: {entry['path']}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Delay forced deletion until replacement artifacts are validated

When --force is used, the script deletes mismatched local artifacts before confirming the archive actually contains all replacement files. If the release archive is incomplete/corrupt (for example, one manifest entry is missing in the tarball), the run fails at copy time and leaves previously valid local artifacts deleted, which can break subsequent experiment runs. Validate sources first (or stage replacements) before unlinking existing files.

Useful? React with 👍 / 👎.

Comment on lines +143 to +145
download_release(args.release, archive.name)
if not archive.exists():
raise FileNotFoundError(f"archive not found: {archive}")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor full --archive target path during download

The download call uses archive.name, but later existence is checked against Path(args.archive). If a caller passes --archive with a directory component (e.g. dist/research_v1_foundation_artifacts.tar.gz), gh saves the file in the current directory while the script checks dist/... and fails with archive not found. This makes the --archive path argument unreliable outside the default filename-in-cwd case.

Useful? React with 👍 / 👎.

@Ian747-tw
Ian747-tw force-pushed the chore/research-v1-release-artifacts branch from a3b0863 to dbd9479 Compare May 21, 2026 11:49
@Ian747-tw

Copy link
Copy Markdown
Owner Author

@codex review this PR again. I addressed the latest findings in dbd9479: forced overwrite now validates archive replacement sources before touching existing artifacts, and --archive paths with directories are honored during gh release download, with regression tests. Please check for remaining blockers.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dbd9479545

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

target = (destination / member.name).resolve()
if not target.is_relative_to(destination_resolved):
raise ValueError(f"archive member escapes destination: {member.name}")
tar.extractall(destination, filter="data")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add compatibility fallback for tar extraction filter

extract_archive() unconditionally calls tar.extractall(destination, filter="data"), but the project supports python>=3.10 and this filter argument is only available in newer 3.10 patch releases; on older 3.10 runtimes the download command will crash with TypeError before any artifact validation runs. This makes the new artifact distribution path unusable for a supported interpreter range unless you gate this by feature detection (for example, checking for tarfile.data_filter) and fall back safely.

Useful? React with 👍 / 👎.

@Ian747-tw
Ian747-tw force-pushed the chore/research-v1-release-artifacts branch from dbd9479 to a0baa28 Compare May 21, 2026 11:57
@Ian747-tw

Copy link
Copy Markdown
Owner Author

@codex review this PR again. I addressed the latest tar extraction compatibility finding in a0baa28: extraction now rejects unsupported member types, uses filter="data" only when available, and falls back after path/member validation for older supported Python 3.10 runtimes. Please check for remaining blockers.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Ian747-tw
Ian747-tw merged commit e6c25c7 into main May 21, 2026
2 checks passed
@Ian747-tw
Ian747-tw deleted the chore/research-v1-release-artifacts branch May 21, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant