diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a16d081..bed8cdac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/project-bin/exec.sh b/project-bin/exec.sh index ae8a503d..c4a721a7 100755 --- a/project-bin/exec.sh +++ b/project-bin/exec.sh @@ -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) ───────────────────────────────────────────────────────── diff --git a/tests/wave2/test-mode-contract.sh b/tests/wave2/test-mode-contract.sh index 812d09fb..1e7bdb9d 100755 --- a/tests/wave2/test-mode-contract.sh +++ b/tests/wave2/test-mode-contract.sh @@ -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/ (../../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 # @@ -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