Repository navigation
fix(s12): skip malformed durable jobs with non-string fields - #670
Open
shuhuNB515 wants to merge 1 commit into
Open
shuhuNB515 wants to merge 1 commit into
shuhuNB515 wants to merge 1 commit into
Conversation
CronJob fields loaded from .scheduled_tasks.json were validated with .startswith()/.strip() before type checks. A saved job with a non-string id, prompt, or cron raised AttributeError, which escaped the per-item handler and crashed load_durable_jobs() (and therefore startup). Validate field types first and widen the handler to AttributeError so one bad entry is skipped like any other corrupt job. Sync the embedded s12 snapshot in versions.json. Disclosed AI assistance: found during an AI-assisted review.
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.
Fixes #668
Problem
load_durable_jobs()ins12_cron_scheduler/code.pyvalidates each persisted job so one corrupt entry can be skipped. However it calledjob.id.startswith(...)andjob.prompt.strip()before checking that those fields were strings. An entry with a non-string field raisedAttributeError, which was outside the per-itemexcept (TypeError, ValueError), so loading aborted and even the valid jobs were lost. Becausestart_runtime_threads()callsload_durable_jobs()before starting the REPL,__main__crashed before the agent could run.Fix
isinstance(job.id, str)/isinstance(job.prompt, str)before using string methods.AttributeErrorto the per-item handler, so a non-stringcronis also skipped with the same warning.web/src/data/generated/versions.json(asserted byte-identical tocode.py).Verification (real module)
id: 12345AttributeErroraborts load, 0 jobs loadedpython3 -m pytest tests -q: 503 passed, 118 subtests passed.Disclosed AI assistance: found and fixed during an AI-assisted review; both failure modes were reproduced against the real module before and after the change.