Skip to content

Commit e4514a3

Browse files
Jonathan D.A. Jewellclaude
andcommitted
feat: wire dispatch-runner to hypatia's local data store + kin heartbeat
- dispatch-runner now reads from hypatia's data/verisimdb/dispatch/ first, falls back to central verisimdb-data - Outcomes written to both hypatia's local store and central store - Adds kin heartbeat writer (gitbot-fleet.heartbeat.json) for ecosystem coordination with Hypatia's Kin.Coordinator Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b2928ee commit e4514a3

1 file changed

Lines changed: 47 additions & 3 deletions

File tree

scripts/dispatch-runner.sh

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,22 @@ validate_path_within() {
4747
}
4848

4949
# --- Configuration ---
50+
# Hypatia's local data store is the primary source for dispatch manifests.
51+
# Falls back to central verisimdb-data if HYPATIA_DATA is not set.
52+
HYPATIA_DATA="${HYPATIA_DATA:-/var/mnt/eclipse/repos/hypatia/data/verisimdb}"
5053
VERISIMDB_DATA="${VERISIMDB_DATA:-/var/mnt/eclipse/repos/verisimdb-data}"
5154
REPOS_BASE="${REPOS_BASE:-/var/mnt/eclipse/repos}"
5255
FLEET_SCRIPTS="${FLEET_SCRIPTS:-/var/mnt/eclipse/repos/gitbot-fleet/scripts}"
53-
RRA_BIN="${RRA_BIN:-/var/mnt/eclipse/repos/robot-repo-automaton/target/release/robot-repo-automaton}"
54-
MANIFEST_PATH="${VERISIMDB_DATA}/dispatch/pending.jsonl"
56+
RRA_BIN="${RRA_BIN:-/var/mnt/eclipse/repos/gitbot-fleet/robot-repo-automaton/target/release/robot-repo-automaton}"
57+
58+
# Try hypatia's data first, then fall back to central verisimdb-data
59+
if [[ -f "${HYPATIA_DATA}/dispatch/pending.jsonl" ]]; then
60+
MANIFEST_PATH="${HYPATIA_DATA}/dispatch/pending.jsonl"
61+
elif [[ -f "${VERISIMDB_DATA}/dispatch/pending.jsonl" ]]; then
62+
MANIFEST_PATH="${VERISIMDB_DATA}/dispatch/pending.jsonl"
63+
else
64+
MANIFEST_PATH="${HYPATIA_DATA}/dispatch/pending.jsonl"
65+
fi
5566

5667
DRY_RUN=false
5768
FILTER_TIER=""
@@ -105,7 +116,9 @@ echo " Dry run: $DRY_RUN"
105116
echo ""
106117

107118
# --- Outcome recording ---
108-
OUTCOME_FILE="${VERISIMDB_DATA}/outcomes/$(date -u +%Y-%m).jsonl"
119+
# Write outcomes to hypatia's local store (primary) and central store (backup)
120+
OUTCOME_FILE="${HYPATIA_DATA}/outcomes/$(date -u +%Y-%m).jsonl"
121+
OUTCOME_FILE_CENTRAL="${VERISIMDB_DATA}/outcomes/$(date -u +%Y-%m).jsonl"
109122
mkdir -p "$(dirname "$OUTCOME_FILE")"
110123

111124
record_outcome() {
@@ -131,6 +144,10 @@ record_outcome() {
131144
'{pattern_id: $pid, recipe_id: $rid, repo: $repo, file: $file, outcome: $outcome, timestamp: $ts, bot: $bot}')
132145

133146
echo "$json" >> "$OUTCOME_FILE"
147+
# Also write to central store if it exists
148+
if [[ -d "$(dirname "$OUTCOME_FILE_CENTRAL")" ]] || mkdir -p "$(dirname "$OUTCOME_FILE_CENTRAL")" 2>/dev/null; then
149+
echo "$json" >> "$OUTCOME_FILE_CENTRAL"
150+
fi
134151
}
135152

136153
# --- Execute a single manifest entry ---
@@ -324,3 +341,30 @@ if [[ "$DRY_RUN" == "true" ]]; then
324341
echo ""
325342
echo "(Dry run — no changes were made)"
326343
fi
344+
345+
# --- Kin Protocol: write heartbeat ---
346+
KIN_DIR="${HOME}/.hypatia/kin"
347+
mkdir -p "$KIN_DIR"
348+
349+
HEARTBEAT_STATUS="healthy"
350+
[[ "$FAILED" -gt 0 ]] && HEARTBEAT_STATUS="degraded"
351+
352+
cat > "${KIN_DIR}/gitbot-fleet.heartbeat.json" <<HEARTBEAT
353+
{
354+
"kin_id": "gitbot-fleet",
355+
"role": "executor",
356+
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
357+
"status": "${HEARTBEAT_STATUS}",
358+
"version": "0.2.0",
359+
"last_run": {
360+
"total_processed": ${TOTAL},
361+
"executed": ${EXECUTED},
362+
"succeeded": ${SUCCEEDED},
363+
"failed": ${FAILED},
364+
"skipped": ${SKIPPED},
365+
"dry_run": ${DRY_RUN}
366+
},
367+
"errors": [],
368+
"capabilities": ["dispatch", "fix_execute", "pr_create", "review", "advisory"]
369+
}
370+
HEARTBEAT

0 commit comments

Comments
 (0)