Ashira Pitchayapakayakul commited on
Commit
147cb0f
Β·
1 Parent(s): 7d77adb

Non-blocking git clones + GIT_TERMINAL_PROMPT=0 + 30s timeout

Browse files
Files changed (1) hide show
  1. start.sh +18 -14
start.sh CHANGED
@@ -45,6 +45,10 @@ mkdir -p ~/.hermes
45
  chmod 600 ~/.hermes/.env
46
 
47
  # ── 3. Git config + clone axentx repos for auto-orchestrate auto-commit ────
 
 
 
 
48
  GH_TOKEN=$(echo "${GITHUB_TOKEN_POOL:-}" | cut -d',' -f1)
49
  if [[ -n "$GH_TOKEN" ]]; then
50
  git config --global user.email "hermes@axentx.ai"
@@ -55,12 +59,10 @@ if [[ -n "$GH_TOKEN" ]]; then
55
 
56
  PROJECTS_DIR="${DATA}/projects"
57
  mkdir -p "$PROJECTS_DIR"
58
- # Symlink to the path auto-orchestrate-loop expects
59
  rm -rf ~/axentx 2>/dev/null
60
  ln -sfn "$PROJECTS_DIR" ~/axentx
61
 
62
- # Clone axentx repos (skip if already exists)
63
- # Note: axiomops dropped (using arkship instead). arkship lives under arkashira org.
64
  for repo_spec in \
65
  "Costinel:AXENTX/Costinel" \
66
  "Vanguard:AXENTX/vanguard" \
@@ -69,23 +71,25 @@ if [[ -n "$GH_TOKEN" ]]; then
69
  local_name="${repo_spec%%:*}"
70
  gh_path="${repo_spec##*:}"
71
  target="${PROJECTS_DIR}/${local_name}"
72
- if [[ ! -d "$target/.git" ]]; then
73
- echo "[$(date +%H:%M:%S)] cloning $gh_path..." >> "$LOG_DIR/boot.log"
74
- git clone "https://x-access-token:${GH_TOKEN}@github.com/${gh_path}.git" "$target" \
75
- >> "$LOG_DIR/git-clone.log" 2>&1 || \
76
- echo "[$(date +%H:%M:%S)] WARN: clone $gh_path failed" >> "$LOG_DIR/boot.log"
77
- else
78
- # Update existing checkout (pull latest before committing)
79
- (cd "$target" && git fetch && git pull --rebase 2>&1 | tail -3) \
80
- >> "$LOG_DIR/git-pull.log" 2>&1 || true
81
- fi
 
82
  done
 
83
 
84
  # Persist token for any push from auto-orchestrate
85
  git config --global credential.helper "store --file=$HOME/.git-credentials"
86
  echo "https://x-access-token:${GH_TOKEN}@github.com" > ~/.git-credentials
87
  chmod 600 ~/.git-credentials
88
- echo "[$(date +%H:%M:%S)] git auth configured + 4 axentx repos cloned" >> "$LOG_DIR/boot.log"
89
  fi
90
 
91
  # ── 4. Redis (TCP only) ─────────────────────────────────────────────────────
 
45
  chmod 600 ~/.hermes/.env
46
 
47
  # ── 3. Git config + clone axentx repos for auto-orchestrate auto-commit ────
48
+ # Disable interactive prompts globally so failed-auth git ops fail fast.
49
+ export GIT_TERMINAL_PROMPT=0
50
+ export GIT_ASKPASS=/bin/true
51
+
52
  GH_TOKEN=$(echo "${GITHUB_TOKEN_POOL:-}" | cut -d',' -f1)
53
  if [[ -n "$GH_TOKEN" ]]; then
54
  git config --global user.email "hermes@axentx.ai"
 
59
 
60
  PROJECTS_DIR="${DATA}/projects"
61
  mkdir -p "$PROJECTS_DIR"
 
62
  rm -rf ~/axentx 2>/dev/null
63
  ln -sfn "$PROJECTS_DIR" ~/axentx
64
 
65
+ # Clone axentx repos in background with hard timeout β€” never blocks boot
 
66
  for repo_spec in \
67
  "Costinel:AXENTX/Costinel" \
68
  "Vanguard:AXENTX/vanguard" \
 
71
  local_name="${repo_spec%%:*}"
72
  gh_path="${repo_spec##*:}"
73
  target="${PROJECTS_DIR}/${local_name}"
74
+ (
75
+ if [[ ! -d "$target/.git" ]]; then
76
+ echo "[$(date +%H:%M:%S)] cloning $gh_path..." >> "$LOG_DIR/boot.log"
77
+ timeout 30 git clone --depth 50 \
78
+ "https://x-access-token:${GH_TOKEN}@github.com/${gh_path}.git" "$target" \
79
+ >> "$LOG_DIR/git-clone.log" 2>&1 || \
80
+ echo "[$(date +%H:%M:%S)] WARN: clone $gh_path failed/timeout" >> "$LOG_DIR/boot.log"
81
+ else
82
+ cd "$target" && timeout 20 git pull --rebase >> "$LOG_DIR/git-pull.log" 2>&1 || true
83
+ fi
84
+ ) &
85
  done
86
+ # Don't wait β€” let clones finish in background while boot continues
87
 
88
  # Persist token for any push from auto-orchestrate
89
  git config --global credential.helper "store --file=$HOME/.git-credentials"
90
  echo "https://x-access-token:${GH_TOKEN}@github.com" > ~/.git-credentials
91
  chmod 600 ~/.git-credentials
92
+ echo "[$(date +%H:%M:%S)] git auth configured + clone jobs spawned" >> "$LOG_DIR/boot.log"
93
  fi
94
 
95
  # ── 4. Redis (TCP only) ─────────────────────────────────────────────────────