amsd-pipeline 2.0.18 → 2.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/install.sh +56 -1
  2. package/package.json +1 -1
package/install.sh CHANGED
@@ -127,6 +127,15 @@ if [ "$UNINSTALL" = "1" ]; then
127
127
  if stop_snapshot_watch "$_UN_ROOT" && [ -n "$_UN_SW_WAS_RUNNING" ]; then
128
128
  _ok "stopped snapshot-watch (pid $_UN_SW_WAS_RUNNING)"
129
129
  fi
130
+ # The cassette harvest is a host process too, and it outlives runs by design — an uninstall
131
+ # that left it running would keep sweeping an install that no longer exists.
132
+ _UN_CW_PIDFILE="$_UN_ROOT/orchestrations/dashboards/.cassette-watch.pid"
133
+ _UN_CW_WAS_RUNNING=""
134
+ [ -f "$_UN_CW_PIDFILE" ] && _UN_CW_WAS_RUNNING="$(cat "$_UN_CW_PIDFILE" 2>/dev/null)"
135
+ . "$INSTALLER_DIR/lib/cassette-watch-control.sh"
136
+ if stop_cassette_watch "$_UN_ROOT" && [ -n "$_UN_CW_WAS_RUNNING" ]; then
137
+ _ok "stopped cassette-watch (pid $_UN_CW_WAS_RUNNING)"
138
+ fi
130
139
 
131
140
  . "$INSTALLER_DIR/lib/isolated-compose-identity.sh"
132
141
  if [ -f "$INSTALLER_DIR/lib/container-runtime.sh" ]; then
@@ -533,7 +542,39 @@ if [ "$CHECK_ONLY" = "1" ]; then
533
542
  else _warn "no epam shim at $BIN_DIR/epam"; fi
534
543
  else
535
544
  mkdir -p "$BIN_DIR"
536
- printf '#!/usr/bin/env bash\nexec node "%s/dist/epam.js" "$@"\n' "$ROOT" > "$BIN_DIR/epam"
545
+ # AN INSTALL MAY TAKE OVER THE NAME. IT MAY NOT DESTROY WHAT WAS THERE WITHOUT A TRACE.
546
+ #
547
+ # BIN_DIR is machine-wide, so an install into a THROWAWAY dest repoints the operator's `epam`
548
+ # at a directory that is about to be deleted, and the command dies with it. Found live
549
+ # 2026-09-09: `epam` had pointed at /tmp/installer-creds-f7Uyoe since an install test hours
550
+ # earlier and had been broken ever since, silently. Most test files that invoke install.sh do
551
+ # not set EPAM_BIN_DIR, so this is routine rather than rare.
552
+ #
553
+ # The shim is still written and `epam` still works after a normal install — nothing here
554
+ # withdraws that. What changes is that a shim pointing at a DIFFERENT install is copied aside
555
+ # first, so the previous command can always be restored. Re-installing the same tree replaces
556
+ # its own shim and keeps no backup, since there is nothing to lose.
557
+ if [ -f "$BIN_DIR/epam" ] && ! grep -qF "$ROOT/dist/epam.js" "$BIN_DIR/epam" 2>/dev/null; then
558
+ _bk="$BIN_DIR/epam.$(date -u +%Y%m%dT%H%M%SZ).bak"
559
+ if cp -p "$BIN_DIR/epam" "$_bk" 2>/dev/null; then
560
+ _warn "an epam shim was already here pointing elsewhere — kept as $_bk"
561
+ else
562
+ _warn "an epam shim was already here pointing elsewhere and could NOT be backed up"
563
+ fi
564
+ fi
565
+ # THE SHIM DIAGNOSES ITSELF. Pointing at a deleted install used to surface as a bare node
566
+ # module-resolution stack ("Cannot find module .../dist/epam.js"), which names the symptom and
567
+ # not the cause; an operator reads it as a broken build rather than a stale command.
568
+ {
569
+ printf '#!/usr/bin/env bash\n'
570
+ printf '_target="%s/dist/epam.js"\n' "$ROOT"
571
+ printf 'if [ ! -f "$_target" ]; then\n'
572
+ printf ' echo "epam: this command points at an install that is gone: %s" >&2\n' "$ROOT"
573
+ printf ' echo "epam: re-run install.sh, or point this shim at a current install: $0" >&2\n'
574
+ printf ' exit 127\n'
575
+ printf 'fi\n'
576
+ printf 'exec node "$_target" "$@"\n'
577
+ } > "$BIN_DIR/epam"
537
578
  chmod +x "$BIN_DIR/epam"
538
579
  _ok "epam shim written to $BIN_DIR/epam -> $ROOT/dist/epam.js"
539
580
  case ":$PATH:" in
@@ -839,6 +880,20 @@ else
839
880
  _ok "skipped"
840
881
  fi
841
882
 
883
+ # ── Cassette harvest: the ONLY thing that survives a kill -9 or an OOM ────────
884
+ #
885
+ # The run's EXIT trap archives its own cassette on every exit bash controls. Neither kill -9 nor an
886
+ # OOM kill runs a trap, and both are how recordings were actually lost here. Langfuse holds the
887
+ # turns as they happen, so this sweeps them into a partial cassette from OUTSIDE the run — it
888
+ # belongs to the install, and cannot be taken down by the run it is protecting.
889
+ _head "Cassette harvest (a killed run still leaves its recording)"
890
+ if [ "$CHECK_ONLY" != "1" ] && [ -f "$ROOT/orchestrations/scripts/cassette-watch.js" ]; then
891
+ . "$INSTALLER_DIR/lib/cassette-watch-control.sh"
892
+ start_cassette_watch "$ROOT" || FAILED=1
893
+ else
894
+ _ok "skipped"
895
+ fi
896
+
842
897
  # ── Launch dashboard: OPTIONAL, and must be genuinely UP when it claims to be ─
843
898
  # THIS CANNOT DEPEND ON A HUMAN OR AN LLM DOING IT BY HAND. A rebuild-and-restart done manually
844
899
  # once is a rebuild-and-restart that must be done manually every time — this makes it the same
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amsd-pipeline",
3
- "version": "2.0.18",
3
+ "version": "2.0.20",
4
4
  "description": "Installer for the amsd-pipeline orchestration stack. Clones, packages and provisions the full stack with one command — no separate git clone step.",
5
5
  "bin": {
6
6
  "amsd-pipeline": "bin/amsd-pipeline.js"