Skip to content

refactor(web): extract model-assignment helpers into web_server_model_assignment (web_server.py god-file slice R1-C9) - #79123

Open
andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:fix/web-model-assignment-extract
Open

refactor(web): extract model-assignment helpers into web_server_model_assignment (web_server.py god-file slice R1-C9)#79123
andrexibiza wants to merge 1 commit into
NousResearch:mainfrom
andrexibiza:fix/web-model-assignment-extract

Conversation

@andrexibiza

@andrexibiza andrexibiza commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Web_server.py god-file slice R1-C9: extract the model-assignment helpers from hermes_cli/web_server.py into hermes_cli/web_server_model_assignment.py (pure module, no app coupling). Part of the repo-wide large-file decomposition (tracker #78647).

What changed and why

  • Moved _normalize_main_model_assignment + _apply_main_model_assignment byte-verbatim (window 1423–1593) into hermes_cli/web_server_model_assignment.py
  • web_server.py re-exports both names (seam identity: web_server.X is web_server_model_assignment.X)
  • Repointed the pre-existing test monkeypatch targets from web_server.load_configweb_server_model_assignment.load_config (function globals now live in the new module); test_moa_set_models_preserves_extra_keys.py correctly keeps patching web_server.load_config (direct call in web_server's own namespace)
  • Added seam-identity regression (5) + aggressive tests (27): provider-inference edge cases, empty/invalid model strings, import isolation

Why this matters to users

web_server.py (17,700 lines at this slice's base) is one of the repo's 20 god files. Extracting cohesive clusters one PR at a time makes the dashboard surface auditable, testable, and safe to evolve — the large-file decomposition is the prerequisite for every subsequent fix on this surface.

Testing

  • pytest tests/hermes_cli/test_web_server_model_assignment_seam.py tests/hermes_cli/test_web_server_model_assignment_aggressive.py tests/hermes_cli/test_normalize_main_model_assignment.py40 passed
  • Canonical runner (scripts/run_tests.sh, hermetic env): 3 files, 36 passed, 0 failed
  • Seam identity verified at runtime (is-identity, __module__ check)
  • ruff clean · git diff --check clean · LF-only · DCO signed
  • Platforms tested: Windows (native), CI-parity runner

Coordination / interlock

Part of #78647
Part of #78628

…_assignment (web_server.py god-file slice R1-C9)

Signed-off-by: andrexibiza <84248988+andrexibiza@users.noreply.github.com>
@andrexibiza

Copy link
Copy Markdown
Contributor Author

🔒 This shard is part of the web_server.py KILL LOCK — the permanent record of the 17,700-line whole, the mess it caused (#58576 event-loop stalls, #60800 cold-start stalls, #53972 token persistence, #71778 analytics), every shard in the wave, and every open fixer PR still fighting the surface (#50188 #71802 #54034 #76764 #71150 #67365 #65434 #65424 #78411 #75845 #68022 #62654 #76757 #68251 #51070 #73605 #73849 #73393 #71752 #77808 #46956 #74297 #77853).

Lock: posted on #78628 · Indexed by the Kill All Gods meta-issue #78647.

@alt-glitch alt-glitch added type/refactor Code restructuring, no behavior change comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) area/config Config system, migrations, profiles sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades P3 Low — cosmetic, nice to have labels Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard comp/dashboard Web dashboard / control panel UI (dashboard/, landing) P3 Low — cosmetic, nice to have sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/refactor Code restructuring, no behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants