Commit aa883aa
[adapter,hparams] fix: address Copilot review on PR X-GenGroup#160
Three fixes from the Copilot review on the upstream PR:
1. Path-traversal validation (utils/checkpoint.py):
parse_hf_checkpoint_path now rejects '.', '..', and backslash
segments with an informative ValueError that preserves the original
spec. Validates at the parser front door rather than at the
download site so error messages keep the user's exact input.
Without this, a spec like 'owner/repo/..' would escape the snapshot
directory via os.path.join.
2. Un-gate _resolve_checkpoint_path (models/abc.py):
Remove the `if is_local_main_process:` gate and the post-barrier
double-call pattern. All ranks now call snapshot_download directly;
huggingface_hub's per-blob WeakFileLock serializes concurrent calls
within each filesystem domain (cross-node on POSIX-locking shared
FS, per-node on non-shared FS), so we still get exactly one
download per filesystem domain.
This eliminates the distributed-deadlock hazard where a download
failure on the gated rank would raise before reaching
wait_for_everyone(), leaving siblings blocked at the barrier until
NCCL watchdog timeout. The trailing wait_for_everyone() is kept to
maintain lockstep entry into the downstream loaders.
Residual asymmetric-failure risk (one rank's network blip while
others succeed) is documented in the docstring.
3. Skill-checklist alignment (.agents/skills/ff-review/SKILL.md):
Replace the duplicated import-exception list with a reference to
constraint X-GenGroup#22, where the full set of three sanctioned exceptions
(optional deps, backend-gated runtime feature checks, circular
imports) lives. Prevents future drift between the two documents.
Verified with 8 happy-path + 5 original-error + 6 path-traversal
parser test cases (all pass).
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 5fb0b14 commit aa883aa
3 files changed
Lines changed: 38 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1470 | 1470 | | |
1471 | 1471 | | |
1472 | 1472 | | |
1473 | | - | |
1474 | | - | |
1475 | | - | |
1476 | | - | |
1477 | | - | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
1478 | 1484 | | |
1479 | 1485 | | |
1480 | 1486 | | |
| |||
1493 | 1499 | | |
1494 | 1500 | | |
1495 | 1501 | | |
1496 | | - | |
1497 | | - | |
1498 | | - | |
1499 | | - | |
1500 | | - | |
1501 | | - | |
1502 | | - | |
1503 | | - | |
1504 | | - | |
1505 | | - | |
1506 | | - | |
1507 | 1502 | | |
1508 | | - | |
| 1503 | + | |
1509 | 1504 | | |
1510 | 1505 | | |
1511 | 1506 | | |
| |||
1514 | 1509 | | |
1515 | 1510 | | |
1516 | 1511 | | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
1517 | 1526 | | |
1518 | 1527 | | |
1519 | 1528 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
192 | 203 | | |
193 | 204 | | |
194 | 205 | | |
| |||
0 commit comments