fix(aws): stop guard review round 1

The stop guard's choice now reaches the workspace: after a successful
push (or for Stop without pushing) the app records pushed/discard in
/run/triple-c/stop-reason as root, and the entrypoint's shutdown hook
then skips its own push; a marker that can't be written is reported
and the stop goes on. The push runs before the auth bridge is stopped;
a guarded stop of a workspace that already stopped succeeds. The
Fargate table allows only 512/1024/2048 MiB with 256 CPU, pinned on
both sides by a shared fixture. Removal's missing-connection refusal
carries a stable prefix. OpenAI Compatible is allowed on AWS, with a
warning for local addresses and the app's own gateway. HostSection
locks resource actions unless Stopped, the add dialog drops the
environment on a region change, and the repository editor keeps rows
in progress across a refresh.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Opus 5.5 committed 2026-11-15 10:26:53 -08:00
1 parent eb7c6c7b21
commit 8441a096c8
26 files changed
+780 -193

No files matched your search

+13 -5
View File
@@ -1168,7 +1168,9 @@ start_agent
# ── AWS: WIP push on stop, idle auto-stop ───────────────────────────────────
# aws_before_stop runs from the TERM trap below, before the keepalive goes:
# with TRIPLEC_WIP_PUSH=1 it pushes every repo's unsaved work to a
# triple-c/wip/<stamp> branch (as `claude`, bounded at 90 s). ECS gives a task
# triple-c/wip/<stamp> branch (as `claude`, bounded at 90 s), unless the app's
# stop guard recorded `pushed` or `discard` in /run/triple-c/stop-reason
# (written as root through the agent just before StopTask). ECS gives a task
# `stopTimeout` seconds between SIGTERM and SIGKILL — 30 by default, 120 at
# most on Fargate — so the task definition must raise it for the push to
# finish. Once only: a second TERM during the push changes nothing.
@@ -1185,10 +1187,16 @@ aws_before_stop() {
[ "${TRIPLEC_HOST:-}" = aws ] || return 0
[ -z "${triplec_stopping:-}" ] || return 0
triplec_stopping=1
local reason=sigterm
if [ "$(cat /run/triple-c/stop-reason 2>/dev/null)" = idle ]; then
reason=idle
fi
local reason=sigterm recorded
recorded=$(cat /run/triple-c/stop-reason 2>/dev/null)
case "$recorded" in
idle) reason=idle ;;
# The app's stop guard already pushed, or the user chose to stop
# without pushing: honour that instead of pushing again.
pushed|discard)
echo "entrypoint: stopping — work in progress already handled by Triple-C ($recorded); not pushing"
return 0 ;;
esac
if [ "${TRIPLEC_WIP_PUSH:-0}" = 1 ]; then
echo "entrypoint: stopping ($reason) — pushing work in progress..."
_triplec_as_user timeout -k 5 90 /usr/local/bin/triple-c-wip-push --reason "$reason" \