fix(cron): deliver full SQLite TEXT for job schedule and message - #73
Draft
cursor[bot] wants to merge 1 commit into
Draft
fix(cron): deliver full SQLite TEXT for job schedule and message#73cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Fixed-size cron_job_row_t buffers silently truncated TEXT on read. A due interval job whose truncated schedule no longer parsed stayed due and re-fired every poll. Messages over 511 bytes were clipped before the agent ran. Co-authored-by: esadrianno <esadrianno@gmail.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.
Bug and impact
cron_job_get_next_due/cron_job_listcopied SQLite TEXT intoschedule[128]andmessage[512]viacopy_str_bounded. The full string was stored on create. The truncated copy was whatcron_pollparsed and injected.Trigger A: a recurring
interval:job whose stored schedule is longer than 127 bytes (valid at create, for exampleinterval:plus padding zeros plus60). On fire, the clipped schedule no longer parses (interval:0or a cut number), socron_job_update_next_runis skipped. The row stays due andcron_polldelivers it on every main-loop tick: repeatedagent_run/ provider calls until the process is stopped.Trigger B: a reminder whose message is longer than 511 bytes (email draft, meeting notes). The job fires with a silently clipped prompt. The agent acts on incomplete instructions.
Distinct from #57 (commit before delivery) and #65 (
cron_next_from_exprreturning the current minute).Root cause
Fixed-size
cron_job_row_tbuffers cannot hold unbounded SQLite TEXT. Truncation was silent. Failed reschedule leftnext_runin the past.Fix
Heap-copy
scheduleandmessageon read. Callerscron_job_row_free()the row. Poll, tool list, and dashboard list all go through that path.Validation
make test_cron: all tests passed, including full 599-byte message delivery and a 131-byteinterval:schedule that advancesnext_runso a second poll is idlemake test_memory: passedtest_cronunder GCC ASan/UBSan with leak detection: passedGATEWAY=1routes.c was not compiled here (no libwebsockets). The list handler only addscron_job_row_freearound the existing JSON build.