Skip to content

fix: preserve registered checkpoints when duplicate registration is rejected - #113

Open
JunkaiWang-TheoPhy wants to merge 1 commit into
MoonshotAI:mainfrom
JunkaiWang-TheoPhy:codex/preserve-registered-checkpoints-on-rejection
Open

JunkaiWang-TheoPhy wants to merge 1 commit into
MoonshotAI:mainfrom
JunkaiWang-TheoPhy:codex/preserve-registered-checkpoints-on-rejection

Conversation

@JunkaiWang-TheoPhy

Copy link
Copy Markdown

Summary

Rejecting a repeated register_checkpoint("weights", ...) call currently unregisters the checkpoint that was successfully registered by the first call. The duplicate-name assertion runs inside the same try block as allocation, so its exception reaches the rollback handler and removes the existing buffers. Repeating the name of the active shared-pool checkpoint also clears its owner marker, making those weights unavailable through that checkpoint name.

Move the existing duplicate-name and shared-pool occupancy checks before the allocation/rollback block. Rejected calls then preserve the earlier registration; failures after registration starts still use the existing cleanup path. The public signature, assertion messages, and transfer behavior remain unchanged.

Regression evidence

The CPU regression performs an initial registration through the real ParameterServer.register_checkpoint, then rejects a second call with the same name. It checks that the original pool remains available with unchanged tensor contents, the shared owner remains intact, and no second allocation or host-cache cleanup occurs. Hardware initialization and pinned allocation are replaced at their boundaries; no GPU or transfer result is claimed.

On unmodified main 0ac607299eb711cdd6b164e9eba04a7ade9cf98b, retaining the new test:

python -m pytest tests/test_registration_rejection.py -q --tb=short
2 failed in 10.36s

Both ordinary and shared-pool cases fail with RuntimeError: checkpoint weights is not registered after the duplicate assertion is caught.

With the fix:

python -m pytest tests/test_registration_rejection.py -q --tb=short
2 passed in 4.09s

python -m pytest tests/ -m "not gpu" -q --tb=short
109 passed, 1 skipped, 12 deselected, 1 warning in 1.71s

Full repository pre-commit hooks passed, including repository-pinned Ruff 0.12.2 lint/format and codespell. Python compilation and whitespace checks passed. A separate-agent review reran the regression and verified that actual allocation and subsequent P2P-registration failures still enter the existing rollback handler.

Scope

Only checkpoint_engine/ps.py and tests/test_registration_rejection.py change. No dependency, public API, CI, GPU, RDMA or model behavior changes. This addresses registration preconditions, independently of the P2P registration-state fixes proposed in #91.

AI assistance: investigation, implementation, local validation and review used OpenAI Codex.

A registration precondition failure entered the allocation rollback handler
and removed a checkpoint that belonged to an earlier successful call.
Check duplicate names and shared-pool occupancy before entering that handler,
so rejected attempts cannot destroy the existing registration.

Confidence: high
Scope-risk: narrow
Tested: New CPU regressions fail on main and pass with the fix; full CPU suite
Not-tested: Required pre-commit hooks could not initialize because the shared disk is full; GPU, RDMA and actual transfer

This branch has not been deployed

No deployments
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