Replace per-query timeout with slow-rule logging; deprecate --timeout option#210
Merged
MarshalX merged 2 commits intoJun 24, 2026
Merged
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ba162c2239
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
MikaYuoadas
previously approved these changes
Jun 23, 2026
whitemerch
previously approved these changes
Jun 24, 2026
…cTimeout from the engine
|
🎯 Code Coverage (details) 🔗 Commit SHA: 1c0f277 | Docs | Datadog PR Page | Give us feedback! |
whitemerch
approved these changes
Jun 24, 2026
MarshalX
deleted the
ilya.siamionau/K9CODESEC-2452/deprecate-timeout-option
branch
June 24, 2026 12:07
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.
Motivation
A per-query wall-clock timeout (
--timeout) was bounding rego eval + result decode. Under worker contention this cut queries off at a timing-dependent point, producing non-deterministic finding counts and silently dropping findings (the same class of bug addressed for decode in #209). Rather than tuning the timeout, we want queries to run to completion and instead surface slow rules via logs so they can be debugged/optimized later — without failing the scan.This deprecates and disables
--timeout, removes query time-bounding, and adds slow-rule logging.JIRA Ticket: https://datadoghq.atlassian.net/browse/K9CODESEC-2452 (follow-up to #209 / K9CODESEC-2411)
Changes
pkg/engine/inspector.godoRunno longer wraps eval incontext.WithTimeout; eval runs on the scan context and is only stopped by real scan cancellation. Removed thequeryExecTimeoutfield/computation/log.slowQueryWarnThreshold(60s), emits a structuredWarn(event=slow_rule,queryID,platform,evalMs,decodeMs,totalMs,thresholdMs). The query always completes — it is never failed or dropped for being slow.cmd/scanner/scan.go—--timeoutis now hidden and marked(DEPRECATED); logs a deprecation warning when set; no longer wired into scan parameters.pkg/scan/client.go—Parameters.QueryExecTimeoutmarkedDeprecated: ignored(kept for struct/CLI compatibility).Author Checklist
No new unit test: the change removes a code path (timeout enforcement) and adds observability logging; behavior is covered by existing engine/scan tests, and the removed
e2e-cli-056no longer applies.QA Instruction
--timeout 5(or any value) — you should see a deprecation warning (the --timeout flag is deprecated and no longer has any effect…) and identical results to running without it.event=slow_ruleand the*Msfields appears; the scan still completes normally.Blast Radius
DataDog IaC Scanner only (query engine + CLI). Behavioral change: queries are no longer time-bounded, so a single pathological rule could run longer than before (mitigated by logging, and bounded by overall scan/process lifecycle).
--timeoutremains accepted for backward compatibility but has no effect. No change to which findings are produced for normal rules.Additional Notes
I submit this contribution under the Apache-2.0 license.