diff --git a/server/code/app/index/compiler_tier.py b/server/code/app/index/compiler_tier.py index 1e4e489ef66..1f9834339b6 100644 --- a/server/code/app/index/compiler_tier.py +++ b/server/code/app/index/compiler_tier.py @@ -18,7 +18,7 @@ import subprocess from collections.abc import Awaitable, Callable, Mapping, Sequence from pathlib import Path -from typing import TYPE_CHECKING, Any, Protocol, TypedDict, Unpack +from typing import TYPE_CHECKING, Any, NamedTuple, Protocol, TypedDict, Unpack from server.code.app.index import erasing, tier_health from server.code.app.index.entry_lock import EntryLockHeld, EntryLockLost, check_held, entry_lock @@ -652,6 +652,17 @@ def checkout_fetch_args(bare: Path | str, target: str) -> list[str]: ] +def fetch_timeout_s() -> float: + """`code_git_fetch_timeout_s` as the supervisor read it when it admitted this pass + (the value the pass deadline is priced at), the live setting outside a supervised + pass. A checkout reads it once and gives it to every git step, so a runtime update + during the checkout cannot outlast the deadline.""" + ctx = pass_context.current() + if ctx is not None and ctx.git_fetch_timeout_s is not None: + return ctx.git_fetch_timeout_s + return float(settings.code_git_fetch_timeout_s) + + class GitBudget(TypedDict, total=False): """`git`'s time budget, forwarded by a helper that runs several git jobs.""" @@ -659,33 +670,76 @@ class GitBudget(TypedDict, total=False): retries: int +class GitStep(NamedTuple): + """One `git` call of a checkout move: its words after `git`, the bare clone a + fetch reads, and whether the step reaches the network.""" + + args: tuple[str, ...] + local_remote: Path | None = None + network: bool = False + + +# The submodule half of a checkout move. `update` fetches from the URL a submodule +# was first initialized with, so the URLs are synced from the checked-out +# .gitmodules: the top level's first, then, once it is at its pins, the nested ones' +# from their parents' new trees. A submodule three levels down that moved syncs a +# pass later. +SUBMODULE_STEPS: tuple[GitStep, ...] = ( + GitStep(("submodule", "sync", "--quiet")), + GitStep(("submodule", "update", "--init", "--quiet"), network=True), + GitStep(("submodule", "sync", "--recursive", "--quiet")), + GitStep(("submodule", "update", "--init", "--recursive", "--quiet"), network=True), +) + +# How many times `git` runs a timed-out step again, so one step is up to +# `1 + CHECKOUT_MOVE_RETRIES` attempts. +CHECKOUT_MOVE_RETRIES = 1 # not a setting: the retry count the pass deadline is priced at + + +def checkout_lead_steps(bare: Path, target: str) -> tuple[GitStep, ...]: + """The move's steps ahead of the submodules: the fetch of `target` from the bare + clone and the forced checkout of it. The fetch never recurses: one submodule pin + rewritten away upstream fatals the whole fetch.""" + return ( + GitStep(tuple(checkout_fetch_args(bare, target)), local_remote=bare), + GitStep(("checkout", "--force", target)), + ) + + +def checkout_move_attempts() -> int: + """The most `git` runs one checkout move can make: the lead steps, then the + submodule steps (`update_submodules`), each run once more after a timeout. A tier + whose pass moves a checkout adds this many `code_git_fetch_timeout_s` budgets to + its deadline (`WorkerSpec.git_fetch_budgets`), read from here so the count cannot + fall behind the sequence. The empty arguments only size the list: the builders + take their paths and read no repository.""" + return (len(checkout_lead_steps(Path(), "")) + len(SUBMODULE_STEPS)) * ( + 1 + CHECKOUT_MOVE_RETRIES + ) + + +async def run_checkout_steps( + checkout: Path, steps: Sequence[GitStep], cfg: RepoConfig, **budget: Unpack[GitBudget] +) -> None: + """Run `steps` in order as `git` jobs of `checkout`: the fetch reads its bare + clone and no network, the submodule updates reach the network with the entry's + token and proxy identity.""" + for step in steps: + kwargs: dict[str, Any] = {"local_remote": step.local_remote, **budget} + if step.network: + kwargs.update( + network=True, + token=cfg.github_token, + remote=cfg.git_remote, + proxy_identity=cfg.git_proxy_identity, + ) + await git(checkout, *step.args, **kwargs) + + async def update_submodules(checkout: Path, cfg: RepoConfig, **budget: Unpack[GitBudget]) -> None: - """Check the submodules out at their pins. `update` fetches from the URL a submodule - was first initialized with, so the URLs are synced from the checked-out .gitmodules: - the top level's first, then, once it is at its pins, the nested ones' from their - parents' new trees. A submodule three levels down that moved syncs a pass later.""" - for recursive in ((), ("--recursive",)): - await git( - checkout, - "submodule", - "sync", - *recursive, - "--quiet", - **budget, - ) - await git( - checkout, - "submodule", - "update", - "--init", - *recursive, - "--quiet", - network=True, - token=cfg.github_token, - remote=cfg.git_remote, - proxy_identity=cfg.git_proxy_identity, - **budget, - ) + """Check the submodules out at their pins, through `SUBMODULE_STEPS` (the steps a + checkout move's submodule half is budgeted for).""" + await run_checkout_steps(checkout, SUBMODULE_STEPS, cfg, **budget) async def git( diff --git a/server/code/app/index/scip_full.py b/server/code/app/index/scip_full.py index 70b6172219e..ec6404e2e99 100644 --- a/server/code/app/index/scip_full.py +++ b/server/code/app/index/scip_full.py @@ -74,26 +74,27 @@ def __init__(self, returncode: int, tail: str, *, kind: str = "") -> None: async def move_checkout(checkout: Path, bare: Path, target: str, cfg: RepoConfig) -> None: """Fetch `target` from the bare clone, force-check it out, then the submodules exactly at their pins. Never recurse submodules on the fetch: one pin rewritten - away upstream fatals the whole fetch. Each step gets a real budget and one retry - (the delta's 600 s is sized for a few merges); the fetch reads the bare clone, - the submodule pins come from the network.""" - await compiler_tier.git( + away upstream fatals the whole fetch. Every step runs under + `code_git_fetch_timeout_s` with one retry (`compiler_tier.CHECKOUT_MOVE_RETRIES`): + the fetch reads the bare clone, the submodule pins come from the network. + `compiler_tier.checkout_move_attempts` counts the steps of both halves, and the + registry gives a tier's pass deadline that many budgets, so the deadline covers + the whole move rather than a hand-counted part of it. The timeout is the one + the pass was admitted with (`pass_context.git_fetch_timeout_s`), read once for + every step: a runtime update during the move cannot outlast the pass deadline.""" + timeout_s = compiler_tier.fetch_timeout_s() + await compiler_tier.run_checkout_steps( checkout, - *compiler_tier.checkout_fetch_args(bare, target), - local_remote=bare, - timeout_s=settings.code_git_fetch_timeout_s, - retries=1, - ) - await compiler_tier.git( - checkout, - "checkout", - "--force", - target, - timeout_s=settings.code_git_fetch_timeout_s, - retries=1, + compiler_tier.checkout_lead_steps(bare, target), + cfg, + timeout_s=timeout_s, + retries=compiler_tier.CHECKOUT_MOVE_RETRIES, ) await compiler_tier.update_submodules( - checkout, cfg, timeout_s=settings.code_git_fetch_timeout_s, retries=1 + checkout, + cfg, + timeout_s=timeout_s, + retries=compiler_tier.CHECKOUT_MOVE_RETRIES, ) diff --git a/server/code/workers/scip_delta.py b/server/code/workers/scip_delta.py index 3bd5aa75423..064f67923af 100644 --- a/server/code/workers/scip_delta.py +++ b/server/code/workers/scip_delta.py @@ -31,9 +31,8 @@ from typing import TYPE_CHECKING from server.code.app.index.compiler_tier import ( - checkout_fetch_args, + checkout_move_attempts, compiler_target, - git, harness_failure, open_tier_delta, passthrough_env, @@ -42,12 +41,11 @@ resolve_checkout, run_harness, run_tier, - update_submodules, ) from server.code.app.index.entry_lock import check_held from server.code.app.index.gitrepo import git_config_env from server.code.app.index.sandbox import tool_mounts -from server.code.app.index.scip_full import work_dir +from server.code.app.index.scip_full import move_checkout, work_dir from server.core.paths import SCIP_HARNESS_DIR from server.settings import settings @@ -60,6 +58,10 @@ _HARNESS = SCIP_HARNESS_DIR / "run_delta.sh" PRODUCER = "clang" WATERMARK = "scip_commit" +# The checkout move's worst case: every git attempt `move_checkout` can make (its +# steps, retried once each). The registry reads this for the pass deadline's git +# budget, so the deadline covers the sequence the pass actually runs. +CHECKOUT_MOVE_ATTEMPTS = checkout_move_attempts() @dataclass @@ -127,9 +129,7 @@ async def _run_repo(repo: CodeRepo, cfg: RepoConfig, result: CodeScipDeltaResult # fetch and stalls the compiler tier. Only `submodule update` below needs # pins, and only the ones at the target itself; it fetches the URLs the # repository's .gitmodules names, so it goes through the egress proxy. - await git(checkout, *checkout_fetch_args(bare, target), local_remote=bare) - await git(checkout, "checkout", "--force", target) - await update_submodules(checkout, cfg) + await move_checkout(checkout, bare, target, cfg) with tempfile.TemporaryDirectory(prefix="scip_delta_", dir=work_dir()) as tmp: delta_path = Path(tmp) / "delta.json" diff --git a/server/code/workers/scip_go_delta.py b/server/code/workers/scip_go_delta.py index f2f7a03e57c..8cdf5c9a565 100644 --- a/server/code/workers/scip_go_delta.py +++ b/server/code/workers/scip_go_delta.py @@ -60,6 +60,7 @@ TierDegraded, checkout_fetch_args, compiler_target, + fetch_timeout_s, git, harness_failure, open_tier_delta, @@ -315,8 +316,20 @@ async def _run_repo(repo: CodeRepo, cfg: RepoConfig, result: CodeScipGoDeltaResu if missing: result.skipped.append(f"{cfg.namespace}: {missing}") return False - await git(checkout, *checkout_fetch_args(bare, target), local_remote=bare) - await git(checkout, "checkout", "--force", target) + fetch_s = fetch_timeout_s() # one read for both steps + await git( + checkout, + *checkout_fetch_args(bare, target), + local_remote=bare, + timeout_s=fetch_s, + ) + await git( + checkout, + "checkout", + "--force", + target, + timeout_s=fetch_s, + ) retry = await _known_retry(repo, cfg, checkout, retry) # base -> the modules to run from it; [] is every module. A module still to retry diff --git a/server/code/workers/scip_py_delta.py b/server/code/workers/scip_py_delta.py index 7d2fd388065..ee7498de2e3 100644 --- a/server/code/workers/scip_py_delta.py +++ b/server/code/workers/scip_py_delta.py @@ -30,6 +30,7 @@ from server.code.app.index.compiler_tier import ( checkout_fetch_args, compiler_target, + fetch_timeout_s, git, gone_documents, harness_failure, @@ -101,8 +102,20 @@ async def _run_repo(repo: CodeRepo, cfg: RepoConfig, result: CodeScipPyDeltaResu if missing: result.skipped.append(f"{cfg.namespace}: {missing}") return - await git(checkout, *checkout_fetch_args(bare, target), local_remote=bare) - await git(checkout, "checkout", "--force", target) + fetch_s = fetch_timeout_s() # one read for both steps + await git( + checkout, + *checkout_fetch_args(bare, target), + local_remote=bare, + timeout_s=fetch_s, + ) + await git( + checkout, + "checkout", + "--force", + target, + timeout_s=fetch_s, + ) with tempfile.TemporaryDirectory(prefix="scip_py_delta_") as tmp: delta_path = Path(tmp) / "delta.json" await _run_harness(checkout, scip_commit or "--full", target, delta_path, cfg=cfg) diff --git a/server/code/workers/scip_ts_delta.py b/server/code/workers/scip_ts_delta.py index 97c7a1e0bb6..af0a5b34b83 100644 --- a/server/code/workers/scip_ts_delta.py +++ b/server/code/workers/scip_ts_delta.py @@ -38,6 +38,7 @@ from server.code.app.index.compiler_tier import ( checkout_fetch_args, compiler_target, + fetch_timeout_s, git, gone_documents, harness_failure, @@ -121,8 +122,20 @@ async def _run_repo(repo: CodeRepo, cfg: RepoConfig, result: CodeScipTsDeltaResu if missing: result.skipped.append(f"{cfg.namespace}: {missing}") return - await git(checkout, *checkout_fetch_args(bare, target), local_remote=bare) - await git(checkout, "checkout", "--force", target) + fetch_s = fetch_timeout_s() # one read for both steps + await git( + checkout, + *checkout_fetch_args(bare, target), + local_remote=bare, + timeout_s=fetch_s, + ) + await git( + checkout, + "checkout", + "--force", + target, + timeout_s=fetch_s, + ) lockfile_changed = bool(scip_commit and await _lockfile_changed(checkout, scip_commit, target)) if lockfile_changed: note = ( diff --git a/server/workers/pass_context.py b/server/workers/pass_context.py index faad37f4a02..9794b91d997 100644 --- a/server/workers/pass_context.py +++ b/server/workers/pass_context.py @@ -57,6 +57,11 @@ class PassContext: # an `idle_interval_seconds` is next run after that instead of its # interval: it asks less often while the last answer was "nothing". idle: bool = False + # `code_git_fetch_timeout_s` as the supervisor read it at admission, the value + # the pass deadline was computed from. A checkout move runs its git steps under + # it, so an operator raising the setting mid-pass cannot outlast that deadline. + # None outside a supervised pass. + git_fetch_timeout_s: float | None = None # The outcome `status.record_pass(worker)` recorded when this pass's # block finished cleanly; None when it recorded none (it raised, it was # cancelled, or the worker does not use `record_pass`). The status row diff --git a/server/workers/registry.py b/server/workers/registry.py index b82a24b057b..d3a96d6bc36 100644 --- a/server/workers/registry.py +++ b/server/workers/registry.py @@ -41,6 +41,11 @@ class WorkerSpec: # may wait on a provider retry loop), at most DEADLINE_CAP_SECONDS. A # pass past its deadline is cancelled and counted as a failure. max_pass_seconds: float | None = None + # How many `code_git_fetch_timeout_s` budgets the pass adds on top of + # `max_pass_seconds`. That is the one setting of the sum a runtime update + # can change (the others are read from the environment at start), so + # `deadline_seconds()` reads it when asked, not when the specs are built. + git_fetch_budgets: int = 0 # Asked once, when the supervisor starts this worker (the # lease is held). True → the first pass runs now instead of after the # boot stagger — a weekly worker whose output table is empty or older @@ -62,9 +67,18 @@ class WorkerSpec: # there is none, instead of scanning its table at one cadence for both. idle_interval_seconds: float | None = None - def deadline_seconds(self) -> float: - if self.max_pass_seconds is not None and self.max_pass_seconds > 0: - return float(self.max_pass_seconds) + def deadline_seconds(self, git_fetch_timeout_s: float | None = None) -> float: + """The pass deadline. `git_fetch_timeout_s` is the timeout the budgets are + priced at: the supervisor reads it once at admission and gives the pass the + same value; None reads the live setting.""" + seconds = self.max_pass_seconds + if seconds is not None and seconds > 0: + fetch_s = ( + settings.code_git_fetch_timeout_s + if git_fetch_timeout_s is None + else git_fetch_timeout_s + ) + return float(seconds) + self.git_fetch_budgets * float(fetch_s) return default_max_pass_seconds(self.interval_seconds) def first_pass_hook(self) -> Callable[[], Awaitable[bool]] | None: @@ -114,6 +128,13 @@ class _Worker: # Seconds added to `max_pass_setting`: a harness timeout leaves the steps # around the harness (fetch, submodules, apply) no time of their own. max_pass_headroom: float = 0.0 + # Git attempts of a checkout move, each of which may run for + # `code_git_fetch_timeout_s` (a retry doubles a step); added on top of the headroom. + max_pass_fetch_budgets: int = 0 + # The same count, read from a module attribute of the worker's own module, for a + # pass whose git sequence is a list there: the budget is derived from the list it + # runs (`compiler_tier.checkout_move_attempts`), never counted by hand. + max_pass_fetch_budgets_attr: str | None = None # WorkerSpec.max_pass_seconds from this module attribute. max_pass_attr: str | None = None # WorkerSpec.first_pass_due from this module attribute. @@ -138,11 +159,15 @@ def _spec_for(row: _Worker) -> WorkerSpec: max_pass = float(getattr(settings, row.max_pass_setting)) + row.max_pass_headroom if row.max_pass_attr is not None: max_pass = float(getattr(mod, row.max_pass_attr)) + fetch_budgets = row.max_pass_fetch_budgets + if row.max_pass_fetch_budgets_attr is not None: + fetch_budgets = int(getattr(mod, row.max_pass_fetch_budgets_attr)) return WorkerSpec( row.name, row.cadence_seconds(), pass_callable, max_pass_seconds=max_pass, + git_fetch_budgets=fetch_budgets if row.max_pass_attr is None else 0, first_pass_due=getattr(mod, row.first_pass_due) if row.first_pass_due else None, owned_tables=mod.OWNED_TABLES if row.owned_tables else (), due_scope=mod.due_scope if row.owned_tables else None, @@ -405,6 +430,11 @@ def _spec_for(row: _Worker) -> WorkerSpec: "code_scip_delta_interval_seconds", max_pass_setting="code_scip_delta_timeout_seconds", max_pass_headroom=_TIER_HEADROOM_S, + # The checkout move's whole sequence: the fetch, the forced checkout and the + # two submodule sync-update pairs, each run once more after a timeout. The + # count is that list's (`compiler_tier.checkout_move_attempts`, via the + # worker module), so a longer sequence cannot outgrow the budget again. + max_pass_fetch_budgets_attr="CHECKOUT_MOVE_ATTEMPTS", ), _Worker( "code_scip_ts_delta", @@ -413,6 +443,8 @@ def _spec_for(row: _Worker) -> WorkerSpec: "code_scip_ts_delta_interval_seconds", max_pass_setting="code_scip_ts_delta_timeout_seconds", max_pass_headroom=_TIER_HEADROOM_S, + # fetch and forced checkout + max_pass_fetch_budgets=2, ), _Worker( "code_scip_py_delta", @@ -421,6 +453,8 @@ def _spec_for(row: _Worker) -> WorkerSpec: "code_scip_py_delta_interval_seconds", max_pass_setting="code_scip_py_delta_timeout_seconds", max_pass_headroom=_TIER_HEADROOM_S, + # fetch and forced checkout + max_pass_fetch_budgets=2, ), _Worker( "code_scip_go_delta", @@ -429,6 +463,8 @@ def _spec_for(row: _Worker) -> WorkerSpec: "code_scip_go_delta_interval_seconds", max_pass_setting="code_scip_go_delta_timeout_seconds", max_pass_headroom=_TIER_HEADROOM_S, + # fetch and forced checkout + max_pass_fetch_budgets=2, ), # The C++ tier's full re-index (seeds and heals scip_commit) and the # SQL <-> C++ crossref. diff --git a/server/workers/supervisor.py b/server/workers/supervisor.py index eceb691ce2b..e809743fabf 100644 --- a/server/workers/supervisor.py +++ b/server/workers/supervisor.py @@ -255,7 +255,7 @@ async def _supervise(self, spec: WorkerSpec) -> None: # scoped to the worker: every llm.*/embed.* span the pass creates # carries loom.operation=worker. (per-repo code adds org/ns). set_worker_identity(spec.name) - deadline = spec.deadline_seconds() + deadline = spec.deadline_seconds() # refreshed at each pass's admission stagger, state = await _begin_loop(spec) if stagger > 0: try: @@ -290,6 +290,12 @@ async def _supervise(self, spec: WorkerSpec) -> None: # normally; changing models never cancels it mid-write. started = time.monotonic() in_pass = True + # The deadline is read here, from the live settings: a + # runtime update reaches the next pass, not this one. The + # git timeout it is priced at is the one the pass's checkout + # steps run under (`pass_context.git_fetch_timeout_s`). + ctx.git_fetch_timeout_s = float(settings.code_git_fetch_timeout_s) + deadline = spec.deadline_seconds(ctx.git_fetch_timeout_s) async with asyncio.timeout(deadline): await spec.pass_callable() in_pass = False diff --git a/tests/unit/snapshots/worker_registry.json b/tests/unit/snapshots/worker_registry.json index 7c43d015523..4d8e0fb3a98 100644 --- a/tests/unit/snapshots/worker_registry.json +++ b/tests/unit/snapshots/worker_registry.json @@ -4,6 +4,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 30, "interval_seconds": 5, @@ -18,6 +19,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -34,6 +36,7 @@ "first_pass_due": { "id": "server.insights.workers.adoption_telemetry:first_pass_due" }, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 300, @@ -48,6 +51,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 604800, @@ -62,6 +66,7 @@ "deadline_seconds()": 3600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -76,6 +81,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -90,6 +96,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -104,6 +111,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -118,6 +126,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -132,6 +141,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 15, "interval_seconds": 0, @@ -146,6 +156,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -160,6 +171,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -174,6 +186,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 10, "interval_seconds": 2, @@ -188,6 +201,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 10, "interval_seconds": 2, @@ -202,6 +216,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -216,6 +231,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -230,6 +246,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600.0, @@ -244,6 +261,7 @@ "deadline_seconds()": 600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 10.0, @@ -258,6 +276,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 600, @@ -272,6 +291,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 86400, @@ -286,6 +306,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 1800, @@ -300,6 +321,7 @@ "deadline_seconds()": 120.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -316,6 +338,7 @@ "first_pass_due": { "id": "server.knowledge.workers.knowledge_gaps:first_pass_due" }, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 86400, @@ -330,6 +353,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 21600, @@ -344,6 +368,7 @@ "deadline_seconds()": 600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 600, "interval_seconds": 120, @@ -358,6 +383,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -372,6 +398,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 300, "interval_seconds": 60, @@ -386,6 +413,7 @@ "deadline_seconds()": 600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -400,6 +428,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -414,6 +443,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 300, "interval_seconds": 60, @@ -428,6 +458,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -442,6 +473,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 15, @@ -456,6 +488,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 120, @@ -470,6 +503,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -481,9 +515,10 @@ } }, { - "deadline_seconds()": 5400.0, + "deadline_seconds()": 48600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 12, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -495,9 +530,10 @@ } }, { - "deadline_seconds()": 5400.0, + "deadline_seconds()": 12600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 2, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 600, @@ -509,9 +545,10 @@ } }, { - "deadline_seconds()": 5400.0, + "deadline_seconds()": 12600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 2, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 600, @@ -523,9 +560,10 @@ } }, { - "deadline_seconds()": 9000.0, + "deadline_seconds()": 16200.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 2, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 900, @@ -540,6 +578,7 @@ "deadline_seconds()": 50400.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 900, @@ -554,6 +593,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 1800, @@ -568,6 +608,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 900, @@ -582,6 +623,7 @@ "deadline_seconds()": 600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 1800, "interval_seconds": 900, @@ -596,6 +638,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 1800, "interval_seconds": 900, @@ -610,6 +653,7 @@ "deadline_seconds()": 120.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -624,6 +668,7 @@ "deadline_seconds()": 120.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 120, "interval_seconds": 30, @@ -638,6 +683,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 21600, @@ -654,6 +700,7 @@ "first_pass_due": { "id": "server.code.workers.graph_stats:first_pass_due" }, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 604800, @@ -670,6 +717,7 @@ "id": "server.tracker.workers.test_daily:due_scope" }, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 1800, @@ -687,6 +735,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 604800, @@ -701,6 +750,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 300, "interval_seconds": 60, @@ -715,6 +765,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -729,6 +780,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -743,6 +795,7 @@ "deadline_seconds()": 120.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 30, "interval_seconds": 5, @@ -757,6 +810,7 @@ "deadline_seconds()": 120.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 30, "interval_seconds": 5, @@ -773,6 +827,7 @@ "id": "server.tracker.workers.links:due_scope" }, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 86400.0, @@ -791,6 +846,7 @@ "id": "server.tracker.workers.embed:due_scope" }, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 1800.0, @@ -807,6 +863,7 @@ "deadline_seconds()": 3600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 86400.0, @@ -821,6 +878,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 120, "interval_seconds": 60, @@ -835,6 +893,7 @@ "deadline_seconds()": 7200.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 86400.0, @@ -851,6 +910,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 30, "interval_seconds": 5, @@ -865,6 +925,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -881,6 +942,7 @@ "first_pass_due": { "id": "server.insights.workers.adoption_telemetry:first_pass_due" }, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 300, @@ -895,6 +957,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 604800, @@ -909,6 +972,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -923,6 +987,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -937,6 +1002,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -951,6 +1017,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -965,6 +1032,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 15, "interval_seconds": 0, @@ -979,6 +1047,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -993,6 +1062,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1007,6 +1077,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 10, "interval_seconds": 2, @@ -1021,6 +1092,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 10, "interval_seconds": 2, @@ -1035,6 +1107,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1049,6 +1122,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600.0, @@ -1063,6 +1137,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 600, @@ -1077,6 +1152,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 86400, @@ -1091,6 +1167,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 1800, @@ -1105,6 +1182,7 @@ "deadline_seconds()": 600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 600, "interval_seconds": 120, @@ -1119,6 +1197,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 300, "interval_seconds": 60, @@ -1133,6 +1212,7 @@ "deadline_seconds()": 600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -1147,6 +1227,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1161,6 +1242,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 300, "interval_seconds": 60, @@ -1175,6 +1257,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 15, @@ -1189,6 +1272,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 120, @@ -1200,9 +1284,10 @@ } }, { - "deadline_seconds()": 5400.0, + "deadline_seconds()": 48600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 12, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1214,9 +1299,10 @@ } }, { - "deadline_seconds()": 5400.0, + "deadline_seconds()": 12600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 2, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 600, @@ -1228,9 +1314,10 @@ } }, { - "deadline_seconds()": 5400.0, + "deadline_seconds()": 12600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 2, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 600, @@ -1242,9 +1329,10 @@ } }, { - "deadline_seconds()": 9000.0, + "deadline_seconds()": 16200.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 2, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 900, @@ -1259,6 +1347,7 @@ "deadline_seconds()": 50400.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 900, @@ -1273,6 +1362,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 1800, @@ -1287,6 +1377,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 1800, "interval_seconds": 900, @@ -1303,6 +1394,7 @@ "id": "server.tracker.workers.test_daily:due_scope" }, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 1800, @@ -1320,6 +1412,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 300, "interval_seconds": 60, @@ -1334,6 +1427,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1348,6 +1442,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -1362,6 +1457,7 @@ "deadline_seconds()": 120.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 30, "interval_seconds": 5, @@ -1376,6 +1472,7 @@ "deadline_seconds()": 120.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 30, "interval_seconds": 5, @@ -1392,6 +1489,7 @@ "id": "server.tracker.workers.links:due_scope" }, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 86400.0, @@ -1410,6 +1508,7 @@ "id": "server.tracker.workers.embed:due_scope" }, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 1800.0, @@ -1426,6 +1525,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 120, "interval_seconds": 60, @@ -1442,6 +1542,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 30, "interval_seconds": 5, @@ -1456,6 +1557,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -1472,6 +1574,7 @@ "first_pass_due": { "id": "server.insights.workers.adoption_telemetry:first_pass_due" }, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1486,6 +1589,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 604800, @@ -1500,6 +1604,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -1514,6 +1619,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -1528,6 +1634,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1542,6 +1649,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -1556,6 +1664,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 15, "interval_seconds": 0, @@ -1570,6 +1679,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -1584,6 +1694,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1598,6 +1709,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 10, "interval_seconds": 2, @@ -1612,6 +1724,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 10, "interval_seconds": 2, @@ -1626,6 +1739,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1640,6 +1754,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600.0, @@ -1654,6 +1769,7 @@ "deadline_seconds()": 600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 10.0, @@ -1668,6 +1784,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 600, @@ -1682,6 +1799,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 86400, @@ -1696,6 +1814,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 1800, @@ -1710,6 +1829,7 @@ "deadline_seconds()": 600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 600, "interval_seconds": 120, @@ -1724,6 +1844,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 3600, @@ -1738,6 +1859,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 300, "interval_seconds": 60, @@ -1752,6 +1874,7 @@ "deadline_seconds()": 600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -1766,6 +1889,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1780,6 +1904,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 300, "interval_seconds": 60, @@ -1794,6 +1919,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1808,6 +1934,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 15, @@ -1822,6 +1949,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 120, @@ -1836,6 +1964,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -1847,9 +1976,10 @@ } }, { - "deadline_seconds()": 5400.0, + "deadline_seconds()": 48600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 12, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -1861,9 +1991,10 @@ } }, { - "deadline_seconds()": 5400.0, + "deadline_seconds()": 12600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 2, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 600, @@ -1875,9 +2006,10 @@ } }, { - "deadline_seconds()": 5400.0, + "deadline_seconds()": 12600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 2, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 600, @@ -1889,9 +2021,10 @@ } }, { - "deadline_seconds()": 9000.0, + "deadline_seconds()": 16200.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 2, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 900, @@ -1906,6 +2039,7 @@ "deadline_seconds()": 50400.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 900, @@ -1920,6 +2054,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 1800, @@ -1934,6 +2069,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 900, @@ -1948,6 +2084,7 @@ "deadline_seconds()": 60.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 1800, "interval_seconds": 900, @@ -1962,6 +2099,7 @@ "deadline_seconds()": 120.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 120, "interval_seconds": 30, @@ -1976,6 +2114,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 21600, @@ -1992,6 +2131,7 @@ "first_pass_due": { "id": "server.code.workers.graph_stats:first_pass_due" }, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 604800, @@ -2008,6 +2148,7 @@ "id": "server.tracker.workers.test_daily:due_scope" }, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 1800, @@ -2025,6 +2166,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 300, "interval_seconds": 60, @@ -2039,6 +2181,7 @@ "deadline_seconds()": 900.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 300, @@ -2053,6 +2196,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 60, @@ -2067,6 +2211,7 @@ "deadline_seconds()": 120.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 30, "interval_seconds": 5, @@ -2081,6 +2226,7 @@ "deadline_seconds()": 120.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 30, "interval_seconds": 5, @@ -2097,6 +2243,7 @@ "id": "server.tracker.workers.links:due_scope" }, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 86400.0, @@ -2115,6 +2262,7 @@ "id": "server.tracker.workers.embed:due_scope" }, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": true, "idle_interval_seconds": null, "interval_seconds": 1800.0, @@ -2131,6 +2279,7 @@ "deadline_seconds()": 3600.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": null, "interval_seconds": 86400.0, @@ -2145,6 +2294,7 @@ "deadline_seconds()": 240.0, "due_scope": null, "first_pass_due": null, + "git_fetch_budgets": 0, "has_first_pass_hook": false, "idle_interval_seconds": 120, "interval_seconds": 60, diff --git a/tests/unit/test_code_compiler_tier_runner.py b/tests/unit/test_code_compiler_tier_runner.py index 489b75da55a..8438a1998d7 100644 --- a/tests/unit/test_code_compiler_tier_runner.py +++ b/tests/unit/test_code_compiler_tier_runner.py @@ -168,7 +168,9 @@ async def test_a_refused_delta_holds_the_tier_without_running_it( async def no_git(*_: Any, **__: Any) -> None: raise AssertionError("a held tier moved its checkout") - monkeypatch.setattr(w, "git", no_git) + # scip_delta moves its checkout through `scip_full.move_checkout`, which calls the helper + monkeypatch.setattr(compiler_tier, "git", no_git) + monkeypatch.setattr(w, "git", no_git, raising=False) from server.code.app.index.delta_file import delta_caps shape = { diff --git a/tests/unit/test_code_scip_delta_worker.py b/tests/unit/test_code_scip_delta_worker.py index 40134b5552f..7759c03c0fb 100644 --- a/tests/unit/test_code_scip_delta_worker.py +++ b/tests/unit/test_code_scip_delta_worker.py @@ -80,7 +80,7 @@ async def test_fetch_does_not_recurse_submodules(monkeypatch, tmp_path): since rewritten away fatals the whole fetch (contrib/sql-console stalled the compiler tier for 5 days this way). Only `submodule update` needs pins, and only the ones at git_head.""" - from server.code.workers import scip_delta as w + from server.code.app.index import compiler_tier from server.settings import settings checkout = tmp_path / "checkout" @@ -92,6 +92,7 @@ async def test_fetch_does_not_recurse_submodules(monkeypatch, tmp_path): monkeypatch.setattr(settings, "code_scip_checkout_dir", str(checkout)) monkeypatch.setattr(settings, "code_git_dir", str(bare)) monkeypatch.setattr(settings, "code_scip_clang_path", str(clang)) + monkeypatch.setattr(settings, "code_git_fetch_timeout_s", 7777.0) git_calls: list[tuple[str, ...]] = [] git_kwargs: list[dict[str, Any]] = [] @@ -100,8 +101,8 @@ async def fake_git(cwd, *args, **kw): git_calls.append(args) git_kwargs.append(kw) - monkeypatch.setattr(w, "git", fake_git) - monkeypatch.setattr("server.code.app.index.compiler_tier.git", fake_git) + # the checkout move is `scip_full.move_checkout`, which calls the tier helper + monkeypatch.setattr(compiler_tier, "git", fake_git) from server.code.app.index.sandbox import JobResult @@ -128,6 +129,8 @@ async def fake_git(cwd, *args, **kw): assert fetches, "the delta path never fetched" assert "--recurse-submodules=no" in fetches[0] assert "token" not in git_kwargs[git_calls.index(fetches[0])] + # the fetch of a large checkout gets the configured budget, not the helper default + assert git_kwargs[git_calls.index(fetches[0])]["timeout_s"] == 7777.0 # each submodule's URL is synced from the target's .gitmodules, locally, before the # update fetches its pins: one moved to another remote is fetched from the new one subs = [(c, git_kwargs[i]) for i, c in enumerate(git_calls) if c[0] == "submodule"] @@ -142,6 +145,10 @@ async def fake_git(cwd, *args, **kw): sub = subs[-1][1] assert sub["token"] == "ghs_test" and sub["remote"] == "https://github.com/o/private" assert sub["proxy_identity"] == "acme.widgets-indexer" + # the forced checkout and the submodule update get the fetch budget too + checkout_i = next(i for i, c in enumerate(git_calls) if c[0] == "checkout") + assert git_kwargs[checkout_i]["timeout_s"] == 7777.0 + assert sub["timeout_s"] == 7777.0 @pytest.mark.asyncio @@ -161,8 +168,9 @@ async def test_a_hold_records_the_translation_unit_cap_its_harness_ran_under(mon monkeypatch.setattr(settings, "code_scip_clang_path", str(tmp_path / "scip-clang")) monkeypatch.setattr(settings, "code_scip_delta_max_nodes", 10) monkeypatch.setattr(settings, "code_scip_delta_max_tus", 200) - monkeypatch.setattr(w, "git", AsyncMock()) - monkeypatch.setattr("server.code.app.index.compiler_tier.git", AsyncMock()) + from server.code.app.index import compiler_tier + + monkeypatch.setattr(compiler_tier, "git", AsyncMock()) runs: list[str] = [] files = [{"path": f"src/f{i}.cpp", "symbols": [], "edges": []} for i in range(5)] diff --git a/tests/unit/test_code_scip_go_delta_worker.py b/tests/unit/test_code_scip_go_delta_worker.py index 8035e06d9cb..21cd8892df7 100644 --- a/tests/unit/test_code_scip_go_delta_worker.py +++ b/tests/unit/test_code_scip_go_delta_worker.py @@ -117,10 +117,13 @@ async def test_missing_toolchain_skips_with_the_reason(monkeypatch, tmp_path: Pa @pytest.mark.asyncio async def test_first_run_is_full_over_every_module_and_applies_each_delta(monkeypatch, tmp_path): checkout, bare = _host(monkeypatch, tmp_path) + monkeypatch.setattr(w.settings, "code_git_fetch_timeout_s", 7777.0) git_calls: list[tuple[str, ...]] = [] + git_kwargs: list[dict[str, Any]] = [] async def fake_git(cwd, *args, **kw): git_calls.append(args) + git_kwargs.append(kw) harness_calls: list[tuple[str, str, list[str]]] = [] @@ -167,6 +170,9 @@ async def fake_apply(repo, org, ns, delta): assert harness_calls == [("--full", "b" * 40, [])] # no watermark: every module assert git_calls[0][:2] == ("fetch", "--recurse-submodules=no") and str(bare) in git_calls[0] assert git_calls[1] == ("checkout", "--force", "b" * 40) + # the fetch and the forced checkout get the configured budget, not the helper default + assert git_kwargs[0]["timeout_s"] == 7777.0 + assert git_kwargs[1]["timeout_s"] == 7777.0 assert sorted(applied) == ["lib/a.go", "svc/a.go"] assert res.modules_skipped == ["code-go: experiments/broken: go mod download failed: x"] repo.set_state.assert_any_await("org", "code-go", "scip_commit_go", "b" * 40) @@ -347,7 +353,9 @@ def test_registry_gives_the_go_worker_its_own_deadline(monkeypatch): monkeypatch.setattr(settings, "code_scip_delta_enabled", False, raising=False) monkeypatch.setattr(settings, "code_scip_ts_delta_enabled", False, raising=False) spec = next(w for w in registry.enabled_workers() if w.name == "code_scip_go_delta") - assert spec.deadline_seconds() == 7200.0 + registry._TIER_HEADROOM_S + # the fetch and the forced checkout each run under `code_git_fetch_timeout_s` + fetch_s = float(settings.code_git_fetch_timeout_s) + assert spec.deadline_seconds() == 7200.0 + registry._TIER_HEADROOM_S + 2 * fetch_s assert spec.interval_seconds == settings.code_scip_go_delta_interval_seconds diff --git a/tests/unit/test_code_scip_harness_group_kill.py b/tests/unit/test_code_scip_harness_group_kill.py index cac9a7e2013..64fd22961e5 100644 --- a/tests/unit/test_code_scip_harness_group_kill.py +++ b/tests/unit/test_code_scip_harness_group_kill.py @@ -46,10 +46,10 @@ def _cpp(tmp: Path, monkeypatch: pytest.MonkeyPatch) -> Callable[[], Awaitable[A clang.write_text("") monkeypatch.setattr(code_scip_delta.settings, "code_scip_clang_path", str(clang)) - async def _no_git(*_a: Any, **_k: Any) -> None: + async def _no_checkout(*_a: Any, **_k: Any) -> None: return None - monkeypatch.setattr(code_scip_delta, "git", _no_git) + monkeypatch.setattr(code_scip_delta, "move_checkout", _no_checkout) cfg = repo_config(org="o", namespace="ns", scip_checkout_dir=str(tmp), git_dir=str(tmp)) repo: Any = _Repo() return lambda: code_scip_delta._run_repo(repo, cfg, code_scip_delta.CodeScipDeltaResult()) diff --git a/tests/unit/test_code_scip_py_delta_worker.py b/tests/unit/test_code_scip_py_delta_worker.py index 533a6e90276..24bd79e6a4a 100644 --- a/tests/unit/test_code_scip_py_delta_worker.py +++ b/tests/unit/test_code_scip_py_delta_worker.py @@ -92,10 +92,13 @@ async def test_first_run_is_full_and_the_delta_is_applied(monkeypatch, tmp_path: monkeypatch.setattr(w.settings, "code_scip_checkout_dir", str(checkout)) monkeypatch.setattr(w.settings, "code_git_dir", str(bare)) monkeypatch.setattr(w.settings, "code_scip_python_path", sys.executable) + monkeypatch.setattr(w.settings, "code_git_fetch_timeout_s", 7777.0) git_calls: list[tuple[str, ...]] = [] + git_kwargs: list[dict[str, Any]] = [] async def fake_git(cwd, *args, **kw): git_calls.append(args) + git_kwargs.append(kw) harness_calls: list[tuple[str, str]] = [] @@ -136,6 +139,9 @@ async def fake_apply(repo, org, ns, delta): assert harness_calls == [("--full", "b" * 40)] assert git_calls[0][:2] == ("fetch", "--recurse-submodules=no") and str(bare) in git_calls[0] assert git_calls[1] == ("checkout", "--force", "b" * 40) + # the fetch and the forced checkout get the configured budget, not the helper default + assert git_kwargs[0]["timeout_s"] == 7777.0 + assert git_kwargs[1]["timeout_s"] == 7777.0 assert applied == ["b" * 40] repo.set_state.assert_awaited_with("org", "code-py", "scip_commit_py", "b" * 40) diff --git a/tests/unit/test_code_scip_ts_delta_worker.py b/tests/unit/test_code_scip_ts_delta_worker.py index 575159541f3..0a6e9cc294a 100644 --- a/tests/unit/test_code_scip_ts_delta_worker.py +++ b/tests/unit/test_code_scip_ts_delta_worker.py @@ -117,10 +117,13 @@ async def test_first_run_is_full_and_the_delta_is_applied( bare.mkdir() monkeypatch.setattr(w.settings, "code_scip_checkout_dir", str(checkout)) monkeypatch.setattr(w.settings, "code_git_dir", str(bare)) + monkeypatch.setattr(w.settings, "code_git_fetch_timeout_s", 7777.0) git_calls: list[tuple[str, ...]] = [] + git_kwargs: list[dict[str, Any]] = [] async def fake_git(cwd, *args, **kw): git_calls.append(args) + git_kwargs.append(kw) harness_calls: list[tuple[str, str]] = [] @@ -161,6 +164,9 @@ async def fake_apply(repo, org, ns, delta): assert harness_calls == [("--full", "b" * 40)] # no watermark: the first index is full assert git_calls[0][:2] == ("fetch", "--recurse-submodules=no") and str(bare) in git_calls[0] assert git_calls[1] == ("checkout", "--force", "b" * 40) + # the fetch and the forced checkout get the configured budget, not the helper default + assert git_kwargs[0]["timeout_s"] == 7777.0 + assert git_kwargs[1]["timeout_s"] == 7777.0 assert applied == ["b" * 40] repo.set_state.assert_awaited_with("org", "code-ts", "scip_commit_ts", "b" * 40) diff --git a/tests/unit/test_code_tier_env_passthrough.py b/tests/unit/test_code_tier_env_passthrough.py index fb098e06bad..79ca53ed7b6 100644 --- a/tests/unit/test_code_tier_env_passthrough.py +++ b/tests/unit/test_code_tier_env_passthrough.py @@ -103,7 +103,9 @@ async def _cpp_delta_env( clang = tmp_path / "scip-clang" clang.write_text("") monkeypatch.setattr(code_scip_delta.settings, "code_scip_clang_path", str(clang)) - monkeypatch.setattr(code_scip_delta, "git", AsyncMock(return_value=None)) + # the clang worker moves its checkout through `scip_full.move_checkout`, which + # calls the tier helper; the worker no longer holds `git` itself + monkeypatch.setattr(code_scip_delta, "move_checkout", AsyncMock(return_value=None)) monkeypatch.setenv("NPM_TOKEN", "t0k") monkeypatch.setenv("OTHER_TOKEN", "nope") monkeypatch.setattr(code_scip_delta.settings, "code_tier_env_passthrough", "NPM_TOKEN,PYTHON") diff --git a/tests/unit/test_code_untrusted_files.py b/tests/unit/test_code_untrusted_files.py index 34e7d88caf6..d892672f16c 100644 --- a/tests/unit/test_code_untrusted_files.py +++ b/tests/unit/test_code_untrusted_files.py @@ -327,7 +327,10 @@ def _host(monkeypatch, tmp_path: Path, worker: Any) -> None: (tmp_path / "repo.git").mkdir() monkeypatch.setattr(worker.settings, "code_scip_checkout_dir", str(tmp_path / "checkout")) monkeypatch.setattr(worker.settings, "code_git_dir", str(tmp_path / "repo.git")) - monkeypatch.setattr(worker, "git", AsyncMock()) + # The clang worker moves its checkout through the shared helper; the language + # workers still shell out to git themselves. + seam = "move_checkout" if hasattr(worker, "move_checkout") else "git" + monkeypatch.setattr(worker, seam, AsyncMock()) def _refused(res: Any, apply: AsyncMock, repo: AsyncMock) -> None: diff --git a/tests/unit/test_worker_pass_deadline.py b/tests/unit/test_worker_pass_deadline.py index caf5b50d737..edc55d821a2 100644 --- a/tests/unit/test_worker_pass_deadline.py +++ b/tests/unit/test_worker_pass_deadline.py @@ -4,6 +4,7 @@ from __future__ import annotations import asyncio +from pathlib import Path import pytest @@ -70,6 +71,160 @@ def test_registry_pins_the_two_long_pass_workers_at_900(monkeypatch: pytest.Monk assert Settings.model_fields["code_ingest_max_pass_seconds"].default == 900 +def test_a_runtime_fetch_timeout_update_moves_a_started_specs_deadline( + monkeypatch: pytest.MonkeyPatch, +) -> None: + from server.settings import settings + from server.workers import registry + + monkeypatch.setattr(settings, "code_scip_ts_delta_enabled", True) + spec = {w.name: w for w in registry.enabled_workers()}["code_scip_ts_delta"] + before = spec.deadline_seconds() + # The setting the checkout steps read on every fetch (two budgets here). + monkeypatch.setattr( + settings, "code_git_fetch_timeout_s", settings.code_git_fetch_timeout_s + 1000 + ) + assert spec.deadline_seconds() == before + 2000.0 + + +async def test_the_clang_tier_deadline_covers_every_checkout_move_attempt( + monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + """`move_checkout` runs six git commands and retries each one once, so a move + whose commands all time out consumes twelve `code_git_fetch_timeout_s` — the + registry budgeted six, and the supervisor reached the deadline in the middle of + the fourth command's retry, cancelling a move the git steps were still entitled + to finish. The commands are counted from the move itself, not restated here.""" + from server.code.app.index import compiler_tier, scip_full + from server.settings import settings + from server.workers import registry + from tests.unit.code_fixtures import repo_config + + attempts: list[float] = [] + + async def _git( + cwd: Path, *args: str, timeout_s: float = 600.0, retries: int = 0, **_: object + ) -> None: + # every attempt of every command times out: the worst case a budget covers + attempts.extend([timeout_s] * (1 + retries)) + + monkeypatch.setattr(compiler_tier, "git", _git) + monkeypatch.setattr(settings, "code_git_fetch_timeout_s", 600.0) + monkeypatch.setattr(settings, "code_scip_delta_enabled", True) + await scip_full.move_checkout( + tmp_path / "checkout", tmp_path / "bare.git", "a" * 40, repo_config() + ) + + spec = {w.name: w for w in registry.enabled_workers()}["code_scip_delta"] + # six commands, each retried once, all budgeted + assert len(attempts) == 12 + assert spec.git_fetch_budgets == len(attempts) + assert compiler_tier.checkout_move_attempts() == len(attempts) + assert spec.deadline_seconds() - float(spec.max_pass_seconds or 0.0) >= sum(attempts) + + +async def test_the_next_pass_runs_under_the_deadline_read_at_its_admission( + emitter: _Emitter, monkeypatch: pytest.MonkeyPatch +) -> None: + from server.settings import settings + + monkeypatch.setattr(settings, "code_git_fetch_timeout_s", 0.0) + calls = {"n": 0} + + async def _pass() -> None: + calls["n"] += 1 + if calls["n"] == 1: + # A runtime update after the supervisor started. + monkeypatch.setattr(settings, "code_git_fetch_timeout_s", 5.0) + await asyncio.sleep(0.2) + + s = _supervisor(2, calls) + spec = WorkerSpec( + "live_deadline", + 1.0, + _pass, + max_pass_seconds=0.05, + git_fetch_budgets=1, + ) + genai.set_identity() + await asyncio.wait_for(s._supervise(spec), timeout=5) + assert calls["n"] == 2 + # The first pass ran under 0.05 s and timed out; the second, admitted + # after the update, finished within the raised deadline. + assert [e.success for e in emitter.events] == [False] + genai.set_identity() + + +async def test_a_checkout_move_keeps_the_timeout_its_pass_was_admitted_with( + emitter: _Emitter, monkeypatch: pytest.MonkeyPatch, tmp_path: Path +) -> None: + """The deadline is fixed from `code_git_fetch_timeout_s` at admission; an + operator raising it during the checkout must not reach the steps still to run, or + the move outlives the deadline it was admitted under (a 0.28 s pass whose + submodule update was then given a 1 s timeout).""" + from server.code.app.index import compiler_tier, scip_full + from server.settings import settings + from tests.unit.code_fixtures import repo_config + + seen: list[float] = [] + + async def _git( + cwd: Path, *args: str, timeout_s: float = 600.0, retries: int = 0, **_: object + ) -> None: + seen.append(timeout_s) + if len(seen) == 2: + # and again between the lead steps and the submodules + monkeypatch.setattr(settings, "code_git_fetch_timeout_s", 1.0) + + monkeypatch.setattr(compiler_tier, "git", _git) + monkeypatch.setattr(settings, "code_git_fetch_timeout_s", 0.05) + calls = {"n": 0} + + async def _pass() -> None: + calls["n"] += 1 + monkeypatch.setattr(settings, "code_git_fetch_timeout_s", 0.5) # after admission + await scip_full.move_checkout( + tmp_path / "checkout", tmp_path / "bare.git", "a" * 40, repo_config() + ) + + spec = WorkerSpec( + "checkout_probe", + 1.0, + _pass, + max_pass_seconds=0.05, + git_fetch_budgets=compiler_tier.checkout_move_attempts(), + ) + s = _supervisor(1, calls) + genai.set_identity() + await asyncio.wait_for(s._supervise(spec), timeout=5) + assert seen == [0.05] * 6 + genai.set_identity() + + +async def test_the_fetch_timeout_is_the_admitted_one_inside_a_pass_and_live_outside( + emitter: _Emitter, monkeypatch: pytest.MonkeyPatch +) -> None: + from server.code.app.index.compiler_tier import fetch_timeout_s + from server.settings import settings + + monkeypatch.setattr(settings, "code_git_fetch_timeout_s", 7.0) + assert fetch_timeout_s() == 7.0 + seen: list[float] = [] + calls = {"n": 0} + + async def _pass() -> None: + calls["n"] += 1 + monkeypatch.setattr(settings, "code_git_fetch_timeout_s", 9.0) + seen.append(fetch_timeout_s()) + + spec = WorkerSpec("fetch_probe", 1.0, _pass, max_pass_seconds=5.0, git_fetch_budgets=1) + genai.set_identity() + await asyncio.wait_for(_supervisor(1, calls)._supervise(spec), timeout=5) + assert seen == [7.0] + assert fetch_timeout_s() == 9.0 + genai.set_identity() + + async def test_a_pass_past_its_deadline_is_a_counted_failure(emitter: _Emitter) -> None: calls = {"n": 0} diff --git a/tests/unit/test_worker_registry_rows.py b/tests/unit/test_worker_registry_rows.py index 9a88aa7f420..6febcff15a1 100644 --- a/tests/unit/test_worker_registry_rows.py +++ b/tests/unit/test_worker_registry_rows.py @@ -141,6 +141,39 @@ def test_a_workers_spec_takes_its_pass_deadline_from_its_setting( assert registry._spec_for(row).max_pass_seconds == 42.0 +# The clang tier's budget is `None` here because it is not a number in the row: it +# is the checkout move's attempt count, derived from the step list the move runs +# (`compiler_tier.checkout_move_attempts`). The other three run the fetch and the +# forced checkout, no retry, so their two commands are two attempts. +@pytest.mark.parametrize( + ("name", "harness_setting", "attempts"), + [ + ("code_scip_delta", "code_scip_delta_timeout_seconds", None), + ("code_scip_ts_delta", "code_scip_ts_delta_timeout_seconds", 2), + ("code_scip_py_delta", "code_scip_py_delta_timeout_seconds", 2), + ("code_scip_go_delta", "code_scip_go_delta_timeout_seconds", 2), + ], +) +def test_a_compiler_tiers_pass_deadline_covers_its_checkout_move( + name: str, harness_setting: str, attempts: int | None, monkeypatch: pytest.MonkeyPatch +) -> None: + """The checkout steps run under `code_git_fetch_timeout_s`; the pass outlives + the harness timeout by the headroom plus every attempt's budget, so a slow first + fetch is not cut by the supervisor before the harness runs. Every attempt of the + move is budgeted: a row that counts commands rather than attempts (six for a + twelve-attempt move) leaves the last commands outside the deadline.""" + from server.code.app.index import compiler_tier + from server.settings import settings + + if attempts is None: + attempts = compiler_tier.checkout_move_attempts() + monkeypatch.setattr(settings, harness_setting, 3500.0) + monkeypatch.setattr(settings, "code_git_fetch_timeout_s", 3600.0) + spec = registry._spec_for(_row(name)) + assert spec.git_fetch_budgets == attempts + assert spec.deadline_seconds() == 3500.0 + registry._TIER_HEADROOM_S + attempts * 3600.0 + + def test_the_extraction_queue_keeps_four_intervals_while_its_deadline_is_unset( monkeypatch: pytest.MonkeyPatch, ) -> None: