Skip to content

fix(calendar): document the real create_event target-calendar behaviour - #6287

Open
JulianFriedle wants to merge 1 commit into
odysseus-dev:devfrom
JulianFriedle:fix/calendar-target-calendar
Open

JulianFriedle wants to merge 1 commit into
odysseus-dev:devfrom
JulianFriedle:fix/calendar-target-calendar

Conversation

@JulianFriedle

Copy link
Copy Markdown

Summary

do_manage_calendar resolves the target calendar for create_event from calendar_href or calendar, by id, id prefix or case-insensitive name. The JSON schema described calendar_href as a "Specific calendar URL" and
calendar as a list-only filter — neither matches the implementation. The "defaults to first calendar" part was accurate but incomplete, and that is where the harm is: _ensure_default_calendar() returns the owner's first calendar row, which on any install where a local calendar was created before a CalDAV one is the local one. The event is then written with
caldav_sync_pending = NULL, writeback_event() skips it as "not a caldav calendar", and the tool returns exit_code=0. The user is told the event was created and it never appears in their calendar. A value that matches no calendar falls back to the same default without an error, so a wrong calendar name is indistinguishable from success. This PR corrects both field
descriptions and states the consequence of omitting the target. Behaviour is unchanged; the tests pin the existing resolution rules so the schema and the implementation cannot drift apart again.

Target branch

  • This PR targets dev, not main. All PRs land in dev; main is curated by the maintainer at each release.

Linked Issue

Fixes #6286

Type of Change

  • Bug fix (non-breaking — fixes a confirmed issue)
  • New feature (non-breaking — adds new behaviour)
  • Breaking change (changes or removes existing behaviour)
  • Refactor / cleanup (behaviour unchanged)
  • Documentation only
  • CI / tooling / configuration

Checklist

  • I searched open issues and open PRs — this is not a duplicate.
  • This PR targets dev
  • My changes are limited to the scope described above — no unrelated refactors or whitespace changes mixed in.
  • I actually ran the app (docker compose up or uvicorn app:app) and verified the change works end-to-end.
  • I did not run the app/runtime validation and stated that gap in How to Test.

How to Test

1. Reproduce on dev

On an install where a local calendar exists and was created before the CalDAV one — the default if you opened the calendar page before connecting CalDAV — ask the agent in agent mode to create an event without naming a calendar, then:

select c.name, c.source, e.caldav_sync_pending, e.remote_href
from calendar_events e
join calendars c on c.id = e.calendar_id
where e.summary = '<your event>';

Returns the local calendar with caldav_sync_pending = NULL and remote_href = NULL. The tool reported exit_code=0, but nothing appears in the remote calendar.

2. With this change

The schema now states that the field takes an id, an id prefix or a name, that omitting it falls back to the owner's first calendar, and what that costs. Passing the intended calendar explicitly:

{"action": "create_event", "summary": "Launch", "dtstart": "2026-10-01T10:00:00",
 "calendar_href": "<calendar name>"}

puts the event on the CalDAV calendar, caldav_sync_pending becomes create, and the push runs.

3. Unit tests

python3 -m pytest tests/test_calendar_target_calendar.py -q

Expected: 6 passed — resolution by name, by id prefix, via the calendar alias, case-insensitive name matching, the first-calendar fallback, and the silent fallback on an unmatched name.

Note that these tests pass on dev as well: the resolution logic was always correct, only its documentation was not. They are a regression guard against the schema and the implementation drifting apart again, not a proof of the fix.

4. Runtime validation performed

Docker install, Ollama + qwen3:8b and qwen3:14b, CalDAV against Google Calendar. Before: agent-created events landed in the local Personal calendar with caldav_sync_pending = NULL and never reached Google, three attempts in a row, each reported as successful. After: with the target calendar passed explicitly the event is created on the CalDAV calendar and queued for push.

Visual / UI changes — REQUIRED if you touched anything that renders

Not applicable — this PR touches src/tool_schemas.py and adds tests/test_calendar_target_calendar.py. No rendering code, no CSS, no HTML, no SVG, no static/js/.

  • I am not an LLM agent submitting a bulk PR.

@github-actions github-actions Bot added the ready for review Description complete — ready for maintainer review label Sep 14, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Description complete — ready for maintainer review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

manage_calendar create_event writes to the first calendar, which is silently never synced

1 participant