message: 403: {"code":"ENTITLEMENT_ERROR","message":"Error 403: the user is not subscribed to required model plan"}

stop_reason: error


error_message: 403: {"code":"ENTITLEMENT_ERROR","message":"Error 403: the user is not subscribed to required model plan"}


I read this as an investigation of why `recover_waiting_session` never runs and what the smallest safe fix/tests would be - I’ll trace callers, execution paths, and the relevant tests without changing anything.


I read this as an investigation of why `recover_waiting_session` never runs and what the smallest safe fix/tests would be - I traced the call chain and gating without changing anything.

- Caller chain:
  - `gateway/platforms/telegram.py::_recover_task26_nutrition_background` → `_recover_room_bootstrap_waiting_states`
  - `gateway/platforms/telegram.py::_recover_room_bootstrap_waiting_states` → `TelegramNutritionOnboardingRuntime.recover_waiting_session`
- Exact reference evidence:
  - `rg -n "recover_waiting_session\\("` returns only `gateway/platforms/telegram_nutrition_onboarding_runtime.py:184` (definition).
  - The only dynamic call is `gateway/platforms/telegram.py:5377-5382` (`runtime = ...; recover = getattr(...); await recover(session)`).

Why it is not invoked:
- `_recover_room_bootstrap_waiting_states()` only reaches the runtime if `_get_nutrition_onboarding_runtime()` returns non-`None`.
- `_get_nutrition_onboarding_runtime()` is gated by `config.extra["room_bootstrap"]["nutrition_onboarding"] is True` at `gateway/platforms/telegram.py:5464-5466`.
- Repo search shows no other `nutrition_onboarding` reference, so that gate is effectively dead unless injected externally.

Smallest production-safe change:
- In `gateway/platforms/telegram.py::_get_nutrition_onboarding_runtime`, drop the nested `nutrition_onboarding` gate and instantiate the runtime when `room_bootstrap.enabled` is true (same enabled gate already used by `_get_room_bootstrap_transport()`).
- That leaves recovery semantics unchanged; it only makes the existing startup recovery path reachable.

Exact tests to add:
1. `tests/gateway/test_telegram_nutrition_onboarding_recovery.py::test_get_nutrition_onboarding_runtime_uses_enabled_room_bootstrap`
2. `tests/gateway/test_telegram_nutrition_onboarding_recovery.py::test_recover_room_bootstrap_waiting_states_invokes_recover_waiting_session_for_awaiting_activation`
3. `tests/gateway/test_telegram_nutrition_onboarding_runtime.py::test_recover_waiting_session_publishes_owner_review_card`

Relevant symbols:
- `TelegramAdapter.start`
- `TelegramAdapter._recover_task26_nutrition_background`
- `TelegramAdapter._recover_room_bootstrap_waiting_states`
- `TelegramAdapter._get_nutrition_onboarding_runtime`
- `TelegramNutritionOnboardingRuntime.recover_waiting_session`
- `TelegramNutritionOnboardingRuntime._publish` (`owner_review` branch)