feat(job): honor the authored retryPolicy / timeout in the job scheduler (#3494)#3529
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 3 package(s): 113 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
…3494) JobSchema.retryPolicy and JobSchema.timeout were parsed-but-ignored (the 2026-06 liveness audit's aspirational-config cluster). Built rather than pruned: - spec: IJobService.schedule gains an optional 4th options argument (JobScheduleOptions with retryPolicy/timeout + JobRetryPolicy type); backward compatible. JobSchema describe strings updated (EXPERIMENTAL markers removed). - service-job: new runWithPolicy helper (+ JobTimeoutError) wraps handler invocation in CronJobAdapter and IntervalJobAdapter; DbJobAdapter threads options through. Failed attempts (incl. timeouts) retry with exponential backoff up to maxRetries; over-limit attempts record execution status 'timeout'. No options = legacy single-attempt behavior (guarded by test). - runtime: AppPlugin declarative-jobs registration forwards the authored retryPolicy/timeout. Tests were written first and verified red on the old adapters (handler called once, no timeout status), then green on the implementation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…olution The package's dts build runs under moduleResolution nodenext — relative imports of run-with-policy must carry the .js extension. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
xuyushun441-sys
force-pushed
the
feat/job-retry-timeout-3494
branch
from
July 27, 2026 03:07
1075d7d to
04d5e06
Compare
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.
Part of #3494 (together with #3516 this completes the issue — closes #3494 once both land). The Job row of the aspirational-config cluster is built, not pruned: retry/backoff and per-run time limits are semantics job authors reasonably expect.
What
JobSchema.retryPolicy/JobSchema.timeoutwere parsed-but-ignored — the cron adapter'sexecute()was a bare try/catch with no retry, backoff, or time limit. Now enforced end to end:IJobService.schedulegains an optional 4thoptionsargument (JobScheduleOptionswithretryPolicy/timeout, mirroring the authorableRetryPolicySchema); newJobRetryPolicytype. Backward compatible: existing 3-arg callers/implementations unchanged.JobSchemadescribe strings drop their[EXPERIMENTAL — not enforced]markers.runWithPolicyhelper (exported, withJobTimeoutError) wraps the handler invocation in CronJobAdapter and IntervalJobAdapter; DbJobAdapter threads options to its inner adapters, so the persisted path records onesys_job_runrow per attempt. Semantics: failed attempts (including timeouts) retry with exponential backoffbackoffMs * backoffMultiplier^(retry-1)up tomaxRetriesretries after the initial attempt; an attempt exceedingtimeoutrecords execution status'timeout'(the pre-existing but never-usedJobExecutionstatus). Nooptions→ exactly the legacy single-attempt behavior, guarded by a dedicated test.retryPolicy/timeout(previously dropped at this layer).Test discipline
The 6 new adapter tests were written first and verified red on the old adapters (flaky handler called once instead of retrying; slow handler recorded
successinstead oftimeout), then green on the implementation. service-job: 37/37. Affected-package sweep (turbo test --filter='...[origin/main]' --force): green (one unrelated flake in service-automation passes standalone). Full-repoturbo type-check --force: green.Notes
RetryPolicySchemahas no maxDelay knob; delay growth is bounded only bymaxRetries. Left as-is — adding knobs is out of scope for reconnecting the existing ones.🤖 Generated with Claude Code