wip(fleet): F3-m2 native Pi heartbeat + sidecar reconciliation
Some checks failed
ci/woodpecker/push/ci Pipeline was canceled
Some checks failed
ci/woodpecker/push/ci Pipeline was canceled
WIP — not for merge yet. Implements the core of the custom Pi harness (R14/R15): - runtime/pi/mosaic-extension.ts: native heartbeat — writes the same .hb contract (ts/pid/status[/model]) on a MOSAIC_HEARTBEAT_INTERVAL timer; turn_start/turn_end flip status busy/ok; model self-report via ctx.model; touches a .hb.native precedence marker. Also FIXES a latent bug: session_end -> session_shutdown (the old handler never fired) + corrects the import scope to @earendil-works/pi-coding-agent. - start-agent-session.sh: sidecar DEFERS when the .hb.native marker is fresh (< 2x interval), else writes the fallback — native precedence, sidecar fallback, same contract so fleet ps is agnostic (per Lead's design). Generated script validated (bash -n) + deferral/fallback behavior tested. REMAINING before PR: surface model in `fleet ps` (parseHeartbeat + row); vitest for the native-HB writer; "proper tool usage" (registerTool) piece; rebase onto #599's %q sidecar (overlap on the printf line). Refs #588 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -129,7 +129,7 @@ _start_heartbeat_sidecar() {
|
||||
# references to any variables from this script's environment.
|
||||
local sidecar_script
|
||||
sidecar_script=$(printf \
|
||||
'hb=%s; pid=%s; iv=%s; mkdir -p "$(dirname "$hb")"; while kill -0 "$pid" 2>/dev/null; do tmp="$hb.tmp.$$"; printf "ts=%%s\npid=%%s\nstatus=ok\n" "$(date +%%Y-%%m-%%dT%%H:%%M:%%S%%z)" "$pid" > "$tmp" && mv "$tmp" "$hb"; sleep "$iv"; done' \
|
||||
'hb=%s; pid=%s; iv=%s; mkdir -p "$(dirname "$hb")"; while kill -0 "$pid" 2>/dev/null; do nat="$hb.native"; if [ -f "$nat" ] && [ "$(( $(date +%%s) - $(stat -c %%Y "$nat" 2>/dev/null || echo 0) ))" -lt "$(( iv * 2 ))" ]; then sleep "$iv"; continue; fi; tmp="$hb.tmp.$$"; printf "ts=%%s\npid=%%s\nstatus=ok\n" "$(date +%%Y-%%m-%%dT%%H:%%M:%%S%%z)" "$pid" > "$tmp" && mv "$tmp" "$hb"; sleep "$iv"; done' \
|
||||
"$hb_file" "$pane_pid" "$interval")
|
||||
|
||||
# setsid + disown ensures the sidecar survives this script exiting.
|
||||
|
||||
Reference in New Issue
Block a user