Skip to content

Without the patch mirror setting, rollback, remove, repair, list and vex report "No patches in this project" for mirror-pinned requirements.txt and never name the mirror #2272

Backlog

Description

[agent] Found by the scheduled pip / requirements.txt bug-hunt routine (ledger #309).

Summary

After a hosted run with the experimental patch mirror (--patch-mirror-url / SOCKET_PATCH_MIRROR_URL) pins requirements.txt onto the mirror, every command other than scan / get run without the mirror setting says the project has no patches:

  • rollback, remove <pkg>, repair: Error: No patches in this project; nothing to <verb>. (exit 1; --json error code manifest_not_found)
  • list: No patches in this project. Run \socket-patch scan`.(exit 0,--jsonstatussuccess, discovered: 0`)
  • vex: Error: No patches in this project; nothing to attest. Run \socket-patch scan` first.` (exit 2)
  • scan --mode vendored: requirements.txt: six is not pinned to ==1.16.0; pin it exactly or use agent mode …

scan --mode hosted on the same project, also without the setting, already knows better: it skips with redirect_pin_on_unconfigured_host and warns requirements.txt already pins patch <uuid> through <host>, which this run was not given as a patch mirror or patch server … set --patch-mirror-url (SOCKET_PATCH_MIRROR_URL) to its base URL. None of the other commands says that.

Nothing is written and vex attests nothing, so this fails closed. The problem is the message.

Impact

The mirror is meant for Enterprise builds where CI sets SOCKET_PATCH_MIRROR_URL. A developer who runs socket-patch rollback or list locally without that variable is told the project has no patches, even though requirements.txt pins two patched wheels. list and list --json exit 0 with "no patches", so a script or person checking for patches concludes there are none. rollback / remove give no route to undo the pins, and the suggested Run socket-patch scan doesn't help: a plain scan leaves the pins alone by design. The fix is one setting, but only scan mentions it.

Repro

This uses the patch-API mock from ledger entry 20261029T021000Z (it grants pkg:pypi/six@1.16.0; the artifact is the real PyPI wheel with SAFE = True appended), plus a minimal mirror: an HTTP server that serves <base>/<path> by fetching <patch server>/<path>. Base M=http://127.0.0.1:8767/artifactory/api/generic/sp. pip 26.3 / CPython 3.12, main cfc870f.

printf 'six==1.16.0\n' > requirements.txt
python3.12 -m venv .venv && .venv/bin/pip install -r requirements.txt
socket-patch scan --mode hosted --yes --patch-mirror-url "$M"
#   requirements.txt: six @ $M/patch/pypi/six/1.16.0/<token>/<uuid>/six-1.16.0-py2.py3-none-any.whl#sha256=…
.venv/bin/pip install --force-reinstall -r requirements.txt   # patched six installed

socket-patch rollback --yes      # exit 1: Error: No patches in this project; nothing to roll back.
socket-patch remove six --yes    # exit 1: Error: No patches in this project; nothing to remove.
socket-patch repair --yes        # exit 1: Error: No patches in this project; nothing to repair.
socket-patch list                # exit 0: No patches in this project. Run `socket-patch scan`.
socket-patch vex --product pkg:pypi/app@1 -O v.json   # exit 2: No patches in this project; nothing to attest.
socket-patch scan --mode hosted --yes                 # exit 0 + the redirect_pin_on_unconfigured_host warning (the good message)

socket-patch rollback --yes --patch-mirror-url "$M"   # with the setting: restores six==1.16.0 (works)

Reproduced 2/2 (a one-package and a two-package project). The same silence appears when the pins sit on a --patch-server-url origin the run wasn't given (rollback and list say "No patches in this project").

Expected vs actual

  • Expected: crates/socket-patch-cli/CLI_CONTRACT.md "Patch mirror (experimental)" says that without the setting "those references are on a host the run was not given and are not hosted pins", so not acting on them is right. But the same section's rule for hosted runs ("a warning naming the file, the host and the setting") shows how the CLI should talk about such a pin. A command that finds no patch of its own, while a candidate file holds a URL in the patch server's path shape on an unconfigured host, should name the file and host and point to --patch-mirror-url / --patch-server-url instead of saying the project has no patches. rollback.rs already avoids "the misleading 'No patches in this project'" when --ecosystems filters everything out; this is the same kind of case.
  • Actual: "No patches in this project" from rollback, remove, repair, list and vex; vendored mode says "not pinned to ==X" for an exact patched pin.

Versions

socket-patch pip / Python result
main cfc870f 26.3 / 3.12 reproduces (2/2)
v5.1.0 – n/a (no patch mirror before #2180)

The detection and messages are OS-independent; the same applies to every ecosystem the mirror supports, not just requirements.txt.

Suspect code

  • crates/socket-patch-cli/src/ui/text.rs:171 (no_patches_message) and crates/socket-patch-cli/src/commands/list.rs:813 (NO_PATCHES): there's no check for unconfigured-host pins before this message.
  • The only detection is in crates/socket-patch-cli/src/commands/scan/hosted.rs:3560 (redirect_pin_on_unconfigured_host).

Generated by Claude Code

Activity

  1. added
    bug
    bughunt
    pm:pip
    on Nov 26, 2026
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

    agent:triagedbugbughuntpm:pippriority:p1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions