@rallycry/conveyor-agent 10.2.4 → 10.2.5

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.
@@ -324,6 +324,13 @@ if [ -n "${CONVEYOR_USER_ID}" ] && [ -n "${USER_HOME_PROJECT_ID}" ] && [ -d "${U
324
324
  ln -sfn "${USER_HOME_ROOT}/.claude" /home/conveyor/.claude
325
325
  ln -sfn "${USER_HOME_ROOT}/.claude.json" /home/conveyor/.claude.json
326
326
  ln -sfn "${USER_HOME_ROOT}/.config/claude" /home/conveyor/.config/claude
327
+
328
+ # OpenCode state (sessions + config) persists the same way as ~/.claude.
329
+ mkdir -p "${USER_HOME_ROOT}/.local/share/opencode" "${USER_HOME_ROOT}/.config/opencode" 2>/dev/null || true
330
+ rm -rf /home/conveyor/.local/share/opencode /home/conveyor/.config/opencode 2>/dev/null || true
331
+ mkdir -p /home/conveyor/.local/share 2>/dev/null || true
332
+ ln -sfn "${USER_HOME_ROOT}/.local/share/opencode" /home/conveyor/.local/share/opencode
333
+ ln -sfn "${USER_HOME_ROOT}/.config/opencode" /home/conveyor/.config/opencode
327
334
  else
328
335
  echo "[pool] Skipping user-home symlink (userId='${CONVEYOR_USER_ID}', projectId='${USER_HOME_PROJECT_ID}', mount present: $([ -d "${USER_HOME_MOUNT}" ] && echo yes || echo no))"
329
336
  # No persistent home — the CLI reads the pod-local config; seed it there so
@@ -331,6 +338,88 @@ else
331
338
  seed_claude_json /home/conveyor/.claude.json
332
339
  fi
333
340
 
341
+ # ── Wire published graphify bundles from the shared user-home mount ──
342
+ # A locally published graph lives in the same GCS-FUSE user-home bucket as
343
+ # Claude state, under users/_shared/graphify/<repo>/latest. Export the path
344
+ # contract before the agent starts, then bind the files into graphify-out after
345
+ # git has prepared the workspace but before the ready marker is released.
346
+ configure_graphify_env() {
347
+ if [ "${CONVEYOR_GRAPHIFY_DISABLE:-}" = "1" ]; then
348
+ return 0
349
+ fi
350
+
351
+ local slug="${CONVEYOR_GRAPHIFY_SLUG:-${REPO_NAME:-}}"
352
+ if [ -z "${slug}" ]; then
353
+ return 0
354
+ fi
355
+
356
+ local primary_root="${USER_HOME_MOUNT}/users/_shared/graphify"
357
+ local legacy_root="${USER_HOME_MOUNT}/_shared/graphify"
358
+ local shared_root="${CONVEYOR_GRAPHIFY_SHARED_ROOT:-}"
359
+ if [ -z "${shared_root}" ]; then
360
+ if [ -d "${primary_root}" ] || [ ! -d "${legacy_root}" ]; then
361
+ shared_root="${primary_root}"
362
+ else
363
+ shared_root="${legacy_root}"
364
+ fi
365
+ fi
366
+
367
+ export CONVEYOR_GRAPHIFY_SLUG="${slug}"
368
+ export CONVEYOR_GRAPHIFY_SHARED_ROOT="${shared_root}"
369
+ export CONVEYOR_GRAPHIFY_DIR="${CONVEYOR_GRAPHIFY_DIR:-${shared_root}/${slug}/latest}"
370
+ export CONVEYOR_GRAPHIFY_GRAPH="${CONVEYOR_GRAPHIFY_GRAPH:-${CONVEYOR_GRAPHIFY_DIR}/graph.json}"
371
+ }
372
+
373
+ bind_graphify_bundle() {
374
+ if [ "${CONVEYOR_GRAPHIFY_DISABLE:-}" = "1" ]; then
375
+ echo "[pool] Graphify bind disabled."
376
+ return 0
377
+ fi
378
+
379
+ if [ -z "${CONVEYOR_GRAPHIFY_SLUG:-}" ]; then
380
+ return 0
381
+ fi
382
+
383
+ local workspace="${CONVEYOR_WORKSPACE:-/workspaces/repo}"
384
+ local source_dir="${CONVEYOR_GRAPHIFY_DIR:-}"
385
+ local graph_file="${CONVEYOR_GRAPHIFY_GRAPH:-}"
386
+
387
+ if [ -z "${source_dir}" ] || [ -z "${graph_file}" ]; then
388
+ return 0
389
+ fi
390
+
391
+ if [ ! -f "${graph_file}" ]; then
392
+ echo "[pool] Graphify bundle not found for '${CONVEYOR_GRAPHIFY_SLUG}' at ${source_dir}"
393
+ return 0
394
+ fi
395
+
396
+ local target_dir="${workspace}/graphify-out"
397
+ if ! mkdir -p "${target_dir}" 2>/dev/null; then
398
+ echo "[pool] WARN: unable to create graphify-out at ${target_dir}"
399
+ return 0
400
+ fi
401
+
402
+ local rel
403
+ for rel in graph.json GRAPH_REPORT.md manifest.json .graphify_analysis.json .graphify_labels.json publish-manifest.json cost.json; do
404
+ if [ ! -e "${source_dir}/${rel}" ]; then
405
+ continue
406
+ fi
407
+ if [ -e "${target_dir}/${rel}" ] || [ -L "${target_dir}/${rel}" ]; then
408
+ continue
409
+ fi
410
+ ln -s "${source_dir}/${rel}" "${target_dir}/${rel}" 2>/dev/null || true
411
+ done
412
+
413
+ echo "[pool] Bound graphify bundle '${CONVEYOR_GRAPHIFY_SLUG}' into ${target_dir}"
414
+ }
415
+
416
+ mark_git_ready() {
417
+ bind_graphify_bundle
418
+ : > "$GIT_READY_MARKER"
419
+ }
420
+
421
+ configure_graphify_env
422
+
334
423
  # ═══════════════════════════════════════════════════════════════════════════
335
424
  # WORKSPACE GIT — moved OFF the pre-launch critical path (Claudespace v3).
336
425
  #
@@ -489,7 +578,7 @@ prepare_workspace_git() {
489
578
  # Task repo is ready HERE — release the gate. The agent (already launched)
490
579
  # is polling for this marker before it spawns Claude / runs setup. Reference
491
580
  # repos are cloned AFTER this so they never block Claude.
492
- : > "$GIT_READY_MARKER"
581
+ mark_git_ready
493
582
  elif [ -d "repo/.git" ] && [ -n "${CONVEYOR_GITHUB_TOKEN}" ]; then
494
583
  # Non-image but repo already present (e.g. a baked image running without
495
584
  # CONVEYOR_POD_IMAGE set). Must NOT settle for a bare remote-URL refresh —
@@ -501,7 +590,7 @@ prepare_workspace_git() {
501
590
  if ! sync_task_branch_to_repo; then
502
591
  return 1
503
592
  fi
504
- : > "$GIT_READY_MARKER"
593
+ mark_git_ready
505
594
  elif [ -n "${CONVEYOR_GITHUB_TOKEN}" ] && [ -n "${REPO_OWNER}" ] && [ -n "${REPO_NAME}" ] && [ -n "${BRANCH}" ]; then
506
595
  echo "[pool] Cloning repo post-assignment (pre-clone was missing)..."
507
596
  # Guard each clone/fetch/checkout: under `set -e` a bare failing clone would
@@ -543,14 +632,14 @@ prepare_workspace_git() {
543
632
  return 1
544
633
  fi
545
634
  fi
546
- : > "$GIT_READY_MARKER"
635
+ mark_git_ready
547
636
  else
548
637
  # No git plan (e.g. task-less pod, or no token/repo). Nothing to prepare —
549
638
  # the repo dir already exists (created before launch) and the agent's own
550
639
  # git-sync fallback (guarded by CONVEYOR_GIT_READY) never runs on this pod
551
640
  # path anyway. Signal ready so the agent doesn't wait out the timeout.
552
641
  echo "[pool] No git plan to prepare — marking git ready."
553
- : > "$GIT_READY_MARKER"
642
+ mark_git_ready
554
643
  fi
555
644
 
556
645
  # ── Clone reference repos into /workspaces/references (best-effort) ──