Repository navigation
Description
[agent] Found by the scheduled Bundler (RubyGems) bug-hunt routine (ledger #316).
Summary
socket-patch scan --mode agent run from the root of a repository that holds several Bundler projects (api/Gemfile, web/Gemfile) covers the root directory only, and says nothing about the projects below it:
- When the root has no Gemfile of its own, the run prints
No packages found. Run your package manager's install first.and exits 0, althoughbundle installhas been run in every project. - When the root has a Gemfile too, the run patches the root's gems, prints the usual success summary and exits 0. The same vulnerable gem installed in
api/andweb/stays unpatched, and no line names those directories.
scan --mode hosted and scan --mode vendored from the same directory scan api and web under == api == / == web == headings, and apply, vex, repair, remove and rollback print a Note: naming the directories below with the command that reaches each. Agent-mode scan is the one command that gives no hint.
Impact
Friction, and a missed patch that looks like success. In the first shape the remedy the message names doesn't work: the install was already run, and running it again changes nothing. The user has to guess that agent mode wants --cwd api (a PATH argument doesn't help either: scan --mode agent api answers No installed packages found under the given path: api., because agent PATHs are globs under the root's own install). In the second shape a monorepo user sees "1 of 1 targeted patch applied" and has no reason to think two more projects still run the vulnerable gem. --json carries no warning in either shape ("warnings" is absent, "scannedPackages": 0 or 1).
Repro
Any agent patch for a gem will do. I used a local mock of the patch API serving a patch for rack 2.2.8 ($MOCK stands for --api-url … --proxy-url … --patch-server-url …).
mkdir mono && cd mono && git init -q . && printf '**/vendor/bundle/\n.bundle/\n' > .gitignore
for d in api web; do
mkdir $d && (cd $d
printf 'source "https://rubygems.org"\n\ngem "rack", "2.2.8"\n' > Gemfile
printf 'require "bundler/setup"\nrequire "rack"\nputs "patched=#{($SOCKET_PATCHED||[]).inspect}"\n' > app.rb
bundle config set --local path vendor/bundle && bundle install)
done
git add -A && git commit -qm init
socket-patch scan --mode agent --yes $MOCK # shape 1
# No packages found. Run your package manager's install first. (exit 0)
socket-patch scan --mode agent --yes $MOCK api # the obvious next try
# No installed packages found under the given path: api. (exit 0)
socket-patch scan --mode hosted --dry-run $MOCK # for contrast: finds both
# == api == Found 1 package (1 ruby) … == web == Found 1 package (1 ruby) …
# shape 2: the root is a project too
printf 'source "https://rubygems.org"\n\ngem "rack", "2.2.8"\n' > Gemfile
bundle config set --local path vendor/bundle && bundle install
socket-patch scan --mode agent --yes $MOCK
# Summary: 1 of 1 targeted patch applied, 0 already patched, 0 not found on disk (exit 0)
(cd api && bundle exec ruby app.rb) # patched=[]
(cd web && bundle exec ruby app.rb) # patched=[]
socket-patch scan --mode agent --yes $MOCK --cwd api # what works: one run per projectExpected
CLI_CONTRACT.md ("What a bare scan patched at and below --cwd …") documents that an agent-mode scan "covers that project alone", so the coverage itself is by design. The same section makes every other single-project command say so: rollback names the directories it left in projects_not_rolled_back, a --json hosted scan has projects_not_scanned, and vex, apply, repair, remove print "a stderr Note: naming the directories and the command that reaches each (socket-patch vex --cwd api)". An agent-mode scan that leaves project directories below --cwd unscanned should do the same: name them and the command (socket-patch scan --mode agent --cwd api), in the human output and as a --json warning. And when it found nothing at --cwd while such directories exist, it should not tell the user to run their package manager's install.
Actual
Shape 1: No packages found. Run your package manager's install first., exit 0, no note. Shape 2: a success summary for the root, exit 0, no note; api and web keep the unpatched gem.
Versions
| Bundler | Ruby | Result |
|---|---|---|
| 4.0.18 | 3.3.6 | Reproduces (both shapes, twice) |
socket-patch main 89c482d (5.1.0). Linux only. Nothing here depends on the Bundler version or the platform: the message is chosen before any gem is looked at. I didn't check other ecosystems, but the code path is not gem-specific, so an npm or PyPI monorepo likely behaves the same way.
Suspect code
crates/socket-patch-cli/src/commands/scan/render.rs:276and:992(andcommands/get.rs:4392): theNo packages found. Run your package manager's install first.text, chosen without looking for project directories below--cwd.crates/socket-patch-cli/src/commands/projects_below.rs: the search the other commands use for theirNote:; the agent-mode scan path doesn't call it. It keeps directories "when they hold patch state", so an unpatched sub-project needs the scan's own root detection (the one a bare hosted scan uses) instead.
Generated by Claude Code
Activity
mikolalysenko commentedon Nov 18, 2026
[agent] Claiming this issue. Branch: agent/fix-agent-scan-silent-about-projects-below.
Generated by Claude Code
Test agent scan naming projects below it
Name projects an agent scan leaves below it