Skip to content

[Bug]: Source control discovery spawns missing forge CLIs every sweep and logs spawn errors for unused providers #42357

Done

Description

@mohaalak

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. On a Linux server install (0.1.11), have only git, gh and glab installed. tea, fj, cafe, origin and jj are not on PATH.
  2. Use only GitLab: Settings has offeredSourceControlProviders: { "gitlab": true }, and Forgejo/Gitea and the others were never turned on.
  3. Leave the server running with a client connected and read ~/.t3/userdata/logs/server.trace.ndjson, or open the diagnostics view.

Expected behavior

A provider that is not installed, or that the user never turned on, should not spawn processes or record failures on every discovery sweep. When <cli> --version fails with ENOENT, discovery should report "not installed" once and skip the auth command for that CLI. Ideally, providers the user hasn't turned on should not be probed at all, or should be probed only when the Source Control settings page is open.

Actual behavior

Every discovery sweep spawns the version command and the auth command of every CLI spec, including ones that are not installed. In packages/source-control-core/src/server/discovery.ts, probeCli and auth run together with Effect.all(..., { concurrency: "unbounded" }) (the comment says "The auth check does not depend on the version output, so both spawn at once."). So a missing binary fails twice, and each failure is recorded as failed spans (NonBlockingSpawner.spawn → processRunner.runProcessCore → VcsProcess.spawn → VcsProcess.runUnbounded → VcsProcess.run). The error is caught and becomes "missing" or "unknown auth", so nothing breaks. But it fills the trace and shows up in diagnostics as an error:

VcsProcessSpawnError: VCS process failed to spawn in source-control.discovery.auth: tea (/home/<user>)
    at VcsProcessSpawnError.fromProcessSpawnError (file:///home/<user>/.t3/runtime/versions/0.1.11/t3:36329:11)
    at Object.ProcessSpawnError (file:///home/<user>/.t3/runtime/versions/0.1.11/t3:190505:56)
    at Object.evaluate

Counts from one server over about 3 hours (15:58 to 19:06 UTC, the whole retained trace window):

Spawn that failed with ENOENT Count
tea --version, tea login status --output json 145 each
fj version, fj auth list 145 each
cafe --version, cafe ... auth status --json 145 each
origin --version, origin auth status --json 145 each
jj --version 145
tea login list --output json (ForgejoCli.execute, from repository refinement) 108

That is a sweep about every 75 seconds, with 9 failed spawns per sweep, or roughly 1,300 spawn failures, each recorded as about 5 failed spans. With the default trace retention (10 × 10 MB) the retained window is only about 3 hours on this machine, and this noise is a large part of it.

Related, not duplicates:

Suggestions:

  • (a) Run the auth command only after the version probe succeeds, so a missing CLI costs one spawn, not two.
  • (b) Cache "not installed" for a CLI until PATH changes or the user presses refresh, instead of re-spawning every sweep.
  • (c) Skip discovery for providers that aren't turned on (offeredSourceControlProviders), or only sweep them while Settings → Source Control is open.
  • (d) Record an expected ENOENT from a discovery probe as a non-error span, so it doesn't appear in diagnostics as an error.

Impact

Cosmetic issue

Version or commit

0.1.11 (server)

Environment

Ubuntu Server 26.04 (x64), T3 Code server run as a systemd user service, connected through T3 Connect. Installed CLIs: git, gh, glab. Not installed: tea, fj, cafe, origin, jj.

Logs or stack traces

{"name":"NonBlockingSpawner.spawn", ..., "exit":{"_tag":"Failure","cause":"PlatformError: NotFound: ChildProcess.spawn (tea login list --output json) ..."}}
{"name":"VcsProcess.run", ..., "exit":{"_tag":"Failure","cause":"VcsProcessSpawnError: VCS process failed to spawn in source-control.discovery.auth: tea (/home/<user>) ..."}}

Activity

  1. added a commit that references this issue on Nov 24, 2026
    ada40ef
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions