fdc755a87e
Block A — send()/send_clarify() lesen _room_context:
- In send() (Z.6395-6421): nach ContextVar-Prio-0, vor thematic_target
und _user_rooms, _room_context[chat_id]["origin_room"] als Fallback.
- In send_clarify() (Z.6773-6803): gleicher Fallback nach ContextVar.
- Telemetrie: routing_counter.increment("contextvar_reset_fallback")
wenn dieser Pfad greift.
Block B — _room_context konsequent füllen (7 Stellen):
- _process_incoming (Z.1996-2002): IMMER setzen bei jeder Nachricht.
- Clarify dispatch (Z.2221-2225): pending["username"] → vcid.
- move_req confirm (Z.2327-2331): username → vcid.
- stay_here dispatch (Z.2538-2542): username → vcid.
- Widerspruch-Rückkehr (Z.2661-2665): username → vcid.
- Auto-Route (Z.2761-2765): username → vcid.
- Red Flag (Z.6349-6353): chat_id direkt (in send() verfügbar).
- Alle Zugriffe unter _room_context_lock (Thread-Safety).
Block C — Tests (test_v8_1_p1_contextvar.py):
- Test 6: send_with_empty_contextvar_falls_back_to_room_context
- Test 7: stream_retry_simulates_fresh_contextvar
- Beide: ContextVar leer, _room_context hat origin_room,
_user_rooms falsch/leer → korrektes Routing über _room_context.
Tests: 1332 passed, 3 pre-existing failures, 2 skipped.