Skip to content

feat(scan): add a build timeout to --dynamic-sbom-inference - #1819

Open
Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 3 commits into
jfblaa/dsi-settings-flagsfrom
jfblaa/dsi-build-timeout
Open

Jeppe Fredsgaard Blaabjerg (jfblaa) wants to merge 3 commits into
jfblaa/dsi-settings-flagsfrom
jfblaa/dsi-build-timeout

Conversation

@jfblaa

@jfblaa Jeppe Fredsgaard Blaabjerg (jfblaa) commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Bounds the build tool runs of each --dynamic-sbom-inference build root by a timeout, so a hung build fails with a message instead of stalling the scan. It defaults to 3600 seconds; --dynamic-sbom-inference-build-timeout on socket scan create, socket scan reach and socket fix, and --build-timeout on socket manifest dynamic-sbom-inference, set it in seconds (e.g. 1800) or turn it off with 0.

Draft until Coana 15.15.10 is released and pinned: Coana applies the timeout (coana-tech/coana-package-manager#2922), and its request schema rejects the new field before that version.

Behaviour
  • The timeout covers all of a root's build tool runs together; socket-cli counts each Coana run against it and passes the time already spent.
  • The default goes only to a Coana that applies it, so an older --reach-version keeps working without a timeout. A timeout given on the command line requires Coana 15.15.10 and fails clearly on an older one.
  • The flag takes what --reach-analysis-timeout takes: a whole number of seconds, optionally with s, m or h.
  • Command line only, not a socket.json setting.
Tests
  • reachability-flags.test.mts: parsing, defaults, 0, invalid values, and the requires---dynamic-sbom-inference error.
  • run-manifest-facts.test.mts: the request carries the timeout and time spent only on a Coana that takes them; the minimum Coana version for a user-set timeout.
  • Help snapshots, inline and native.

`--dynamic-sbom-inference` failed scan create, scan reach and fix when a
repository had no .NET, Gradle, Maven or sbt build, so the flag could not
be passed to every repository. They now log that no build root was found
and continue as without the flag, and `socket manifest
dynamic-sbom-inference` reports it and exits successfully.
Scanning many repositories with --dynamic-sbom-inference needed a
socket.json in each to tolerate unresolved dependencies. The new flag on
scan create, scan reach and fix applies to every build and overrides
socket.json, as --ignore-unresolved does on the manifest command.

The scan commands do not declare --ignore-unresolved, --exclude-configs,
--include-configs or --verbose, so each could take the scan target as its
value. They are now rejected with a pointer to the flag or socket.json
setting to use instead.

DynamicSbomInference now carries the selected ecosystems and the
ignore-unresolved override together.
A hung build tool could stall --dynamic-sbom-inference indefinitely. Each
build root now has a timeout covering all of its build tool runs together:
--dynamic-sbom-inference-build-timeout on scan create, scan reach and fix,
and --build-timeout on the manifest command. Values use the format of
--reach-analysis-timeout, and 0 turns the timeout off.

Coana applies the timeout. A Coana too old to take one gets no default,
and setting the flag requires the first Coana that applies it.
@cursor

cursor Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches core dynamic SBOM inference and Coana spawn/request wiring; mis-timed builds could fail legitimate slow monorepos, and behavior depends on Coana 15.15.10 for explicit timeouts.

Overview
Adds a per-build-root timeout for --dynamic-sbom-inference, so hung Gradle/Maven/sbt/.NET builds fail instead of blocking scans indefinitely. The default is 3600s; use --dynamic-sbom-inference-build-timeout on socket scan create, socket scan reach, and socket fix, or --build-timeout on socket manifest dynamic-sbom-inference (seconds with optional s/m/h; 0 disables).

socket-cli tracks elapsed time across all Coana runs for one root (listing + facts generation) and sends buildTimeout plus remaining budget in the generate-socket-facts request. A user-set timeout requires Coana 15.15.10+; the default is only applied when Coana supports it, so older pinned versions keep working without the new field.

Reviewed by Cursor Bugbot for commit 68edae1. Configure here.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant