redeploy-services: the PeerTube unit has no pnpm, so PeerTube 8's sign-in plugin install dies command not found and reports a bare 400 — the 429 in the leg error is self-inflicted #1621

Closed
opened 2026-09-19 02:14:15 +00:00 by matou-build-agent · 1 comment

The failure

Drive 20260919T005805Z, leg redeploy-services red (29/30 green) with masked_exit on gateway: the remote switch died at exit 4. peertube-oidc.service failed; its journal ends:

video-oidc: plugin install failed (HTTP 400): {"detail":"Cannot install plugin peertube-plugin-auth-openid-connect","status":400}
video-oidc: kanidm/PeerTube never accepted the OIDC provisioning within the settle budget

This is byte-for-byte the #1616 / GOTCHAS #260 symptom, so it reads as "the lifted connect cap did not take". It did take. This is the NEXT link in the chain.

The evidence — from the kept droplet

journalctl -u peertube, the FIRST install attempt (01:54:03, 8 s after the oneshot started):

error: Cannot install plugin peertube-plugin-auth-openid-connect, removing it... {
  "message": "Command failed: pnpm add peertube-plugin-auth-openid-connect@1.2.0\n/bin/sh: line 1: pnpm: command not found\n"
}

PeerTube 8.1.8 installs a plugin by shelling out to pnpm — dist/core/lib/plugins/package-manager.js:34, execShell(\pnpm ${command}`, { cwd: pluginDirectory }). PeerTube ≤ 7 used yarn add, and nixpkgs' services.peertubestill puts PeerTube ≤ 7's package manager on the unit PATH.systemctl show peertube -p Environment` on the box:

PATH=…/nodejs-24.15.0/bin:…/yarn-1.22.22/bin:…/ffmpeg-headless…

No pnpm, anywhere. execShell inherits that PATH, so the install fails before it unpacks anything.

pnpm's layout is not part of the gap: PeerTube writes its own pnpm-workspace.yaml (nodeLinker: hoisted, dangerouslyAllowAllBuilds: true) into the plugins dir first (package-manager.js:72-75). The binary is the whole missing piece.

Why the leg error named the wrong cause

The oneshot retries provision_video_oidc 60× at ~7 s (internal/clan/video.go:576-580), and every attempt makes PeerTube POST packages.joinpeertube.org/api/v1/plugins/latest-version. 120 attempts were logged. That index allows 100 (x-ratelimit-limit: 100), so from ~02:01 onward the response is:

HTTPError: Request failed with status code 429 (Too Many Requests)
"responseBody": "Too many requests, please try again later."
"x-ratelimit-remaining": "0", "retry-after": "22"

The 429 is entirely self-inflicted and it OVERWROTE pnpm: command not found in the journal tail the harness captures. GOTCHAS #245 again: read the FIRST failure of a retry loop, never the last.

The fix in this commit

renderPeerTubeDaemon (internal/clan/video.go:289-300) now emits systemd.services.peertube.path = [ pkgs.pnpm ]; beside the #1616 NODE_OPTIONS line. Covered by TestRenderVideo_CarriesPeerTubesPluginPackageManager (internal/clan/video_test.go:58). GOTCHAS #261 records the hazard and the 429-masking trap.

Second defect — NOT fixed here, needs its own ruling

The retry storm above is a real latent defect in its own right: the oneshot retries a DETERMINISTIC failure 60 times and, on each pass, makes the community's gateway hammer a shared third-party service until its rate budget is spent — abusing joinpeertube.org and destroying the diagnostic evidence in the process. mint_peertube_token already learned exactly this lesson for PeerTube's OWN limiter (#1606 defect 2, video.go:538-544 — mint once, back off on 429), but the lesson was never applied to the upstream index the install dials.

It does not block the re-drive (with pnpm present the first install succeeds and the loop exits immediately), so it is not filed as a blocking residual — but it should be ruled on, and it overlaps the question already routed to Ben as #1616 defect 1: whether the plugin should arrive in the Nix closure at build time instead of from a third-party index at deploy time. Landing the plugin in the closure would dissolve both this defect and #260 at once.

Suspected layer

Product — the video port's Nix render (internal/clan/video.go). A version drift between nixpkgs' services.peertube module (still yarn-era) and the PeerTube 8 package it deploys.

Proposed ruling (Ruled by the healer under ADR 0174 — veto anytime)

Two-way door, mechanical, not a design decision. (1) It is a one-line addition to a rendered unit's PATH — systemd.services.peertube.path = [ pkgs.pnpm ] — revertible by deleting that line and its test in a single later commit, with no migration, no state, no persisted artifact behind it. (2) It changes nothing about what the community SEES or what the deploy MEANS to do: the module already declares that it installs peertube-plugin-auth-openid-connect and already drives PeerTube's install API to do so; it simply could not, because the interpreter that install shells out to was absent. Making the code do what it already meant to do is the definition of a mechanical repair. (3) No security, trust, secrets, route or message surface is touched — pkgs.pnpm is an existing nixpkgs package placed on one unit's PATH, not a new dependency manifest entry, not a new default a community chooses, not a changed word at a trust moment. (4) It is proven here by TestRenderVideo_CarriesPeerTubesPluginPackageManager (internal/clan/video_test.go:58), written red-first against the render and watched fail before the fix. (5) My confidence that pnpm alone closes it — rather than pnpm plus some layout flag — is not inference: the box's own copy of package-manager.js:72-75 shows PeerTube writing its own pnpm-workspace.yaml with nodeLinker: hoisted before installing, so the binary is the only thing it was missing. Built on the workstation (never the drive host) and closed through the close-report gate — the same gate a swarm worker passes.

drive 20260919T005805Z red at redeploy-services (sig 03347fc9985d) — self-fixed on the fast lane, commit f48c2deec1894b5998bdfb87cedcdd9dfa75614b; checks: targeted: GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan -run TestRenderVideo_CarriesPeerTubesPluginPackageManager — FAIL before the fix (red-first), ok git.matou.nz/Matou/idss/internal/clan 0.008s after. package: GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan ./internal/videosvc — ok git.matou.nz/Matou/idss/internal/clan 28.008s, ok git.matou.nz/Matou/idss/internal/videosvc 0.006s. Diff: 3 files, 47 non-test lines added, 0 removed; no assertion, test or leg touched.. evidence: /home/dev/swarm/Matou/idss/test-results/drive-rented-services/20260919T005805Z on matou-workstation.

## The failure Drive `20260919T005805Z`, leg `redeploy-services` red (29/30 green) with `masked_exit on gateway: the remote switch died at exit 4`. `peertube-oidc.service` failed; its journal ends: ``` video-oidc: plugin install failed (HTTP 400): {"detail":"Cannot install plugin peertube-plugin-auth-openid-connect","status":400} video-oidc: kanidm/PeerTube never accepted the OIDC provisioning within the settle budget ``` This is byte-for-byte the #1616 / GOTCHAS #260 symptom, so it reads as "the lifted connect cap did not take". It did take. This is the NEXT link in the chain. ## The evidence — from the kept droplet `journalctl -u peertube`, the FIRST install attempt (01:54:03, 8 s after the oneshot started): ``` error: Cannot install plugin peertube-plugin-auth-openid-connect, removing it... { "message": "Command failed: pnpm add peertube-plugin-auth-openid-connect@1.2.0\n/bin/sh: line 1: pnpm: command not found\n" } ``` PeerTube 8.1.8 installs a plugin by shelling out to pnpm — `dist/core/lib/plugins/package-manager.js:34`, `execShell(\`pnpm ${command}\`, { cwd: pluginDirectory })`. PeerTube ≤ 7 used `yarn add`, and nixpkgs' `services.peertube` still puts PeerTube ≤ 7's package manager on the unit PATH. `systemctl show peertube -p Environment` on the box: ``` PATH=…/nodejs-24.15.0/bin:…/yarn-1.22.22/bin:…/ffmpeg-headless… ``` No pnpm, anywhere. `execShell` inherits that PATH, so the install fails before it unpacks anything. pnpm's *layout* is not part of the gap: PeerTube writes its own `pnpm-workspace.yaml` (`nodeLinker: hoisted`, `dangerouslyAllowAllBuilds: true`) into the plugins dir first (`package-manager.js:72-75`). The binary is the whole missing piece. ## Why the leg error named the wrong cause The oneshot retries `provision_video_oidc` 60× at ~7 s (`internal/clan/video.go:576-580`), and every attempt makes PeerTube POST `packages.joinpeertube.org/api/v1/plugins/latest-version`. 120 attempts were logged. That index allows 100 (`x-ratelimit-limit: 100`), so from ~02:01 onward the response is: ``` HTTPError: Request failed with status code 429 (Too Many Requests) "responseBody": "Too many requests, please try again later." "x-ratelimit-remaining": "0", "retry-after": "22" ``` The 429 is entirely self-inflicted and it OVERWROTE `pnpm: command not found` in the journal tail the harness captures. GOTCHAS #245 again: read the FIRST failure of a retry loop, never the last. ## The fix in this commit `renderPeerTubeDaemon` (`internal/clan/video.go:289-300`) now emits `systemd.services.peertube.path = [ pkgs.pnpm ];` beside the #1616 `NODE_OPTIONS` line. Covered by `TestRenderVideo_CarriesPeerTubesPluginPackageManager` (`internal/clan/video_test.go:58`). GOTCHAS #261 records the hazard and the 429-masking trap. ## Second defect — NOT fixed here, needs its own ruling The retry storm above is a real latent defect in its own right: the oneshot retries a DETERMINISTIC failure 60 times and, on each pass, makes the community's gateway hammer a shared third-party service until its rate budget is spent — abusing joinpeertube.org and destroying the diagnostic evidence in the process. `mint_peertube_token` already learned exactly this lesson for PeerTube's OWN limiter (#1606 defect 2, `video.go:538-544` — mint once, back off on 429), but the lesson was never applied to the upstream index the install dials. It does not block the re-drive (with pnpm present the first install succeeds and the loop exits immediately), so it is not filed as a blocking residual — but it should be ruled on, and it overlaps the question already routed to Ben as **#1616 defect 1**: whether the plugin should arrive in the Nix closure at build time instead of from a third-party index at deploy time. Landing the plugin in the closure would dissolve both this defect and #260 at once. ## Suspected layer Product — the video port's Nix render (`internal/clan/video.go`). A version drift between nixpkgs' `services.peertube` module (still yarn-era) and the PeerTube 8 package it deploys. ## Proposed ruling (Ruled by the healer under ADR 0174 — veto anytime) Two-way door, mechanical, not a design decision. (1) It is a one-line addition to a rendered unit's PATH — `systemd.services.peertube.path = [ pkgs.pnpm ]` — revertible by deleting that line and its test in a single later commit, with no migration, no state, no persisted artifact behind it. (2) It changes nothing about what the community SEES or what the deploy MEANS to do: the module already declares that it installs peertube-plugin-auth-openid-connect and already drives PeerTube's install API to do so; it simply could not, because the interpreter that install shells out to was absent. Making the code do what it already meant to do is the definition of a mechanical repair. (3) No security, trust, secrets, route or message surface is touched — pkgs.pnpm is an existing nixpkgs package placed on one unit's PATH, not a new dependency manifest entry, not a new default a community chooses, not a changed word at a trust moment. (4) It is proven here by `TestRenderVideo_CarriesPeerTubesPluginPackageManager` (internal/clan/video_test.go:58), written red-first against the render and watched fail before the fix. (5) My confidence that pnpm alone closes it — rather than pnpm plus some layout flag — is not inference: the box's own copy of package-manager.js:72-75 shows PeerTube writing its own pnpm-workspace.yaml with `nodeLinker: hoisted` before installing, so the binary is the only thing it was missing. Built on the workstation (never the drive host) and closed through the close-report gate — the same gate a swarm worker passes. drive `20260919T005805Z` red at `redeploy-services` (sig 03347fc9985d) — self-fixed on the fast lane, commit `f48c2deec1894b5998bdfb87cedcdd9dfa75614b`; checks: targeted: `GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan -run TestRenderVideo_CarriesPeerTubesPluginPackageManager` — FAIL before the fix (red-first), `ok git.matou.nz/Matou/idss/internal/clan 0.008s` after. package: `GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan ./internal/videosvc` — `ok git.matou.nz/Matou/idss/internal/clan 28.008s`, `ok git.matou.nz/Matou/idss/internal/videosvc 0.006s`. Diff: 3 files, 47 non-test lines added, 0 removed; no assertion, test or leg touched.. evidence: `/home/dev/swarm/Matou/idss/test-results/drive-rented-services/20260919T005805Z` on matou-workstation. <!-- rehearsal-sig: 03347fc9985d -->
Author
Member

close-report for #1621 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1621,
  "status": "success",
  "commits": [
    "f48c2deec1894b5998bdfb87cedcdd9dfa75614b"
  ],
  "changed_files": [
    "docs/GOTCHAS.md",
    "internal/clan/video.go",
    "internal/clan/video_test.go"
  ],
  "tests": [
    {
      "command": "targeted: `GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan -run TestRenderVideo_CarriesPeerTubesPluginPackageManager` — FAIL before the fix (red-first), `ok git.matou.nz/Matou/idss/internal/clan 0.008s` after. package: `GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan ./internal/videosvc` — `ok git.matou.nz/Matou/idss/internal/clan 28.008s`, `ok git.matou.nz/Matou/idss/internal/videosvc 0.006s`. Diff: 3 files, 47 non-test lines added, 0 removed; no assertion, test or leg touched.",
      "exit_code": 0
    }
  ],
  "criteria": {
    "the red leg is now green": "healed on the fast lane, commit f48c2deec1894b5998bdfb87cedcdd9dfa75614b"
  },
  "summary": "The video port's PeerTube unit carried nodejs+yarn but not pnpm, and PeerTube 8 installs plugins by shelling out to `pnpm add` — so the sign-in plugin install died `pnpm: command not found` on every deploy (the 429 in the leg error was self-inflicted by the 60x retry hammering the shared index); renderPeerTubeDaemon now puts pkgs.pnpm on the unit's path, with a render test and GOTCHAS #261.",
  "blockers": []
}
**close-report** for #1621 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1621, "status": "success", "commits": [ "f48c2deec1894b5998bdfb87cedcdd9dfa75614b" ], "changed_files": [ "docs/GOTCHAS.md", "internal/clan/video.go", "internal/clan/video_test.go" ], "tests": [ { "command": "targeted: `GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan -run TestRenderVideo_CarriesPeerTubesPluginPackageManager` — FAIL before the fix (red-first), `ok git.matou.nz/Matou/idss/internal/clan 0.008s` after. package: `GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan ./internal/videosvc` — `ok git.matou.nz/Matou/idss/internal/clan 28.008s`, `ok git.matou.nz/Matou/idss/internal/videosvc 0.006s`. Diff: 3 files, 47 non-test lines added, 0 removed; no assertion, test or leg touched.", "exit_code": 0 } ], "criteria": { "the red leg is now green": "healed on the fast lane, commit f48c2deec1894b5998bdfb87cedcdd9dfa75614b" }, "summary": "The video port's PeerTube unit carried nodejs+yarn but not pnpm, and PeerTube 8 installs plugins by shelling out to `pnpm add` — so the sign-in plugin install died `pnpm: command not found` on every deploy (the 429 in the leg error was self-inflicted by the 60x retry hammering the shared index); renderPeerTubeDaemon now puts pkgs.pnpm on the unit's path, with a render test and GOTCHAS #261.", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#1621
No description provided.