greatmengqi 0e5ff6f431 refactor(config): tighten Phase 2 explicit-passing, isolate current() fallback
Review feedback: the previous sitting added AppConfig.current() fallback
inside every new explicit-config helper, which perpetuated the implicit
lookup we are trying to eliminate.

This commit:
- requires app_config as a non-None parameter in internal functions that
  have clean callers (build_lead_runtime_middlewares, _build_runtime_middlewares)
- isolates the AppConfig.current() fallback to the single boundary where
  LangGraph Server's registration API genuinely cannot pass config
  (make_lead_agent), and to the two factories still reachable from
  not-yet-migrated community tool paths (create_chat_model, get_available_tools),
  each marked with a TODO(P2-10) grep anchor
- types RunContext.app_config as AppConfig | None instead of Any
- drops the narrative # Phase 2: comments from production source and test
  bodies; they belong in commit messages, not the code
- drops the AppConfig.resolve() helper introduced last commit — it was
  just another name for the implicit-lookup pattern

Make _build_middlewares's kw-only separator explicit so the app_config /
config distinction is clear at call sites.

196 targeted tests pass.
2026-04-17 00:49:51 +08:00
..