Skip to content

Keep the token-profile example's lock pin in step with the runtime lock - #167

Merged
ProfSynapse merged 2 commits into
feat/submodule-cloud-api-v1from
claude/token-profile-lock-pin
Oct 2, 2026
Merged

ProfSynapse merged 2 commits into
feat/submodule-cloud-api-v1from
claude/token-profile-lock-pin

Conversation

@ProfSynapse

Copy link
Copy Markdown
Owner

Summary

Stacked on #166.

.skills/fine-tuning/configs/qwen35_4b_token_profile.yaml pins expected_lock_sha256 to the sha256 of modal-runtime-v1.lock.json. Every legitimate lock refresh left that pin stale, and test_profile_tokenizer_lengths then failed until someone recomputed the hash by hand. This happened twice in one day.

scripts/regenerate_modal_runtime_lock.py now maintains that pin itself:

  • Check mode (default): reports the lock and/or the example pin as stale and exits 3.
  • --write: refreshes the lock, then rewrites only the example's expected_lock_sha256 line. Both files are written atomically. If the run is interrupted between the two, a rerun finishes the job.
  • A malformed or missing pin line fails closed with EXAMPLE_PIN_INVALID, before anything is written.

The profiler's guarantee is unchanged. profile_tokenizer_lengths.py is untouched, real configs still carry a literal digest, and a mismatch still raises RUNTIME_LOCK_DIGEST_MISMATCH. I rejected the alternative of a "use the current lock" value for this reason: any real run could use it and skip the pin.

Docs: AGENTS.md and the fine-tuning skill references now say the tool keeps the pin in step, and that sync_skill_trees.py should be run after --write. The only workflow change is renaming the conformance check step.

This script isn't part of any lock inventory, and no --write was run against the real repo.

Test plan

  • New contract tests run on temp copies. They cover: the checked-in pin equals the lock's hash; a stale pin is detected and repaired; a second run changes nothing; malformed pins abort without writing; the profiler accepts the refreshed example and rejects the old pin.
  • The affected set passes: 109 tests. ruff check . is clean.
  • tests/scripts + tests/contract: 1083 passed, 4 failed. All 4 are the launcher-lock tests, which also fail on the base in this sandbox and pass on GitHub runners (see Add CI, lint and pre-commit, and repair the full test suite #166).

🤖 Generated with Claude Code

https://claude.ai/code/session_013etFNjLuo22CCoQmUGYqCT


Generated by Claude Code

claude added 2 commits October 2, 2026 17:36
The qwen35_4b_token_profile.yaml example pins expected_lock_sha256 to the
digest of modal-runtime-v1.lock.json, so every reviewed lock refresh left the
example stale and broke its test until someone recomputed the hash by hand.

regenerate_modal_runtime_lock.py now treats that one line as part of the
refresh. Check mode names every stale file (lock and/or example) and exits 3;
--write replaces the lock first, then the example, atomically and with the
same identity rechecks, and prints the changed paths. Only the
expected_lock_sha256 value is rewritten; an example whose pin line is
missing, duplicated or malformed fails closed before anything is written.
The profiler is unchanged, so real configs still pin a literal digest and are
still refused on mismatch.

Tests run the tool against temp copies: lock refresh moves the example pin,
a stale example alone is repaired without touching the lock, malformed
examples abort the whole refresh, and the profiler accepts the refreshed
pair while rejecting the old pin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013etFNjLuo22CCoQmUGYqCT
Update the Modal and tokenizer-profiling references, AGENTS.md and the CI
step name, and re-sync the generated skill mirrors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013etFNjLuo22CCoQmUGYqCT
@ProfSynapse
ProfSynapse changed the base branch from claude/ci-and-test-repair to feat/submodule-cloud-api-v1 October 2, 2026 23:29
@ProfSynapse
ProfSynapse merged commit 97e7b45 into feat/submodule-cloud-api-v1 Oct 2, 2026
9 checks passed
@ProfSynapse
ProfSynapse deleted the claude/token-profile-lock-pin branch October 6, 2026 19:17
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.

2 participants