Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are. Named m
`docs/RELEASE-PROCESS.md` §8.

## Unreleased
- fix(exec): **`exec.sh` called by relative paths from another folder no longer skips the plan rule**: `_XD="${0%/*}"` stayed relative (`../../bin`), and after exec.sh's `cd` to the project root the guard `[ -f "$_XD/_position.sh" ]` failed in silence, so `cd apps/Orders && ../../bin/exec.sh ../../mdlsource/x.mdl` wrote under `Interview mode: auto` where the same call by absolute path was refused; a relative MDL script path broke every `[ -f "$SCRIPT" ]` guard the same way. Both are made absolute before the `cd`, only when the caller is not at the project root (a run from the root is unchanged). Arguments passed through to a `--patch` script are still taken as given. Fixture `test-mode-contract.sh` X — independent review of #789

## v2026.11.17
- fix(exec, ready, gate-check): **unattended mode is recognised by its first word, and an agent cannot approve its own skipped plan** (composition review of the entry-mode PRs): one helper, `mxtk_auto_word` (`project-bin/_position.sh`), now decides "is this Interview mode unattended" for `exec.sh`, `gate-check.sh --adopt` and `ready.sh` — a register line `Interview mode: auto (gate questions go to questions.md …)` was read as attended by the first two, and in a field smoke run the second write of an unattended build got past the plan rule on refuse-once. `ready.sh` reports NOT READY (row `adoption`, named in the evidence file) while any `consentBy: auto-mode` adoption row is unconfirmed — the ✋ only failed Stage 6, which ready.sh does not run before the register reaches Stage 6. Auto is now the STRICTEST of `$CLAUDE_INTERVIEW_MODE`, `.claude/.interview-mode` and the register line, so `CLAUDE_INTERVIEW_MODE=steering` no longer overrides a register that says auto (intended: an override must not quietly switch the unattended guards off). Under auto, a project with no `Entry mode:` is refused like a pipeline mode until build-ready passes or it adopts (attended: banner only, as before). Checkpoint skills no longer describe greenfield as a live mode. Fixtures: `test-mode-contract.sh` W and U, `test-ready.sh` R4 — composition review of #790–#792, Nov 2026
Expand Down
11 changes: 11 additions & 0 deletions project-bin/exec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,17 @@ if [ -n "$CHANGE_CLASS" ]; then
fi
fi

# Paths taken relative to the CALLER's folder stop resolving at the cd below. `cd apps/Orders &&
# ../../bin/exec.sh ../../mdlsource/x.mdl` left _XD="../../bin", so the plan-rule guard
# `[ -f "$_XD/_position.sh" ]` failed in silence and an unattended write went through, while the
# same call by absolute path was refused (review of #789). The script path was used the same way
# by every [ -f "$SCRIPT" ] guard after the cd. Both are made absolute HERE, and only when the
# caller is not already at the project root, so a run from the root prints what it always did.
if [ "$PWD" != "$PROJECT_ROOT" ]; then
case "$_XD" in /*) ;; *) _XD="$(cd "$_XD" && pwd)" ;; esac
case "$SCRIPT" in /*) ;; *) [ -f "$SCRIPT" ] && SCRIPT="$(cd "$(dirname "$SCRIPT")" && pwd)/$(basename "$SCRIPT")" ;; esac
fi

cd "$PROJECT_ROOT"

# ── Build log (auto) ─────────────────────────────────────────────────────────
Expand Down
23 changes: 23 additions & 0 deletions tests/wave2/test-mode-contract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
# W `Interview mode: auto (...)` / `unattended — ...` read as auto (first word) in exec.sh and
# in gate-check.sh's --adopt ✋ check; `autopilot` is not
# U no Entry mode under auto is refused every write; attended keeps the banner only
# X exec.sh called by relative paths from inside apps/<App> (../../bin/exec.sh
# ../../mdlsource/x.mdl) is refused under auto exactly as the absolute call is
# G init-project.sh over a hand-written PROJECT.md appends Current stage, Decisions, Open
# questions and Change log, says so, and keeps the hand-written lines
#
Expand Down Expand Up @@ -110,6 +112,27 @@ G="$("$GC" "$P" 2>&1)"
n="$(printf '%s\n' "$G" | grep -cE '^Stage [0-4] .*not owed \(mode: Build type: poc\)|^Stage [67] .*not owed \(mode: Build type: poc\)')"
[ "$n" = 7 ] && ok "K stages 0-4, 6, 7 not owed (mode) — 7 of 7" || bad "K stages 0-4, 6, 7 not owed (mode)" "$n of 7"

echo "-- X: exec.sh called by RELATIVE paths from inside an app folder (review of #789)"
# _XD="${0%/*}" was relative (../../bin); after exec.sh's cd to the project root the plan-rule
# guard [ -f "$_XD/_position.sh" ] failed in silence and the unattended write went through, while
# the same call by absolute path was refused. A relative script path broke the same way.
# runat <cwd> <exec> <script> -> OUT, CALLS_N
runat() {
rm -rf "$P/docs" "$WORK/calls"
( cd "$1" && CALLS="$WORK/calls" SP_RESTART=0 MXTK_NO_INSTALL=1 SKIP_DOCTOR=1 TMPDIR="$WORK" \
bash "$2" "$3" ) >"$WORK/out" 2>&1
OUT="$(cat "$WORK/out")"
CALLS_N="$(grep -c check "$WORK/calls" 2>/dev/null)"; CALLS_N="${CALLS_N:-0}"
}
mkproj multi "Entry mode: requirements-driven"
printf 'Interview mode: auto\n' >> "$P/PROJECT.md"
runat "$P/apps/Orders" ../../bin/exec.sh ../../mdlsource/01-thing.mdl
autorefused && ok "X relative exec + script from apps/Orders → refused" || bad "X relative exec + script from apps/Orders → refused" "calls=$CALLS_N"
runat "$P/apps/Orders" "$P/bin/exec.sh" "$P/mdlsource/01-thing.mdl"
autorefused && ok "X the same call by absolute paths → refused" || bad "X absolute paths → refused" "calls=$CALLS_N"
mkdir -p "$P/.mpr-snapshots"; printf 'build-ready PASS\n' > "$P/.mpr-snapshots/.build-ready-pass"
runat "$P/apps/Orders" ../../bin/exec.sh ../../mdlsource/01-thing.mdl
passed && ok "X after build-ready the relative call reaches the check (the script resolved)" || bad "X relative call after build-ready" "calls=$CALLS_N"
echo "-- W: auto read by its first word, not the exact value (one helper: mxtk_auto_word)"
# Field smoke run: `Interview mode: auto (gate questions go to questions.md ...)` was read as attended,
# so the second write got past the plan rule on refuse-once.
Expand Down
Loading