Skip to content

Decide: keep agent mode for every ecosystem, or limit it to Deno and --global installs #1000

Description

[agent] Filed by the scheduled architecture audit routine (CLI and core). Register: discussion #560 register.

Kind: decision. Source: review §5 ("Agent mode overall"), §6 owner question 2; register C55.

Question

v5 defaults to hosted mode. Agent mode (in-place patching of installed files: apply, repair, scan/get --mode agent) is now the largest source of open bugs per line of code. What is its scope from here on?

  • A. Keep it for every ecosystem (status quo). Keep fixing layout bugs one at a time. Optionally follow review §2.2 and ask the package manager for install layouts (npm query, pnpm list --json, pip show -f, cargo metadata, …) instead of re-implementing them.
  • B. Limit it to where nothing else works. Those places are Deno (agent is its only mode) and --global/--global-prefix installs (no project lockfile, so hosted and vendored refuse them). Inside a project that hosted or vendored supports, --mode agent warns for one minor and is then refused with a remedy that names --mode hosted|vendored. The engine stays, but per-ecosystem project-layout discovery stops growing.
  • C. Keep it everywhere, but label it. Document agent mode in a project as "fallback" for the ecosystems whose docs already say "prefer vendored / hosted" (Maven, NuGet, Cargo), and close new layout bugs there as won't-fix with the remedy.

Recommendation: B. It keeps the two cases that really need agent mode and stops the open-ended layout work. Most of today's open agent-mode bugs are project-scope layouts that hosted or vendored already cover. The default change (get --save-only → agent) is user-visible, so this is a v5.x/v6 contract decision.

Evidence (main @ 9c43dfc)

Where agent mode is the only option:

  • docs/ecosystems.md#L15-L25: every ecosystem except Deno has hosted ✅ and vendored ✅. Deno: "in place (the only mode for Deno)"; vendored refused; hosted not supported.
  • Global installs: hosted and vendored act on a project's lockfiles, vendor under global scope is a usage error (global_scope_unsupported), and apply/scan --mode agent patch the global copies (CLI_CONTRACT.md#L129). The review didn't list this case.
  • Go: agent mode is not in-place. It writes a replace to .socket/go-patches/, the same shape as vendored, so Go doesn't need it. The review's "Go local replace" case is covered by vendored. Paid hosted Go is refused with a vendored remedy.
  • Agent mode is still a default in two places: get --save-only and get --global (CLI_CONTRACT.md#L23).

Footprint (production lines, split at #[cfg(test)]):

  • CLI: commands/apply.rs 2,963 (2,237 at the review), fetch_stage.rs 437, repair.rs 785, plus the agent arms in scan, get, rollback and remove.
  • Core, agent-only: patch/rollback.rs 751, patch/sidecars/ 1,107 (708 at the review; the Maven .sha1/.md5 rewriter arrived with Full Gradle support in agent, hosted and vendored modes #646), store_copies.rs 332, shared_store.rs 332, api/blob_fetcher.rs 603, patch/diff.rs 99.
  • Core, shared with vendored: patch/apply.rs (1,230), patch/package.rs and manifest/, which vendored staging also uses. These stay under every option.

Bug load: about 29 of the 246 open bug issues are agent-mode-specific by title, roughly double the review's ~15. Almost all are project-scope install layouts that the crawlers re-implement:

Under B, the project-scope ones close with a "use --mode hosted|vendored" remedy. Under A, each needs its own fix.

What each option deletes

  • A: nothing. §2.2's "ask the package manager" work adds a per-ecosystem probe layer (Crawler probes spawn gem, python and npm with no timeout, so a hung shim hangs scan forever #845's spawn deadline is its prerequisite).
  • B: no engine code at first. The project-scope agent paths in apply/scan/get become a refusal, and later majors can delete the project-layout discovery that only agent mode uses: the pnpm/bun/vlt store fan-out, the venv-name hashing and the Cargo/NuGet cache-path resolution. Rough estimate: 3–5K production lines over time.
  • C: none. Docs and triage policy only.

Constraints

Acceptance

An owner picks A, B or C, and for B the deprecation window. The audit then files the mechanical follow-ups.

No activity

Activity on this issue will appear here.

Activity

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:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)priority:p3refactorStructural change: duplicated code or logic, missing abstraction, layering, dead code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions