Fix: gap auto-fill scheduler fails with "Backfill cannot look back more than 90 days"#256507
Merged
nkhristinin merged 2 commits intoelastic:mainfrom Mar 7, 2026
Merged
Conversation
Contributor
Author
|
@elasticmachine merge upstream |
Contributor
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]
cc @nkhristinin |
Contributor
|
Starting backport for target branches: 9.3 |
kibanamachine
pushed a commit
to kibanamachine/kibana
that referenced
this pull request
Mar 7, 2026
…re than 90 days" (elastic#256507) ## Fix: gap auto-fill scheduler fails with "Backfill cannot look back more than 90 days" ### Problem Suppose we have gaps that are 100 days old. Backfill scheduling enforces a 90-day validation limit. The gap auto-fill scheduler fetches all gaps that overlap the `now-90d` range, so these 100-day-old gaps can still be fetched because their interval overlaps that window. Their interval is then clamped to 90 days. Later, when `scheduleBackfill` validates the ranges, it computes its own `now`, which is slightly later because some processing time has elapsed since the task started. As a result, `now - startDate` can become greater than 90 days, and the validation rejects the range with: ```text Backfill cannot look back more than 90 days ``` ### Fix After parsing `gapFillRange`, clamp `startDate` so it stays at least 5 minutes inside the 90-day lookback window. This gives enough buffer for processing delays and ensures the clamped ranges remain safely within the validation limit. ### How to test I created this elastic/security-documents-generator#313 for utility which generate rules with gaps. It allows to have long gaps: 1 rules with 1m interval with 1 gap of 100 days durations `npm run start -- rules --rules 100 -d 100 -i"1m" -c` In main enable gap auto fill scheduler, and observe that execution is failed. In this PR - it should successfully execute the task Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> (cherry picked from commit c929b3e)
Contributor
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
kibanamachine
added a commit
that referenced
this pull request
Mar 7, 2026
…ack more than 90 days" (#256507) (#256578) # Backport This will backport the following commits from `main` to `9.3`: - [Fix: gap auto-fill scheduler fails with "Backfill cannot look back more than 90 days" (#256507)](#256507) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Khristinin Nikita","email":"nikita.khristinin@elastic.co"},"sourceCommit":{"committedDate":"2026-03-07T07:04:24Z","message":"Fix: gap auto-fill scheduler fails with \"Backfill cannot look back more than 90 days\" (#256507)\n\n## Fix: gap auto-fill scheduler fails with \"Backfill cannot look back\nmore than 90 days\"\n\n### Problem\n\nSuppose we have gaps that are 100 days old.\n\nBackfill scheduling enforces a 90-day validation limit. The gap\nauto-fill scheduler fetches all gaps that overlap the `now-90d` range,\nso these 100-day-old gaps can still be fetched because their interval\noverlaps that window. Their interval is then clamped to 90 days.\n\nLater, when `scheduleBackfill` validates the ranges, it computes its own\n`now`, which is slightly later because some processing time has elapsed\nsince the task started. As a result, `now - startDate` can become\ngreater than 90 days, and the validation rejects the range with:\n\n```text\nBackfill cannot look back more than 90 days\n```\n\n### Fix\n\nAfter parsing `gapFillRange`, clamp `startDate` so it stays at least 5\nminutes inside the 90-day lookback window. This gives enough buffer for\nprocessing delays and ensures the clamped ranges remain safely within\nthe validation limit.\n\n### How to test\n\n\nI created this\nhttps://github.com/elastic/security-documents-generator/pull/313 for\nutility which generate rules with gaps. It allows to have long gaps:\n\n1 rules with 1m interval with 1 gap of 100 days durations\n `npm run start -- rules --rules 100 -d 100 -i\"1m\" -c`\n\nIn main enable gap auto fill scheduler, and observe that execution is\nfailed.\n\nIn this PR - it should successfully execute the task\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"c929b3e7620e1d71c6de2ac444f979b48f41aad1","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:version","v9.3.0","v9.4.0"],"title":"Fix: gap auto-fill scheduler fails with \"Backfill cannot look back more than 90 days\"","number":256507,"url":"https://github.com/elastic/kibana/pull/256507","mergeCommit":{"message":"Fix: gap auto-fill scheduler fails with \"Backfill cannot look back more than 90 days\" (#256507)\n\n## Fix: gap auto-fill scheduler fails with \"Backfill cannot look back\nmore than 90 days\"\n\n### Problem\n\nSuppose we have gaps that are 100 days old.\n\nBackfill scheduling enforces a 90-day validation limit. The gap\nauto-fill scheduler fetches all gaps that overlap the `now-90d` range,\nso these 100-day-old gaps can still be fetched because their interval\noverlaps that window. Their interval is then clamped to 90 days.\n\nLater, when `scheduleBackfill` validates the ranges, it computes its own\n`now`, which is slightly later because some processing time has elapsed\nsince the task started. As a result, `now - startDate` can become\ngreater than 90 days, and the validation rejects the range with:\n\n```text\nBackfill cannot look back more than 90 days\n```\n\n### Fix\n\nAfter parsing `gapFillRange`, clamp `startDate` so it stays at least 5\nminutes inside the 90-day lookback window. This gives enough buffer for\nprocessing delays and ensures the clamped ranges remain safely within\nthe validation limit.\n\n### How to test\n\n\nI created this\nhttps://github.com/elastic/security-documents-generator/pull/313 for\nutility which generate rules with gaps. It allows to have long gaps:\n\n1 rules with 1m interval with 1 gap of 100 days durations\n `npm run start -- rules --rules 100 -d 100 -i\"1m\" -c`\n\nIn main enable gap auto fill scheduler, and observe that execution is\nfailed.\n\nIn this PR - it should successfully execute the task\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"c929b3e7620e1d71c6de2ac444f979b48f41aad1"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"9.3","label":"v9.3.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/256507","number":256507,"mergeCommit":{"message":"Fix: gap auto-fill scheduler fails with \"Backfill cannot look back more than 90 days\" (#256507)\n\n## Fix: gap auto-fill scheduler fails with \"Backfill cannot look back\nmore than 90 days\"\n\n### Problem\n\nSuppose we have gaps that are 100 days old.\n\nBackfill scheduling enforces a 90-day validation limit. The gap\nauto-fill scheduler fetches all gaps that overlap the `now-90d` range,\nso these 100-day-old gaps can still be fetched because their interval\noverlaps that window. Their interval is then clamped to 90 days.\n\nLater, when `scheduleBackfill` validates the ranges, it computes its own\n`now`, which is slightly later because some processing time has elapsed\nsince the task started. As a result, `now - startDate` can become\ngreater than 90 days, and the validation rejects the range with:\n\n```text\nBackfill cannot look back more than 90 days\n```\n\n### Fix\n\nAfter parsing `gapFillRange`, clamp `startDate` so it stays at least 5\nminutes inside the 90-day lookback window. This gives enough buffer for\nprocessing delays and ensures the clamped ranges remain safely within\nthe validation limit.\n\n### How to test\n\n\nI created this\nhttps://github.com/elastic/security-documents-generator/pull/313 for\nutility which generate rules with gaps. It allows to have long gaps:\n\n1 rules with 1m interval with 1 gap of 100 days durations\n `npm run start -- rules --rules 100 -d 100 -i\"1m\" -c`\n\nIn main enable gap auto fill scheduler, and observe that execution is\nfailed.\n\nIn this PR - it should successfully execute the task\n\nCo-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>","sha":"c929b3e7620e1d71c6de2ac444f979b48f41aad1"}}]}] BACKPORT--> Co-authored-by: Khristinin Nikita <nikita.khristinin@elastic.co> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
kapral18
pushed a commit
to kapral18/kibana
that referenced
this pull request
Mar 9, 2026
…re than 90 days" (elastic#256507) ## Fix: gap auto-fill scheduler fails with "Backfill cannot look back more than 90 days" ### Problem Suppose we have gaps that are 100 days old. Backfill scheduling enforces a 90-day validation limit. The gap auto-fill scheduler fetches all gaps that overlap the `now-90d` range, so these 100-day-old gaps can still be fetched because their interval overlaps that window. Their interval is then clamped to 90 days. Later, when `scheduleBackfill` validates the ranges, it computes its own `now`, which is slightly later because some processing time has elapsed since the task started. As a result, `now - startDate` can become greater than 90 days, and the validation rejects the range with: ```text Backfill cannot look back more than 90 days ``` ### Fix After parsing `gapFillRange`, clamp `startDate` so it stays at least 5 minutes inside the 90-day lookback window. This gives enough buffer for processing delays and ensures the clamped ranges remain safely within the validation limit. ### How to test I created this elastic/security-documents-generator#313 for utility which generate rules with gaps. It allows to have long gaps: 1 rules with 1m interval with 1 gap of 100 days durations `npm run start -- rules --rules 100 -d 100 -i"1m" -c` In main enable gap auto fill scheduler, and observe that execution is failed. In this PR - it should successfully execute the task Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
qn895
pushed a commit
to qn895/kibana
that referenced
this pull request
Mar 11, 2026
…re than 90 days" (elastic#256507) ## Fix: gap auto-fill scheduler fails with "Backfill cannot look back more than 90 days" ### Problem Suppose we have gaps that are 100 days old. Backfill scheduling enforces a 90-day validation limit. The gap auto-fill scheduler fetches all gaps that overlap the `now-90d` range, so these 100-day-old gaps can still be fetched because their interval overlaps that window. Their interval is then clamped to 90 days. Later, when `scheduleBackfill` validates the ranges, it computes its own `now`, which is slightly later because some processing time has elapsed since the task started. As a result, `now - startDate` can become greater than 90 days, and the validation rejects the range with: ```text Backfill cannot look back more than 90 days ``` ### Fix After parsing `gapFillRange`, clamp `startDate` so it stays at least 5 minutes inside the 90-day lookback window. This gives enough buffer for processing delays and ensures the clamped ranges remain safely within the validation limit. ### How to test I created this elastic/security-documents-generator#313 for utility which generate rules with gaps. It allows to have long gaps: 1 rules with 1m interval with 1 gap of 100 days durations `npm run start -- rules --rules 100 -d 100 -i"1m" -c` In main enable gap auto fill scheduler, and observe that execution is failed. In this PR - it should successfully execute the task Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.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.
Fix: gap auto-fill scheduler fails with "Backfill cannot look back more than 90 days"
Problem
Suppose we have gaps that are 100 days old.
Backfill scheduling enforces a 90-day validation limit. The gap auto-fill scheduler fetches all gaps that overlap the
now-90drange, so these 100-day-old gaps can still be fetched because their interval overlaps that window. Their interval is then clamped to 90 days.Later, when
scheduleBackfillvalidates the ranges, it computes its ownnow, which is slightly later because some processing time has elapsed since the task started. As a result,now - startDatecan become greater than 90 days, and the validation rejects the range with:Fix
After parsing
gapFillRange, clampstartDateso it stays at least 5 minutes inside the 90-day lookback window. This gives enough buffer for processing delays and ensures the clamped ranges remain safely within the validation limit.How to test
I created this elastic/security-documents-generator#313 for utility which generate rules with gaps. It allows to have long gaps:
1 rules with 1m interval with 1 gap of 100 days durations
npm run start -- rules --rules 100 -d 100 -i"1m" -cIn main enable gap auto fill scheduler, and observe that execution is failed.
In this PR - it should successfully execute the task