Skip to content

fix(ci): an OSV lookup error of uv stops a gate command #4881

Closed

Description

@dan-petty

Problem or Motivation

A short DNS failure of api.osv.dev stops a gate command. pyproject.toml turns on uv's malware-check preview feature, and the devcontainer sets UV_MALWARE_CHECK=1. Twice on 2026-11-11/12 in the devcontainer, uv stopped with:

error: Malware check failed due to an error from OSV
  cause: Request failed after 3 retries
  cause: failed to lookup address information: Try again
  • uv run devops ci test <files> stopped before pytest started.
  • The pre-commit hook ast-grep scan (it starts uv run) failed, so git commit failed.

The same command passed again a minute later, and getent hosts api.osv.dev resolved. The host was under high load (load average about 55 on 16 CPUs).

Proposed Solution & Architectural Design

  • Find in the uv documentation and source how the malware check treats a lookup error, and whether a setting makes uv retry longer or report the error as a warning for a command that installs nothing new.
  • If uv has such a setting, set it in [tool.uv]. If not, keep the check in the rows that install packages and report the limit upstream.

Acceptance: a test or a recorded run shows that a DNS error of OSV during uv run of an already-synced environment does not stop the gate row, or the item records the upstream issue.

Target Subsystem

CI gate (devops ci) and the pre-commit hooks.

Existing Tool Considered

uv's own malware check (preview). No new tool. Cost: about 10,000 tokens and 1 hour to check and set.

Dependencies

None.

