greatmengqi 70323e052a refactor(config): migrate gateway routers and channels to Depends(get_config)
Phase 2 Task P2-2 (Category G): replace AppConfig.current() with the
typed Depends(get_config) FastAPI dependency in every gateway router.

- routers/models.py: list_models / get_model take config via Depends
- routers/mcp.py: get_mcp_configuration / update_mcp_configuration via Depends;
  reload path now swaps app.state.config alongside AppConfig.init() so both
  the new primitive and legacy current() callers see the fresh config
- routers/memory.py: get_memory_config_endpoint / get_memory_status via Depends
- routers/skills.py: update_skill via Depends; reload swaps app.state.config
- deps.py: get_run_context and langgraph_runtime read from app.state.config
  instead of calling AppConfig.current()
- auth/reset_admin.py: CLI constructs AppConfig.from_file() explicitly at the
  top (it is a standalone entry point, not a request handler)
- channels/service.py: from_app_config accepts optional AppConfig parameter;
  legacy fallback to AppConfig.current() preserved until P2-10

Test fix: test_update_skill_refreshes_prompt_cache_before_return now sets
app.state.config on the test FastAPI instance so Depends(get_config) resolves.

All 2379+ tests pass (one pre-existing flaky test_client_e2e unrelated).
2026-04-16 22:34:27 +08:00
..