fix: preserve deployed session fixes

Persist paged Codex history checkpoints and bounded, acknowledged delivery.
Keep usage sources and accounting across deleted or merged sessions.
Include native Goal controls, faster peer/session queries, and release guards.
Track the complete deployed source so isolated builds cannot omit local fixes.

Validation: all typechecks pass. The full suite reports 7,997 passing tests
and 46 existing failures, each reproduced against the prior commit.
This commit is contained in:
2026-10-08 19:51:45 +08:00
parent 4d8a72c146
commit baeeb11356
85 changed files with 3647 additions and 691 deletions
+5
View File
@@ -26,6 +26,8 @@ if [ ! -x "$build" ]; then
exit 1
fi
bash scripts/verify-deploy-build.sh "$build"
mkdir -p "$bin_dir" "$backup_dir"
bash scripts/sign-build.sh "$build"
@@ -82,6 +84,9 @@ echo "health ok"
# Refresh the runner so its machine RPCs/capabilities match the new binary.
# Compiled binaries never self-update: the heartbeat mtime check compares the
# runner's own resolved exec path, which is fixed for the life of the process.
# The runner also inherits this shell's environment. Keep the full login PATH;
# scope temporary transfer-tool PATH overrides to the remote deploy command.
# A healthy hub does not prove the runner can resolve installed agent binaries.
runner_state="$HOME/.hapi/runner.state.json"
runner_pid=$(sed -n 's/.*"pid": *\([0-9][0-9]*\).*/\1/p' "$runner_state" 2>/dev/null | head -n 1 || true)
if [ -n "${runner_pid:-}" ] && kill -0 "$runner_pid" 2>/dev/null; then
+12 -1
View File
@@ -32,6 +32,8 @@ if [ ! -x "$build" ]; then
exit 1
fi
bash scripts/verify-deploy-build.sh "$build"
# Sign locally with the pinned identity so the remote keeps a stable signer.
bash scripts/sign-build.sh "$build"
@@ -48,7 +50,16 @@ echo "release: $stamp${tag:+-$tag}"
# Upload next to the fixed path, then install by move (fresh inode + mtime).
ssh "${ssh_opts[@]}" "$target" "mkdir -p '$remote_home/.hapi/bin/backups'"
scp -q -C "${ssh_opts[@]}" "$build" "$target:$remote_home/.hapi/bin/.hapi.incoming"
if command -v rsync >/dev/null 2>&1 && ssh "${ssh_opts[@]}" "$target" 'command -v rsync >/dev/null 2>&1'; then
# Seed the staging file from the installed binary so rsync can reuse its
# unchanged blocks. Only staging is modified; installation stays atomic.
ssh "${ssh_opts[@]}" "$target" "if [ ! -f '$remote_home/.hapi/bin/.hapi.incoming' ] && [ -f '$remote_home/.hapi/bin/hapi' ]; then cp -p '$remote_home/.hapi/bin/hapi' '$remote_home/.hapi/bin/.hapi.incoming'; fi"
rsync -az --no-whole-file --inplace --stats \
-e 'ssh -o BatchMode=yes -o ConnectTimeout=10' \
"$build" "$target:$remote_home/.hapi/bin/.hapi.incoming"
else
scp -q -C "${ssh_opts[@]}" "$build" "$target:$remote_home/.hapi/bin/.hapi.incoming"
fi
ssh "${ssh_opts[@]}" "$target" "STAMP='$stamp' TAG='$tag' LABEL='$label' bash -s" <<'REMOTE'
set -euo pipefail
+27
View File
@@ -0,0 +1,27 @@
#!/bin/bash
# Reject release artifacts that omit locally required fixes before installing.
# An isolated checkout can build successfully while excluding uncommitted work.
set -euo pipefail
build=${1:?usage: verify-deploy-build.sh <binary>}
if [ ! -f "$build" ]; then
echo "error: release artifact missing: $build" >&2
exit 1
fi
# These wire/error/SQL literals survive the all-in-one bundle's minification.
# Check the artifact, not its version: local builds can share a version number.
for marker in \
'codex-history-sync' \
'codex_history_epochs' \
'History batch was not confirmed' \
'Transcript delivery unconfirmed' \
'usage_session_sources'; do
if ! LC_ALL=C grep -aqF -- "$marker" "$build"; then
echo "error: release artifact omits required feature: $marker" >&2
echo "error: rebuild from the complete deployment workspace, including untracked source files" >&2
exit 1
fi
done
echo "release features ok: durable Codex history, confirmed delivery, persistent usage"