Alternatives check of 2026-11-14: in-use.
The repository already uses this tool.
Tool: astral-sh/uv (https://github.com/astral-sh/uv), Apache-2.0, last activity 2026-11-14, maintained.

Proposed design

Problem statement

A short DNS failure of api.osv.dev stops uv run before a gate command starts. uv has no setting that turns the malware-check lookup error into a warning or lengthens the retry. The change sets UV_MALWARE_CHECK=0 in the check-only gate rows, the pre-commit hooks and the interactive shells, and keeps it at 1 in the steps that install packages, so the check still runs where a package can arrive.

Acceptance criteria

Requirement: Pre-commit check hooks disable the malware check

Each pre-commit hook that starts uv run and installs no package SHALL set UV_MALWARE_CHECK to 0 in its hook env.

Scenario: Check hook environment

  • WHEN the test reads the env of the ast-grep-scan, ast-grep-test, openspec-gate, devops-ci-pre-push and devops-ci-workflows-pre-push hooks in .pre-commit-config.yaml
  • THEN each hook's env maps UV_MALWARE_CHECK to 0.

Requirement: Gate check rows disable the malware check

Each devops ci row that installs no package SHALL run its command with UV_MALWARE_CHECK set to 0.

Scenario: Gate row environment

  • WHEN the test plans devops ci --check --only lint and reads the environment of each planned request
  • THEN each request's environment maps UV_MALWARE_CHECK to 0.

Requirement: Interactive shells disable the malware check

Every interactive shell configuration of this repository SHALL set UV_MALWARE_CHECK to 0.

Scenario: Devcontainer and agent shell environment

  • WHEN the test reads containerEnv of .devcontainer/image/devcontainer.json, the env of .claude/settings.json, the rendered devcontainer.json.j2 and claude_settings.json.j2, and the UV_MALWARE_CHECK example in docs/DEVCONTAINER_USAGE.md
  • THEN each sets UV_MALWARE_CHECK to 0.

Requirement: Install steps keep the malware check on

Each step that installs packages SHALL set UV_MALWARE_CHECK to 1.

Scenario: CI sync and post-create install

  • WHEN the test reads the Synchronize dependencies step of .github/actions/setup-toolchain/action.yml, the postCreateCommand of .devcontainer/devcontainer.json, and the rendered postCreateCommand of devcontainer.json.j2
  • THEN each sets UV_MALWARE_CHECK to 1.

Requirement: A failed OSV lookup does not stop a gate row

A gate row SHALL exit 0 when the OSV lookup fails and the environment is already synced.

Scenario: OSV lookup failure

  • WHEN a stub uv that prints the OSV lookup error and exits 2 unless UV_MALWARE_CHECK is 0 runs the ast-grep-scan hook entry
  • THEN the hook entry exits 0.

Requirement: The uv limit is recorded

pyproject.toml SHALL record beside [tool.uv] that uv has no setting to downgrade an OSV lookup error to a warning or to lengthen the retry.

Scenario: Recorded limit

  • WHEN the test reads the [tool.uv] section of pyproject.toml
  • THEN a comment names the missing setting and the reason for the switch, and preview-features still holds malware-check.

Requirement: The knowledge base records the split

The uv knowledge base SHALL state that install steps set UV_MALWARE_CHECK=1 and interactive shells set 0.

Scenario: Knowledge base guidance

  • WHEN the test reads src/devops_cli/ai/knowledge_base/it_domains/tools/uv.md and src/devops_cli/ai/knowledge_base/it_domains/topics/modern_python_runtime_and_ecosystem.md
  • THEN both name the split between install steps and interactive shells.

Existing Tool Considered

uv (astral-sh/uv, Apache-2.0, maintained, already in use). It runs the OSV malware check and exposes the [tool.uv] / UV_MALWARE_CHECK switch. It lacks a documented setting that turns an OSV lookup error into a warning, and it lacks a way to lengthen the retry window; an already-synced uv run still aborts before the command starts. No other tool covers the need. The issue estimates about 10,000 tokens and 1 hour to check and set.

Key questions

  • Where does the OSV lookup error stop the command?: It stops the environment sync that uv run performs before it starts the command. The repository injects --preview-features malware-check into every uv command, so the pre-commit hook and the gate rows start uv with the check on, and the error appears before devops or pytest starts. The uv README (fetched 2026-11-15) confirms that uv run runs a command in the project environment. [sources: src/devops_cli/core/process.py:728, .pre-commit-config.yaml:70, src/devops_cli/commands/ci.py:245, pyproject.toml:327, .devcontainer/image/devcontainer.json:45, https://github.com/astral-sh/uv]
  • Does UV_MALWARE_CHECK=0 disable the check while the preview feature stays on?: Yes. The repository already uses UV_MALWARE_CHECK as the switch: the devcontainer and agent settings set it to 1, and the subprocess environment passes it through to the child. The preview feature stays listed in [tool.uv], so a value of 0 turns the check off for that command without removing the feature. [sources: .devcontainer/image/devcontainer.json:45, .claude/settings.json:14, src/devops_cli/commands/install_tools.py:255, openspec/specs/subprocess-environment/spec.md:314, pyproject.toml:327]
  • How do the gate rows stop failing on a short OSV DNS failure when uv has no warning or retry setting?: Set UV_MALWARE_CHECK=0 in the check-only gate rows, the pre-commit hooks and the interactive shells, and set it to 1 in every step that installs packages. (best practice) [sources: .pre-commit-config.yaml:70, src/devops_cli/core/process.py:728, .devcontainer/image/devcontainer.json:45, .github/actions/setup-toolchain/action.yml:69, src/devops_cli/ai/knowledge_base/it_domains/tools/uv.md:82, https://github.com/astral-sh/uv]
    • Chosen: Switch the check off in the check-only rows, hooks and shells. The failure happens in the uv run that starts the command, so a row-only environment cannot help; installs keep the check explicitly.
    • Rejected: Set the variable only in the devops ci row environment. The reported failures happen in the outer uv run before devops starts, so the row environment is never read.
    • Rejected: Wait for an upstream warning or retry setting. The gate stays broken until uv ships the setting, and no such setting is documented.
    • Rejected: Retry the whole command after a failure. The error comes before the command starts, so each retry pays the retry delay again and hides the cause.
    • Rejected: Run the gate commands with uv run --no-sync. It skips every sync, so a stale environment runs with missing packages; the switch keeps the sync.
  • Which steps keep the malware check on?: The steps that install packages: the uv sync step of .github/actions/setup-toolchain/action.yml, the postCreateCommand that runs uv tool install pre-commit through devops devcontainer post-create, and the Dockerfile's uv sync. (best practice) [sources: .github/actions/setup-toolchain/action.yml:69, .devcontainer/devcontainer.json:13, src/devops_cli/commands/devcontainer.py:709, src/devops_cli/templates/devcontainer.json.j2:110, pyproject.toml:327]
    • Rejected: All steps. The check-only rows keep the hard stop that the issue reports.
    • Rejected: No steps. It loses the protection that the preview feature gives.
    • Chosen: Only the steps that install packages. The check runs where a package can arrive, and a check-only row never waits on the lookup.
  • Where does the repository record the uv limit?: In a comment beside [tool.uv] in pyproject.toml. (best practice) [sources: pyproject.toml:326, pyproject.toml:327]
    • Chosen: A comment in pyproject.toml. The setting and its reason stay in one place that the reader of the setting opens.
    • Rejected: A new docs page. One note does not need a page of its own.
    • Rejected: An ADR. The switch is a configuration choice of one command, not an architecture decision.
  • Where do the interactive shells get UV_MALWARE_CHECK=0?: In the container environment of .devcontainer/image/devcontainer.json, in .claude/settings.json, and in the matching templates devcontainer.json.j2 and claude_settings.json.j2, with the docs example updated to match. (best practice) [sources: .devcontainer/image/devcontainer.json:45, .claude/settings.json:14, src/devops_cli/templates/devcontainer.json.j2:56, src/devops_cli/templates/claude_settings.json.j2:14, docs/DEVCONTAINER_USAGE.md:100]
    • Chosen: Set it in the checked-in shell configs and their templates. The shell inherits the value, so the outer uv run that starts devops passes; the templates keep a scaffolded repository on the same setting.
    • Rejected: Set it only in .devcontainer/devcontainer.json remoteEnv. The agent shell reads .claude/settings.json, and the image metadata and the template would still set 1.
    • Rejected: Keep 1 in the shell and fix only the rows and hooks. The reported failures happen in the outer uv run before devops starts, so the shell keeps the hard stop.
  • How does the knowledge base stay consistent with the switch?: Update the two uv guidance lines to state the split: install steps set UV_MALWARE_CHECK=1, and interactive shells set 0. (best practice) [sources: src/devops_cli/ai/knowledge_base/it_domains/tools/uv.md:82, src/devops_cli/ai/knowledge_base/it_domains/topics/modern_python_runtime_and_ecosystem.md:96]
    • Chosen: Update the knowledge base lines. The current lines say to keep 1 in developer environments, which contradicts the shell setting; the split keeps the install protection and explains the shell.
    • Rejected: Leave the knowledge base lines. They would tell an agent to set 1 in the shell, undoing the fix.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/ci
    status/new
    value/medium
    effort/low
    on Nov 12, 2026
  2. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/ci. The (ci) scope of the title gives the scope.
    • Priority: P2-Medium. The failure blocks commits and CI runs but is intermittent and self-resolves within a minute.
    • Value: Medium. It blocks local commits and CI runs when the OSV endpoint is unreachable, but only for a short window.
    • Effort: Low. The body estimates about one hour to investigate uv settings and apply a config change or file an upstream issue.
    • Related: refactor(ci): github ci runs the gate through devops ci from one check table #843, which asks for a different change. Both items involve the uv malware-check feature in the CI gate, but #843 consolidates check definitions while the candidate fixes a DNS error that stops the gate.
  3. added
    priority/p2-medium
    on Nov 12, 2026
  4. devops-cli-service commented on Nov 12, 2026

    @devops-cli-service
    Contributor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Priority: P2-Medium. The error blocks the gate and git commit at random, but a retry passes and a workaround exists.
    • Value: Medium. Developers lose time when a transient OSV lookup error stops the gate and a commit, but the effect is intermittent.
    • Effort: Low. The body estimates about 1 hour and 10,000 tokens to check the uv setting and set it in pyproject.toml.
    • Related: refactor(ci): github ci runs the gate through devops ci from one check table #843, which asks for a different change. Both items touch the gate check argv that inserts the uv malware-check preview feature, but #843 changes how one check table feeds GitHub CI and this item changes how a lookup error is handled.
  5. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    One more occurrence on 2026-11-12: the pre-commit hook ast-grep scan failed with Malware check failed due to an error from OSV during git commit of an OpenSpec archive commit. The load average was about 45 on 16 CPUs. The same commit passed at the next try, about one minute later.

  6. dan-petty commented on Nov 12, 2026

    @dan-petty
    OwnerAuthor

    Seen again on 2026-11-12 in an agent worktree. Two uv run calls failed before devops started: uv run devops openspec check and uv run devops ci test <files>. Each printed error: Malware check failed due to an error from OSV, with the cause failed to lookup address information: Try again, and exited 2. A second try of each call passed some minutes later. The DNS name of the OSV API resolved during the same period.

  7. devops-cli-service commented on Nov 14, 2026

    @devops-cli-service
    Contributor

    Alternatives check: in-use

    Reason: The searches returned no other tool or documented setting that covers this: the only relevant tool is uv itself, whose preview malware check is what performs the OSV lookup and what the issue already names as in use. uv provides the check and its [tool.uv] / UV_MALWARE_CHECK switch, but no searched evidence shows a setting that downgrades a transient OSV lookup/DNS failure to a warning or extends retries for a command that installs nothing new, which is exactly the missing part.

    The repository already uses this tool.

    Tool: astral-sh/uv (https://github.com/astral-sh/uv)

    • License: Apache-2.0
    • Last activity: 2026-11-14
    • Maintained: yes

    Covers:

    • Runs the OSV malware check over resolved packages, so the project keeps the protection it wants
    • The check is switched on from project configuration ([tool.uv]) and the environment (UV_MALWARE_CHECK), so the gate rows share one setting
    • A maintained, actively released implementation of the whole uv run / sync path the gate rows use

    Lacks:

    • No documented setting to treat an OSV lookup error (DNS failure) as a warning instead of a hard error
    • No documented way to lengthen the retry window of the malware check for an already-synced environment
    • An already-synced uv run still aborts before the command starts when the OSV lookup fails, so the gate row and the pre-commit hook still fail

    Tools considered:

    Searches run:

    • astral-sh uv UV_MALWARE_CHECK preview feature documentation, results: 5
    • uv malware-check OSV lookup error fails command setting, results: 5
    • uv "Malware check failed due to an error from OSV", results: 5
    • "malware-check" uv python package manager, results: 5
    • uv python malware check osv documentation, results: 5
    • github astral-sh uv issues osv malware check dns, results: 5
    • osv.dev api malware advisory database, results: 5
    • uv tool pypi astral, results: 5
    • uv docs configuration tool.uv settings reference, results: 5
    • python package installer rust uv astral documentation, results: 5

    Sources:

    Checked on 2026-11-14. A person decides what this means for the item. The check changes no label and closes no issue.

  8. added
    status/ready
    and removed
    status/new
    on Nov 15, 2026
  9. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at ca62d6a (see proposed design in issue body).

    Moved to new items: #5899.

  10. added
    status/in-progress
    and removed
    status/ready
    on Nov 18, 2026
  11. added
    status/in-review
    and removed
    status/in-progress
    on Nov 18, 2026
  12. removed
    status/in-review
    on Nov 18, 2026
  13. devops-cli-service commented on Nov 18, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-18 14:16 UTC

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/cisource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions