refactor: bind the live WanGP instance behind a generation wall - #31
Merged
Conversation
Launch still imports wgp once after the argv patch, then bind_wgp(wgp). HocusPocus consumers now read that singleton through get_wgp(), ModelCatalog or RuntimeConfig. Video concat stays in mix_concat. The architecture allowlist shrinks to the bootstrap import; the wall does not reimport WanGP.
PR Review — Loreframe StudioRisk: low Automated review from Findings
Changed files
CONTRIBUTING checklist
Posted by the repo PR review workflow. Re-runs on each push to the PR. |
Owner
Author
|
Codex review |
Owner
Author
|
cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 84c9e4d. Configure here.
This was referenced Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR body — Paso 1 muro WanGP
Rama:
refactor/wangp-generation-wallCommit:
84c9e4d315642e166c38a6bd6c9932608e4723bfCompare: https://github.com/IAnMove/hocuspocus/compare/main...refactor/wangp-generation-wall?quick_pull=1
El token local de
gh(fine-grained PAT) puede hacer push y listar PRs, pero nopull_requests:writeniactions:write. Abrir el PR desde esa URL (o ampliar el PAT) y pegar el cuerpo siguiente.Alcance exacto
Paso 1 del plan canónico: muro WanGP.
app/services/generation/conbind_wgp()/get_wgp(), más puertos delgadosModelCatalog(get_model_def) yRuntimeConfig(server_config)._launch_runtime.pyimporta WanGP una sola vez tras el parche de argv y enlaza esa instancia viva conbind_wgp(wgp).get_wgp() is sys.modules["wgp"].services.mix_concat._run_generation. No se creaGenerationEngine. No se tocaapp/models/**ni código vendor WanGP.Un commit revertible. Sin features nuevas ni cambios de contrato JSON.
Accesos WanGP eliminados
_launch_runtime.pyrejoin_clipsservices.mix_concat.concatenate_multi_clip_videos→get_wgp()alternative_songs.pyremount_clipsenhance_guides.pyget_enhance_guideModelCatalog.get_model_defllm_service.pyenhance_promptModelCatalog.get_model_defdirector_pipeline.py_run_pipelineRuntimeConfig.get("vram_safety_coefficient")director/prompt_polish.py(2)get_wgp().get_lora_dirmodel3d_service.py(3)RuntimeConfigshared/api.pyimportlib.import_module('wgp')get_wgp()/ bind desys.modules["wgp"]shared/magic_mask.py(2)get_wgp()en runtimeAllowlist 1.0: solo
("app/_launch_runtime.py", "<module>", "import wgp").Tests locales
python -m pytest -q→ 1551 passedRiesgos y rollback
Rollback:
git revert 84c9e4d.Riesgo:
WanGPSessiondeja de ser un segundo bootstrap. Studio/launch no cambia.No se tocó vendor WanGP. Paridad JSON y arranque conservadas.
No mergear desde el agente. Dueño: humano. Hotspot
_launch_runtime.py.Note
Medium Risk
Touches launch bootstrap and every former direct
wgpaccess path; behavior should be equivalent but mis-ordered bind or an unboundget_wgp()call would fail at runtime across generation, media, and config reads.Overview
Introduces
app/services/generation/as the only supported way for first-party code to reach the live WanGP module after bootstrap:bind_wgp(wgp)runs in_launch_runtime.pyright after the singleimport wgp, and callers useget_wgp(),get_model_def, orRuntimeConfiginstead of importingwgpthemselves.Call-site migrations include enhance/LLM model defs, Director LoRA dirs and OOM
vram_safety_coefficient, model3d service config, magic mask video/SAM3 helpers,WanGPSession(reuse bound module or bind fromsys.modules), and clip rejoin/remount paths that now go throughservices.mix_concat.concatenate_multi_clip_videos(thin delegate to the bound helper).Architecture enforcement tightens: the
wgpimport allowlist shrinks to launch bootstrap only;services/generationmust not reimportwgp; a new AST test assertsimport wgp→bind_wgp(wgp)order. Docs inARCHITECTURE_FOUNDATION.mddescribe the wall. Unit tests cover bind/unbound behavior and the concat port.Reviewed by Cursor Bugbot for commit 84c9e4d. Configure here.