Commit f5e68d8
[multi-lora-rl] Address review feedback: path safety + legacy lora_name
Two reviewer concerns:
1. Path traversal in os.path.join(base_sync_path, model_id). model_id is
server-generated (api.py validates against ID_PATTERN), so this is
defense in depth, but route through os.path.basename in both Megatron
and FSDP workers so a misformed id can't escape lora_sync_path.
Also add _cleanup_lora_sync_subdir on per-adapter delete_model so the
per-tenant subdirs don't accumulate as adapters churn.
2. Legacy update_named_weights path didn't carry the adapter name —
vllm_engine generated a numeric name from time.time_ns(), making the
adapter inaccessible by tenant model_id. Add lora_name to
LoraLoadRequest, plumb through both BaseVLLMInferenceEngine
variants (sync + async _load_lora_from_disk), and pass lora_name from
both worker files in the legacy branch. Empty string preserves the
pre-existing single-tenant behavior.
All 6 existing multi-LoRA tests still pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 468d231 commit f5e68d8
5 files changed
Lines changed: 67 additions & 14 deletions
File tree
- skyrl/backends
- skyrl_train
- inference_engines/vllm
- weight_sync
- workers
- fsdp
- megatron
Lines changed: 20 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
312 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
313 | 318 | | |
314 | | - | |
| 319 | + | |
| 320 | + | |
315 | 321 | | |
316 | 322 | | |
317 | 323 | | |
| |||
320 | 326 | | |
321 | 327 | | |
322 | 328 | | |
323 | | - | |
| 329 | + | |
324 | 330 | | |
325 | 331 | | |
326 | 332 | | |
| |||
453 | 459 | | |
454 | 460 | | |
455 | 461 | | |
456 | | - | |
457 | | - | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
458 | 469 | | |
459 | | - | |
| 470 | + | |
| 471 | + | |
460 | 472 | | |
461 | 473 | | |
462 | 474 | | |
| |||
539 | 551 | | |
540 | 552 | | |
541 | 553 | | |
542 | | - | |
| 554 | + | |
543 | 555 | | |
544 | 556 | | |
545 | 557 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
50 | 55 | | |
51 | 56 | | |
52 | 57 | | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| 61 | + | |
56 | 62 | | |
57 | 63 | | |
58 | 64 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
273 | 273 | | |
274 | 274 | | |
275 | 275 | | |
276 | | - | |
| 276 | + | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
| |||
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | | - | |
306 | | - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
307 | 311 | | |
308 | 312 | | |
309 | 313 | | |
| |||
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
898 | 898 | | |
899 | 899 | | |
900 | 900 | | |
901 | | - | |
| 901 | + | |
902 | 902 | | |
903 | 903 | | |
904 | 904 | | |
| |||
927 | 927 | | |
928 | 928 | | |
929 | 929 | | |
930 | | - | |
931 | | - | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
932 | 936 | | |
933 | 937 | | |
934 | 938 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
459 | 460 | | |
460 | 461 | | |
461 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
462 | 488 | | |
463 | 489 | | |
464 | 490 | | |
| |||
469 | 495 | | |
470 | 496 | | |
471 | 497 | | |
| 498 | + | |
472 | 499 | | |
473 | 500 | | |
474 | 501 | | |
| |||
0 commit comments