Repository navigation
fix: Cleanup service misses no-session and skipped executions (#137) - #201
Closed
AndriiPasternak31 wants to merge 3 commits into
Closed
AndriiPasternak31 wants to merge 3 commits into
AndriiPasternak31 wants to merge 3 commits into
Conversation
… terminal-state skipped executions (Abilityai#137) SQLite's datetime('now') returns space-separated format while started_at is stored in ISO 8601 with T separator. In string comparison, T (ASCII 84) sorts after space (ASCII 32), so the < comparison was always false for same-day timestamps — cleanup queries never matched any rows. - Replace SQLite datetime() with Python-computed ISO 8601 thresholds - Set status='failed' on orphaned skipped executions (was only setting completed_at) - Match empty-string claude_session_id in addition to NULL Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Upstream added security fixes (Abilityai#174-Abilityai#177), event subscriptions (EVT-001), and subscription improvements (Abilityai#74, Abilityai#148). Our Abilityai#137 cleanup fix entry placed chronologically above at 2026-03-27. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
vybe
approved these changes
Mar 28, 2026
vybe
left a comment
Contributor
There was a problem hiding this comment.
Validated via /validate-pr. SQLite datetime format mismatch root cause confirmed. Fix is correct and consistent across all 4 affected queries. Feature flow updated accurately.
vybe
added a commit
that referenced
this pull request
Mar 28, 2026
…201) SQLite's datetime('now', '-60 seconds') returns space-separated format while started_at is stored in ISO 8601 with T separator. The T character sorts after space in ASCII, making the < comparison always false — cleanup never matched. - Replace SQLite datetime() with Python-computed ISO 8601 thresholds in all 4 queries - finalize_orphaned_skipped_executions now sets status='failed' (was non-terminal) - No-session check matches both NULL and empty-string claude_session_id Closes #137
Contributor
AndriiPasternak31
deleted the
AndriiPasternak31/issue-137-scheduler-misfire
branch
April 25, 2026 17:59
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
Fixes #137 — the cleanup service was failing to catch two categories of orphaned executions:
Root cause: SQLite's
datetime('now', '-60 seconds')returns space-separated format (2026-03-27 01:20:00) whilestarted_atis stored in ISO 8601 withTseparator (2026-03-27T01:20:00.123456Z). In SQLite string comparison,T(ASCII 84) sorts after space (ASCII 32), making the<comparison always false for same-day timestamps.Changes:
datetime()with Python-computed ISO 8601 thresholds in all 4 affected cleanup queriesfinalize_orphaned_skipped_executionsnow setsstatus = 'failed'(was only settingcompleted_at)NULLand empty-stringclaude_session_idTest plan
sqlite3 :memory: "SELECT '2026-03-27T01:15:00.123456Z' < '2026-03-27T01:20:00';"returns1🤖 Generated with Claude Code