greatmengqi 5e1c309bd7 Merge release/2.0-rc into refactor/config-deerflow-context
Brings release/2.0-rc up to PR base. Three structural conflicts resolved:

- gateway/deps.py: kept both the new release-side persistence imports
  (FeedbackRepository, RunEventStore, RunStore, StreamBridge, TypeVar T)
  and the PR's get_config FastAPI dependency. Imports are independent;
  T is still used by _require() helper added on the release side.

- agents/middlewares/thread_data_middleware.py: release added HumanMessage
  stamping that records run_id on user-input messages. Adapted to the PR's
  typed DeerFlowContext: dropped 'from langgraph.config import get_config'
  (no longer needed) and changed runtime.context.get("run_id") to
  runtime.context.run_id (typed dataclass access).

- runtime/runs/worker.py: kept the PR's RunContext.app_config field and
  DeerFlowContext construction; passes run_id explicitly into the new
  context so the middleware above can read it.

To bridge the new HumanMessage stamping on release with PR's frozen
DeerFlowContext, this merge also adds a run_id: str | None field to
DeerFlowContext (with matching test + CLAUDE.md doc update). The field
fits the per-invocation-immutable-value-object semantics: run_id is
known at run start and never changes during the run.

Verification: backend test suite — 2372 passed, 4 skipped. One flaky
test (test_client_e2e::test_tool_call_produces_events) passes in
isolation and when its file runs alone; only fails under specific
full-suite ordering. Tracked separately; not introduced by this merge.
2026-04-26 12:30:20 +08:00
..