fix(calendar): document the real create_event target-calendar behaviour - #6287
Open
JulianFriedle wants to merge 1 commit into
Open
JulianFriedle wants to merge 1 commit into
JulianFriedle wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
do_manage_calendarresolves the target calendar forcreate_eventfromcalendar_hreforcalendar, by id, id prefix or case-insensitive name. The JSON schema describedcalendar_hrefas a "Specific calendar URL" andcalendaras 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 withcaldav_sync_pending = NULL,writeback_event()skips it as "not a caldav calendar", and the tool returnsexit_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 fielddescriptions 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
dev, notmain. All PRs land indev;mainis curated by the maintainer at each release.Linked Issue
Fixes #6286
Type of Change
Checklist
devdocker compose uporuvicorn app:app) and verified the change works end-to-end.How to Test
1. Reproduce on
devOn 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:
Returns the local calendar with
caldav_sync_pending = NULLandremote_href = NULL. The tool reportedexit_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_pendingbecomescreate, and the push runs.3. Unit tests
Expected:
6 passed— resolution by name, by id prefix, via thecalendaralias, case-insensitive name matching, the first-calendar fallback, and the silent fallback on an unmatched name.Note that these tests pass on
devas 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
Personalcalendar withcaldav_sync_pending = NULLand 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.pyand addstests/test_calendar_target_calendar.py. No rendering code, no CSS, no HTML, no SVG, nostatic/js/.