greatmengqi 23b424e7fc refactor(config): thread AppConfig through lead agent construction
Phase 2 Task P2-4 (Category B): make_lead_agent, _build_middlewares,
_resolve_model_name, _create_summarization_middleware, and
build_lead_runtime_middlewares all accept AppConfig as an explicit
parameter instead of looking up the process-global.

Each entry point has an optional app_config parameter that falls back to
AppConfig.current() for backward compatibility with the LangGraph Server
registration path (which can only pass RunnableConfig). New callers —
DeerFlowClient, Gateway worker — pass self._app_config / app.state.config
explicitly.

prompt.py's apply_prompt_template helpers still read via AppConfig.current()
in defensive try/except; they are tightened in P2-10 where the fallback is
removed wholesale.

Test updates: _resolve_model_name and _create_summarization_middleware
signature changes propagate to unit tests. _build_middlewares mocks gain
the leading app_config parameter.

All 233 targeted tests pass (lead_agent_prompt, lead_agent_model_resolution,
lead_agent_skills, guardrail_middleware, client, client_e2e, multi_isolation).
2026-04-17 00:26:33 +08:00
..