fix: use UTC-aware datetimes to prevent MCP scheduling in the past#15
Open
elean-latedev wants to merge 2 commits intodevelopfrom
Open
fix: use UTC-aware datetimes to prevent MCP scheduling in the past#15elean-latedev wants to merge 2 commits intodevelopfrom
elean-latedev wants to merge 2 commits intodevelopfrom
Conversation
* chore: Update repository URLs to getlatedev/late-python-sdk * fix: Resolve lint errors and update MCP test imports * fix: Resolve mypy errors and add params to HTTP methods * ci: Improve release workflow with better visibility and PyPI check - Add release summary in GitHub Actions - Check if version exists on PyPI before publishing - Show clear notices for skip/release decisions - Bump version to 1.0.1 * ci: Add release preview comment on PRs to main Shows version info and release status before merging: - Version from pyproject.toml - Whether git tag exists - Whether version exists on PyPI - Clear indication if release will happen or be skipped * chore: trigger workflow re-run * fix: Add explicit permissions for checkout in private repo * fix: Add explicit token and permissions to all workflows for private repo * feat: Add typed responses with Pydantic models (v1.1.0) - All resource methods now return typed Pydantic models instead of dicts - Generate proper Enum classes instead of Literal types - Add response models: PostsListResponse, ProfileGetResponse, etc. - Add upload module with direct and Vercel Blob support - Update tests to use attribute access syntax - Sync version to 1.1.0 across pyproject.toml and __init__.py * feat(mcp): Add is_draft parameter and centralized tool definitions - Add is_draft parameter to posts_create and posts_cross_post - Create tool_definitions.py as single source of truth for MCP params - Add script to generate MDX docs from definitions * fix: Move Callable imports to TYPE_CHECKING block and fix trailing whitespace * fix: Fix mypy errors and format code * feat(ai): Add model property to OpenAI provider * Refactor MCP server to use typed models and tool docs Refactors MCP server to use typed model attributes instead of dicts for accounts, profiles, and posts, improving type safety and code clarity. Adds the @use_tool_def decorator to all MCP tool functions, automatically applying centralized docstrings from tool_definitions.py. Updates tool_definitions.py to expand tool documentation, add summaries, and improve MDX generation. Updates README examples to use enums and new tool names. Bumps version to 1.1.1 and regenerates models for improved type annotations. * Update lint config and import Any in server.py Added per-file ignores for generated models in Ruff config to allow old-style annotations and trailing whitespace. Also imported 'Any' from typing in src/late/mcp/server.py. * feat(mcp): Add docs_search tool for documentation search - Add docs_search tool to search Late API documentation - Fetch and cache llms-full.txt with 24h TTL - Score-based search across markdown sections - Returns top 5 relevant documentation sections --------- Co-authored-by: Carlos Martínez <carlimvg02@gmail.com>
datetime.now() returns naive local time, which .isoformat() serializes without a timezone suffix. The API interprets this as UTC, so users in non-UTC timezones (e.g. PST) get scheduledFor shifted into the past, triggering immediate publish instead of scheduling. Fix: datetime.now(timezone.utc) across all scheduling, caching, and rate-limiting code. Display now appends "UTC" for clarity. Reported by: Harshil Shah (Crisp session 3c3c8df5) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
datetime.now()returns naive local time. When serialized via.isoformat(), it produces a string without timezone suffix (e.g.2026-03-05T18:00:20). The API interprets this as UTC, so users in non-UTC timezones getscheduledForshifted into the past, causing immediate publish instead of scheduling.datetime.now()withdatetime.now(timezone.utc)across MCP server, cross-poster pipeline, rate limiter, examples, docs, and tests.Root cause chain
posts_createwithschedule_minutes=401datetime.now()returns11:19(naive local PST)11:19 + 401min = 18:00serialized as"2026-03-05T18:00:20"(no tz suffix)convertToUTC()treats it as UTC →18:00 UTC, but actual time is19:19 UTCscheduledFor <= now→ publishes immediatelyFiles changed
src/late/mcp/server.pysrc/late/pipelines/cross_poster.pypost()andpost_sync()base timesrc/late/client/rate_limiter.pyseconds_until_resetandfromtimestampsrc/late/resources/posts.pyexamples/,README.mdtests/test_integration.pyTest plan
datetime.now()remaining insrc/+00:00suffix matches API'sconvertToUTCregexTypeError)Reported by: Harshil Shah (Crisp session
3c3c8df5)🤖 Generated with Claude Code