Harden JSON unmarshaling in job rescuer + job executor#1324
Open
brandur wants to merge 1 commit into
Open
Conversation
brandur
force-pushed
the
brandur-harden-json-unmarshaling
branch
from
July 22, 2026 18:18
d3f0011 to
51b5b61
Compare
Contributor
Author
|
Tool failure on this one that caused the original title to be wrong. Correct PR title/description now. |
Here, do a little more to harden unmarshaling in the job rescuer and job executor. Previously, if a job's JSON didn't unmarshal successfully, we'd log an error and move on, which could result in unexpected trouble. Realistically, this would be a very rare circumstance though luckily -- the Postgres/SQLite `jsonb` fields guarantee the formatting of the JSON data, so the only way for an unmarshaling problem to occur is if a job's data was stored initially, and then the JSON Go struct later change to be incompatible (i.e. string changed to an int or something of that nature). Here, during an unmarshal error, use the job's standard retry schedule and back off, discarding the job if it's at the end of its allowed retries. This approach is best because it gives the user a chance to notice the failure and correct a potential unmarshaling problem by either manipulating the job row's data or fixing their Go struct. Fixes #1323, but also addresses a similar problem in the job executor that Codex found while working.
brandur
force-pushed
the
brandur-harden-json-unmarshaling
branch
from
July 22, 2026 21:42
51b5b61 to
ece9af6
Compare
bgentry
approved these changes
Jul 23, 2026
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.
Here, do a little more to harden unmarshaling in the job rescuer and job
executor. Previously, if a job's JSON didn't unmarshal successfully,
we'd log an error and move on, which could result in unexpected trouble.
Realistically, this would be a very rare circumstance though luckily --
the Postgres/SQLite
jsonbfields guarantee the formatting of the JSONdata, so the only way for an unmarshaling problem to occur is if a job's
data was stored initially, and then the JSON Go struct later change to
be incompatible (i.e. string changed to an int or something of that
nature).
Here, during an unmarshal error, use the job's standard retry schedule
and back off, discarding the job if it's at the end of its allowed
retries. This approach is best because it gives the user a chance to
notice the failure and correct a potential unmarshaling problem by
either manipulating the job row's data or fixing their Go struct.
Fixes #1323, but also addresses a similar problem in the job executor
that Codex found while working.