← back to Ticket System
enforce zero-cost DTD across child processes
a1f7d32e26c4a11cc13e415e724d6a74ddeb9089 · 2026-09-03 07:15:00 -0700 · Steve Abrams
Files touched
A config/dtd-cost-modeM config/yoloforever-dtd-sha256.tsvM data/codex-yoloforever/STOPPEDM scripts/codex-yoloforever-prompt.mdM scripts/codex-yoloforever.shM scripts/verify-zero-cost-dtd.shM test/yoloforever-zero-cost-dtd.sh
Diff
commit a1f7d32e26c4a11cc13e415e724d6a74ddeb9089
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Thu Sep 3 07:15:00 2026 -0700
enforce zero-cost DTD across child processes
---
config/dtd-cost-mode | 1 +
config/yoloforever-dtd-sha256.tsv | 6 +++---
data/codex-yoloforever/STOPPED | 2 +-
scripts/codex-yoloforever-prompt.md | 2 +-
scripts/codex-yoloforever.sh | 5 +++--
scripts/verify-zero-cost-dtd.sh | 23 +++++++++++++++++++++++
test/yoloforever-zero-cost-dtd.sh | 25 +++++++++++++++++++------
7 files changed, 51 insertions(+), 13 deletions(-)
diff --git a/config/dtd-cost-mode b/config/dtd-cost-mode
new file mode 100644
index 00000000..7a8937b7
--- /dev/null
+++ b/config/dtd-cost-mode
@@ -0,0 +1 @@
+ZERO_COST_REQUIRED
diff --git a/config/yoloforever-dtd-sha256.tsv b/config/yoloforever-dtd-sha256.tsv
index d8968301..2aeb8429 100644
--- a/config/yoloforever-dtd-sha256.tsv
+++ b/config/yoloforever-dtd-sha256.tsv
@@ -1,3 +1,3 @@
-agents_panel ef59033e6cd1423568099bed98080438d88a63de86ccb4acda4ba1d9e21bb042
-agents_post 622affd2a7e1abd74e07371e0ce5169f4b1f120a0c8be31a150e40f00a9115a9
-claude_panel 863910ebbc3ac617cf26889c78ba07c7ff5763b4ca0a8df3cef997d3d9c65430
+agents_panel c24e4ccdd8b2ea3b02cb4daaef27188fe50008788445593daa410864f0f346e3
+agents_post b5613185dc39b1f66dc889106c519646ab24ce52a280066d5ac2ab53dd3cdcab
+claude_panel d1cac86ad432fe2afb9457e54d2cdcacd834643290a22850718dbf304ff19aac
diff --git a/data/codex-yoloforever/STOPPED b/data/codex-yoloforever/STOPPED
index 4d6e02e8..5c616360 100644
--- a/data/codex-yoloforever/STOPPED
+++ b/data/codex-yoloforever/STOPPED
@@ -1 +1 @@
-2026-09-03T09:39:25Z
+2026-09-03T14:14:29Z
diff --git a/scripts/codex-yoloforever-prompt.md b/scripts/codex-yoloforever-prompt.md
index 61c34bc2..b56989fc 100644
--- a/scripts/codex-yoloforever-prompt.md
+++ b/scripts/codex-yoloforever-prompt.md
@@ -1,6 +1,6 @@
You are one bounded cycle of Steve's unattended `/yoloforever` open-ticket loop. Use Codex only; never invoke `claude`, `claude -p`, or the remote Claude YOLO service. Steve explicitly approved dangerous mode for this overnight loop and prefers persistent option #2 / Always Allow for safe tool approvals. This changes tool-confirmation friction only; it does not widen the HARD GATES below.
-The runner sets `DTD_ZERO_COST=1`. Do not unset, override, bypass, or launch a child without this inherited value. In this mode DTD may use only Codex CLI and local model endpoints; provider API keys and paid HTTP endpoints are forbidden.
+The runner sets `DTD_ZERO_COST=1` and requires the filesystem guard at `/Users/macstudio3/Projects/ticket-system/config/dtd-cost-mode` to contain `ZERO_COST_REQUIRED`. Do not unset, override, bypass, remove, or rewrite either control. Before delegating, tell the child to verify the guard; environment inheritance alone is not proof. The installed DTD entry points must force zero-cost from the guard even when a child lacks `DTD_ZERO_COST`. DTD may use only Codex CLI and local model endpoints; provider API keys and paid HTTP endpoints are forbidden.
This cycle has a maximum of six execution iterations and must terminate cleanly so launchd can schedule the next cycle. Follow `/yoloforever`, `/ticketmaster`, `/dtd`, `/contrarian` (Cody), `/a2a-contract`, and `/e2e-proof` exactly. Read each selected skill's complete SKILL.md before acting.
diff --git a/scripts/codex-yoloforever.sh b/scripts/codex-yoloforever.sh
index d3b4804a..bddd4b17 100755
--- a/scripts/codex-yoloforever.sh
+++ b/scripts/codex-yoloforever.sh
@@ -12,6 +12,7 @@ ERR_FILE="$ROOT/codex-yoloforever.err.log"
LAST_MESSAGE="$STATE_DIR/last-message.md"
CODEX="/Users/macstudio3/.local/bin/codex"
PREFLIGHT="$ROOT/scripts/verify-zero-cost-dtd.sh"
+DTD_COST_MODE_FILE="$ROOT/config/dtd-cost-mode"
PLIST="$ROOT/com.steve.codex-yoloforever.plist"
DOMAIN="gui/$(id -u)"
LAUNCHCTL="launchctl"
@@ -69,7 +70,7 @@ run_cycle() {
trap 'rm -f "$LOCK_DIR/pid" "$LOCK_DIR/started-at"; rmdir "$LOCK_DIR" 2>/dev/null || true' EXIT INT TERM HUP
print "$(date -u +%FT%TZ) cycle begin pid=$$ engine=codex" >> "$LOG_FILE"
- if ! DTD_ZERO_COST=1 "$PREFLIGHT" "${PREFLIGHT_ARGS[@]}" > "$STATE_DIR/zero-cost-preflight.log" 2>&1; then
+ if ! DTD_ZERO_COST=1 DTD_COST_MODE_FILE="$DTD_COST_MODE_FILE" "$PREFLIGHT" "${PREFLIGHT_ARGS[@]}" > "$STATE_DIR/zero-cost-preflight.log" 2>&1; then
date -u +%FT%TZ > "$STOP_FILE"
"$LAUNCHCTL" disable "$DOMAIN/$LABEL" >/dev/null 2>&1 || true
print "$(date -u +%FT%TZ) safety tripwire: zero-cost DTD preflight failed; runner disabled" >> "$LOG_FILE"
@@ -78,7 +79,7 @@ run_cycle() {
return 78
fi
print "$(date -u +%FT%TZ) zero-cost DTD preflight PASS" >> "$LOG_FILE"
- DTD_ZERO_COST=1 TK_AGENT=codex-yoloforever "$CODEX" exec \
+ DTD_ZERO_COST=1 DTD_COST_MODE_FILE="$DTD_COST_MODE_FILE" TK_AGENT=codex-yoloforever "$CODEX" exec \
--dangerously-bypass-approvals-and-sandbox \
--cd /Users/macstudio3 \
--add-dir /private/tmp \
diff --git a/scripts/verify-zero-cost-dtd.sh b/scripts/verify-zero-cost-dtd.sh
index 71be5477..d4b1e7b5 100755
--- a/scripts/verify-zero-cost-dtd.sh
+++ b/scripts/verify-zero-cost-dtd.sh
@@ -6,10 +6,16 @@ AGENTS_POST="${2:-/Users/macstudio3/.agents/skills/dtd/scripts/post-decision-cod
CLAUDE_PANEL="${3:-/Users/macstudio3/.claude/skills/dtd/scripts/panel.sh}"
PROJECT_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)
MANIFEST="${4:-$PROJECT_ROOT/config/yoloforever-dtd-sha256.tsv}"
+DTD_COST_MODE_FILE="${DTD_COST_MODE_FILE:-$PROJECT_ROOT/config/dtd-cost-mode}"
TMP=$(mktemp -d /private/tmp/yoloforever-zero-cost-preflight.XXXXXX)
trap 'rm -rf "$TMP"' EXIT
[[ -f "$MANIFEST" ]] || { echo "missing DTD hash manifest: $MANIFEST" >&2; exit 1; }
+[[ -r "$DTD_COST_MODE_FILE" ]] || { echo "missing/unreadable DTD cost-mode guard: $DTD_COST_MODE_FILE" >&2; exit 1; }
+[[ "$(tr -d '[:space:]' < "$DTD_COST_MODE_FILE")" == ZERO_COST_REQUIRED ]] || {
+ echo "DTD cost-mode guard must be ZERO_COST_REQUIRED" >&2
+ exit 1
+}
verify_hash() {
local key="$1" script="$2" expected actual matches
@@ -71,6 +77,7 @@ export PATH="$TMP/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export HOME="$TMP/home"
export DTD_PREFLIGHT_CALLS="$TMP/calls.log"
export DTD_ZERO_COST=1
+export DTD_COST_MODE_FILE
export OPENAI_API_KEY=poison-env-openai
export XAI_API_KEY=poison-env-xai
export MOONSHOT_API_KEY=poison-env-moonshot
@@ -81,9 +88,25 @@ bash "$AGENTS_POST" "$TMP/agents" A >/dev/null
DTD_DIR="$TMP/legacy" bash "$CLAUDE_PANEL" "Choose A or B" >/dev/null
[[ -s "$TMP/legacy/codex.txt" ]]
+# Reproduce the original delegation failure: a child shell without DTD_ZERO_COST.
+# The filesystem guard must still prevent every paid command and endpoint.
+unset DTD_ZERO_COST
+DTD_DIR="$TMP/env-unset-agents" bash "$AGENTS_PANEL" "Choose A or B" >/dev/null
+bash "$AGENTS_POST" "$TMP/env-unset-agents" A >/dev/null
+DTD_DIR="$TMP/env-unset-legacy" bash "$CLAUDE_PANEL" "Choose A or B" >/dev/null
+
if grep -Eq 'CLAUDE|api\.openai\.com|api\.x\.ai|api\.moonshot\.ai' "$TMP/calls.log"; then
echo "zero-cost DTD preflight reached a forbidden command or endpoint" >&2
exit 1
fi
grep -q '^CODEX ' "$TMP/calls.log"
+
+# Missing guard is unsafe and must fail before any provider command.
+: > "$TMP/calls.log"
+set +e
+DTD_COST_MODE_FILE="$TMP/missing-cost-mode" DTD_DIR="$TMP/missing" bash "$AGENTS_PANEL" "Choose A or B" >/dev/null 2>&1
+missing_rc=$?
+set -e
+[[ "$missing_rc" == 78 ]]
+[[ ! -s "$TMP/calls.log" ]]
echo "PASS zero-cost DTD preflight"
diff --git a/test/yoloforever-zero-cost-dtd.sh b/test/yoloforever-zero-cost-dtd.sh
index 8c307f1c..d61533cc 100755
--- a/test/yoloforever-zero-cost-dtd.sh
+++ b/test/yoloforever-zero-cost-dtd.sh
@@ -52,6 +52,7 @@ export OPENAI_API_KEY=poison-env-openai
export XAI_API_KEY=poison-env-xai
export MOONSHOT_API_KEY=poison-env-moonshot
export DTD_ZERO_COST=1
+export DTD_COST_MODE_FILE="$ROOT/config/dtd-cost-mode"
run_panel() {
local script="$1" dir="$2"
@@ -69,16 +70,28 @@ if grep -Eq 'CLAUDE|api\.openai\.com|api\.x\.ai|api\.moonshot\.ai' "$TMP/calls.l
exit 1
fi
grep -q '^CODEX ' "$TMP/calls.log"
-grep -q 'DTD_ZERO_COST=1 TK_AGENT=codex-yoloforever' "$ROOT/scripts/codex-yoloforever.sh"
+grep -q 'DTD_ZERO_COST=1 DTD_COST_MODE_FILE=.*TK_AGENT=codex-yoloforever' "$ROOT/scripts/codex-yoloforever.sh"
grep -q 'Do not unset, override, bypass' "$ROOT/scripts/codex-yoloforever-prompt.md"
: > "$TMP/calls.log"
unset DTD_ZERO_COST
-DTD_DIR="$TMP/agents-normal" bash "$AGENTS_PANEL" "Choose A or B" >/dev/null
-grep -q '^CLAUDE ' "$TMP/calls.log"
-grep -q 'api\.openai\.com' "$TMP/calls.log"
-grep -q 'api\.x\.ai' "$TMP/calls.log"
-grep -q 'api\.moonshot\.ai' "$TMP/calls.log"
+DTD_DIR="$TMP/agents-child-env-unset" bash "$AGENTS_PANEL" "Choose A or B" >/dev/null
+bash "$AGENTS_POST" "$TMP/agents-child-env-unset" A >/dev/null
+DTD_DIR="$TMP/legacy-child-env-unset" bash "$CLAUDE_PANEL" "Choose A or B" >/dev/null
+if grep -Eq 'CLAUDE|api\.openai\.com|api\.x\.ai|api\.moonshot\.ai' "$TMP/calls.log"; then
+ echo "env-unset child reached a forbidden command or endpoint" >&2
+ cat "$TMP/calls.log" >&2
+ exit 1
+fi
+grep -q '^CODEX ' "$TMP/calls.log"
+
+: > "$TMP/calls.log"
+set +e
+DTD_COST_MODE_FILE="$TMP/missing-mode" DTD_DIR="$TMP/missing-mode-run" bash "$AGENTS_PANEL" "Choose A or B" >/dev/null 2>&1
+missing_rc=$?
+set -e
+[[ "$missing_rc" == 78 ]]
+[[ ! -s "$TMP/calls.log" ]]
bash -n "$AGENTS_PANEL" "$AGENTS_POST" "$CLAUDE_PANEL"
zsh -n "$ROOT/scripts/codex-yoloforever.sh"
← e0279491 record zero-cost inheritance tripwire stop
·
back to Ticket System
·
prove both DTD entry points fail closed 8dea1d94 →