The command parser was returning needs_clarification for advice/how-to
questions that didn't explicitly reference a book. Updated ai_config.json
to classify any question that isn't about meds or routines as a knowledge
query, added book hints for DBT vs ADHD, and added concrete examples
(e.g. "how do I do things I don't want to do?").
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
should_send_nag() was iterating all pending schedules for today without
verifying the scheduled time had actually passed. A dose scheduled for
18:00 would get nagged at 13:15. Add an early return when current_time
is before the scheduled dose time.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The medication_schedules.adjusted_time column is a TIME type, but
med_logs.scheduled_time is VARCHAR. When adjusted_time values were
passed into queries against med_logs, PostgreSQL rejected the
comparison. Add _normalize_time() to convert datetime.time objects
to "HH:MM" strings at the entry points of should_send_nag,
record_nag_sent, and mark_med_taken.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix TIME object vs string comparison in scheduler preventing adaptive med
reminders from ever firing (#12, #6)
- Add frequency filtering to midnight schedule creation for every_n_days meds
- Require start_date and interval_days for every_n_days medications
- Add refresh token support (30-day) to API and bot for persistent sessions (#13)
- Add "trusted device" checkbox to frontend login for long-lived sessions (#7)
- Auto-refresh expired tokens in both bot (apiRequest) and frontend (api.ts)
- Restore bot sessions from cache on restart using refresh tokens
- Duration-aware routine scheduling conflict detection (#11)
- Add conflict check when starting routine sessions against medication times
- Add diagnostic logging to notification delivery channels
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both handlers were building update_data with defaults for every field,
so a partial save (e.g. toggling one toggle) would silently reset all
other settings back to their defaults. Now only fields explicitly
present in the request body are written to the DB.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1. config/schema.sql — Added timezone_name VARCHAR(100) to user_preferences table + an ALTER TABLE migration at the bottom for existing DBs.
2. core/tz.py — Rewrote with dual-path timezone support:
- Request context: _get_request_tz() now checks X-Timezone-Name header (IANA) first, falls back to X-Timezone-Offset
- Background jobs: New tz_for_user(user_uuid) and user_now_for(user_uuid) read stored timezone_name from prefs, fall back to numeric offset, then UTC
- All existing function signatures (user_now(), user_today()) preserved for backward compat
3. scheduler/daemon.py — Fixed 3 bugs:
- _user_now_for() now delegates to tz.user_now_for() which uses IANA timezone names (DST-safe)
- check_nagging() — replaced datetime.utcnow() with _user_now_for(user_uuid) so nags evaluate in user's timezone
- poll_callback() — replaced single UTC midnight check with _check_per_user_midnight_schedules() that iterates users and creates daily schedules at their local midnight
4. api/routes/preferences.py — Added "timezone_name" to allowed PUT fields.
5. synculous-client/src/lib/api.ts — Added X-Timezone-Name header to every request + added timezone_name to preferences update type.
6. synculous-client/src/app/dashboard/layout.tsx — Now syncs both timezone_offset and timezone_name (via Intl.DateTimeFormat().resolvedOptions().timeZone) on session start.
Add a visual status indicator showing:
- Online/offline status with colored dot indicator
- Last seen timestamp
- Typical wake time (if available)
The indicator now displays whenever Discord notifications are enabled,
not just when presence tracking is active.
The API requires adaptive_mode when adaptive_timing_enabled is true,
but the frontend was only sending the enabled flag. This caused 400
errors when users tried to toggle adaptive timing on.
Now the toggle sends both fields when enabling, satisfying the API
validation requirements.
- #11: Add validation to prevent simultaneous scheduling of routines and medications
- Added _check_schedule_conflicts() in routines.py
- Added _check_med_schedule_conflicts() in medications.py
- Returns HTTP 409 with descriptive error on conflict
- #10: Fix medication reminders not being sent
- Added call to check_adaptive_medication_reminders() in daemon poll loop
- #9: Fix can't enable adaptive timing
- Added proper error handling and logging in update_adaptive_settings()
- Returns meaningful error message on database failures
- #8: Fix nagging not working
- Added debug logging for missing settings
- Auto-create medication schedules if they don't exist
- Improved error logging (warning -> error)