fix(calendar): creating and deleting calendar events works again - #426
Merged
Conversation
…rpreter run_shell_script() forced every allowed helper through sys.executable, so the two bash helpers (calendar_create_event.sh, calendar_delete_event.sh) always failed with a Python SyntaxError at the first bash line — creating and deleting calendar events via the Calendar MCP was broken. Dispatch now branches on file suffix: .sh scripts run under /bin/bash, .py scripts keep the existing venv-interpreter + PYTHONPATH behavior (needed for pyobjc EventKit, adapted from #63). Adds tests that pin the dispatch (sh -> bash, py -> sys.executable) and a guard that every allowed .sh helper parses under bash -n. The dispatch test fails on the previous code. Reported by Michelle, who reproduced it byte-for-byte on upstream main. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
What this pull request touches
Gates that will judge this change
Based on 2 changed files. |
Owner
Author
|
CI triage note: the initial run's
If this test flakes again, the durable fix belongs in the update-checker test fixtures (hermetic git-runner injection for the pre-fetch evidence path), not in retries. 🤖 Generated with Claude Code |
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.
What was broken
Two Calendar MCP actions — creating an event and deleting an event — have been silently broken. The server runs its small helper scripts, but it ran every helper through Python, including the two that are written in bash (
calendar_create_event.sh,calendar_delete_event.sh). Python can't read bash, so those two helpers failed instantly with a syntax error every single time. Asking Dex to put something on your calendar, or take something off it, could never succeed through this path.Michelle found and reported this — she reproduced the exact failure, confirmed the scripts themselves are fine, and confirmed the same bug exists byte-for-byte on upstream main. Thank you, Michelle.
The fix
run_shell_script()incore/mcp/calendar_server.pynow looks at the script's file type:.shhelpers run under bash,.pyhelpers keep the existing behavior (the venv interpreter withPYTHONPATHset, which the EventKit helpers need — unchanged from #63).Verification
calendar_create_event.shthrough Python fails withSyntaxError: invalid syntaxat line 13, exactly as reported. Confirmed both.shhelpers passbash -n.core/tests/test_calendar_server.py:.shscripts dispatch to/bin/bashwith args passed through.pyscripts still dispatch tosys.executable.shhelper parses as valid bash/bin/bash, gets the Python interpreter) — it would have caught this bug.pytest core/tests/test_calendar_server.py: 10 passed (3 new, 7 pre-existing).ruff check core/: all checks passed.Note: verified on Linux (test-level; the dispatch and bash-syntax checks are platform-independent). The end-to-end AppleScript path needs macOS and was not run here.
Proposed CHANGELOG entry (not committed — for the release that includes this)
🤖 Generated with Claude Code