feat(ops): host_sync.sh — auto-sync host tree to origin/main (#160) #346

Merged
chaim merged 1 commits from worktree-host-sync into main 2026-06-28 22:20:40 +00:00
Owner

סוגר את פער-פריסת-המארח (TaskMaster #160). הכותב/פאנלים/MCP-tools רצים מעץ-המארח (לא בקונטיינר), אז merge+deploy לא מעדכן אותם — קוד-המארח נשאר על ה-git pull הידני האחרון (ב-2026-06-28 היה 16 commits מאחור).

scripts/host_sync.sh (cron כל דקה, כדפוס ה-data/training הקיים) עושה fast-forward בלבד לעץ-המארח כשהוא מאחור. בטוח: אף-פעם לא force → tasks.json הדירטי לעולם לא נדרס (ff נקי משאיר אותו; התנגשות-upstream → log+bail ידני). נתיב-הסוכן spawn-fresh → אין צורך ב-restart; רק שירותי-pm2 ארוכי-החיים שמייבאים קוד-אפליקציה (chat/court-fetch/reaper) עוברים restart, ורק כשקבציהם השתנו (מדויק). log ל-data/logs/host_sync.log.

cron (יתווסף על המארח, flock-guarded): * * * * * flock -n /tmp/host_sync.lock bash ~/legal-ai/scripts/host_sync.sh

SCRIPTS.md עודכן. bash -n נקי.

🤖 Generated with Claude Code

סוגר את **פער-פריסת-המארח** (TaskMaster #160). הכותב/פאנלים/MCP-tools רצים מעץ-המארח (לא בקונטיינר), אז merge+deploy לא מעדכן אותם — קוד-המארח נשאר על ה-`git pull` הידני האחרון (ב-2026-06-28 היה 16 commits מאחור). `scripts/host_sync.sh` (cron כל דקה, כדפוס ה-data/training הקיים) עושה **fast-forward בלבד** לעץ-המארח כשהוא מאחור. בטוח: אף-פעם לא force → tasks.json הדירטי לעולם לא נדרס (ff נקי משאיר אותו; התנגשות-upstream → log+bail ידני). נתיב-הסוכן spawn-fresh → אין צורך ב-restart; רק שירותי-pm2 ארוכי-החיים שמייבאים קוד-אפליקציה (chat/court-fetch/reaper) עוברים restart, ורק כשקבציהם השתנו (מדויק). log ל-data/logs/host_sync.log. cron (יתווסף על המארח, flock-guarded): `* * * * * flock -n /tmp/host_sync.lock bash ~/legal-ai/scripts/host_sync.sh` SCRIPTS.md עודכן. bash -n נקי. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 1 commit 2026-06-28 22:20:33 +00:00
feat(ops): host_sync.sh — auto-sync host tree to origin/main (P-#160)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 4s
Lint — undefined names / undefined-names (pull_request) Successful in 10s
80a5daa3e3
The writer, learning panels, and legal_mcp tools run from the HOST tree
(Paperclip agents claude -p with cwd=~/legal-ai; pm2 services import from
mcp-server/src) — not the container. A merge + Coolify deploy only refreshes the
FastAPI container; host-side code stayed on the last manual `git pull`. On
2026-06-28 the host was 16 commits behind, so a day of learning-loop fixes sat
dormant until pulled by hand.

host_sync.sh (run every minute via cron, like the existing data/training pull)
fast-forwards the host tree to origin/main when it falls behind. Fast-forward
ONLY — never forces, so the perpetually-dirty .taskmaster/tasks/tasks.json is
never clobbered (clean ff leaves it; an upstream conflict logs + bails for manual
handling). Agent runs spawn fresh and pick up new code with no restart; only the
long-running pm2 services that import app code (chat_service, court_fetch_service,
reaper) are restarted, and only when their own files changed (precise, minimal
churn). Logs to data/logs/host_sync.log.

Cron entry (added on the host, flock-guarded):
  * * * * * flock -n /tmp/host_sync.lock bash ~/legal-ai/scripts/host_sync.sh

SCRIPTS.md updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim merged commit c1983ea41d into main 2026-06-28 22:20:40 +00:00
chaim deleted branch worktree-host-sync 2026-06-28 22:20:40 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ezer-mishpati/legal-ai#346