Files

97 lines
3.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Meal-Planning Cron Setup — Known Pitfalls & Fixes
Condensed troubleshooting guide for the `nutrition-coach` cronjob stack. Each section provides the symptom → root cause → fix.
---
## 1. Interactive Interview Via Cronjob Is Impossible
**Symptom**
```
Wed 19:30: Agent sends 10 questions to Telegram group.
User replies 19:3519:42 in Telegram.
current_interview.json: all answers are null
```
**Root cause**
A cronjob is a single-shot process. It sends, then exits. It never reads Telegram inbound messages. User replies arrive in the gateway but there is no running session to pair them with.
**Fix options**
1. **Replace with a non-interactive reminder** (recommended for automation):
```bash
hermes cron edit <id> --prompt "🔔 Wochenplan: Schreibe \"interview\" oder \"plan\" um loszulegen." --no-agent
```
User types a keyword in chat → triggers the interview in a live session.
2. **Use a live session for the interview.** Load the skill (`/skill meal-planning`) and run the interview interactively. Store the JSON for Friday.
---
## 2. Delivery Target Fails on Named Groups
**Symptom**
```
delivery error: Telegram send failed:
invalid literal for int() with base 10: 'Schoen Inc'
```
**Root cause**
Cron `deliver` field expects a numeric `chat_id` or a pre-registered alias. `"telegram:Schoen Inc"` is a display name, not a parseable ID.
**Fix**
Use one of the following verified targets for the nutrition-coach profile:
```json
"deliver": "telegram:D S" // DM with Dominik
"deliver": "telegram:-5265906503" // Schoen Inc group
"deliver": "telegram" // home channel
```
---
## 3. Model Override in Cron JSON Is Not Updated by `hermes config set`
**Symptom**
Bulk-switched profile to `vllm/glm-5-2-nvfp4` via `hermes config set`, but cronjob still calls `vllm/moonshotai/kimi-k2.6`.
**Root cause**
Cron jobs hard-code `model` and `provider` inside their own JSON entry in `profiles/nutrition-coach/cron/jobs.json`. The profile `config.yaml` is not consulted at runtime.
**Fix — Python one-liner**
```python
import json
path = '/home/debian/.hermes/profiles/nutrition-coach/cron/jobs.json'
with open(path) as f:
data = json.load(f)
for j in data['jobs']:
if 'nutrition' in j['name'].lower():
j['model'] = 'vllm/glm-5-2-nvfp4'
j['provider'] = 'noris'
with open(path, 'w') as f:
json.dump(data, f, indent=2, ensure_ascii=False)
```
---
## 4. Interview JSON Schema Mismatch
**Symptom**
`nutrition-plan-generator-v4.py` crashes with `KeyError` on fields it expects (e.g. `dominik_ho`, `special_events`).
**Root cause**
The interview data file (`current_interview.json`) was created by a different schema than the generator expects. Cronjobs that produce JSON by LLM free-form output are fragile.
**Fix**
Always use the Interview Schema template (`templates/interview-data-schema.json`) when persisting. Validate before saving:
```bash
python3 -m json.tool current_interview.json >/dev/null || echo "INVALID JSON"
```
---
## Verification Checklist After Any Change
```bash
hermes --profile nutrition-coach cron list # jobs running under correct profile?
hermes config --profile nutrition-coach | grep Model # profile model correct?
python3 -c "import json; d=json.load(open('/home/debian/.hermes/profiles/nutrition-coach/cron/jobs.json')); print([j['model'] for j in d['jobs']])" # cron model correct?
cat /home/debian/.hermes/profiles/nutrition-coach/plan_data/current_interview.json | python3 -m json.tool # interview valid?
```