fix(issue-23-24): merge review - the environment form of the auto-trust switch reaches the handler; a rate-limited dialog does not hide the next one

Two probes from the merge-side codex review (its report was lost to an API
outage; the probes and their results were recovered from its transcript):

- create_session.sh and resume_session.sh set AUTO_TRUST=1 and then
  exported MAM_AUTO_TRUST from it, so the documented MAM_AUTO_TRUST=0
  without a flag reached handle_startup_dialogs as 1: the operator had
  turned automatic trust off and it stayed on. Now AUTO_TRUST defaults to
  the environment value and an explicit --auto-trust/--no-auto-trust wins.
- _mam_dialog_pick exited on the first dialog inside its resend cooldown
  instead of looking further down the screen, so a skipped (--no-auto-trust)
  or just-answered trust prompt hid the codex update notice below it, which
  the docs say is always answered. It continues to the next dialog now; S5
  and S5b (one send per cooldown, one retry after it) still hold.

Regressions: S6c, S5f (startup path), R3b and C3 (resume/create, env only,
flag over env). Each fails without the fix. The create skill doc names the
environment form and its precedence.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VCgu9Fa9iT7TbJUSzdq4Ff
This commit is contained in:
GodopuandClaude Fable 5.1 committed 2026-09-24 06:47:57 +09:00
1 parent f4ba205c9f
commit 05b0ea4762
6 files changed
+76 -5

No files matched your search

+4 -1
View File
@@ -2952,7 +2952,10 @@ for idx, entry in enumerate(dialogs):
continue
last = state.get(idx)
if last is not None and 0 <= now - last < cooldown:
sys.exit(1)
# rate-limited: look at the other dialogs on this screen instead of
# giving up (merge review, codex probe: a skipped trust prompt or a
# freshly answered one used to hide the notice below it)
continue
if kind == "trust" and not auto_trust:
print("skip|%d|" % idx)
sys.exit(0)
@@ -116,7 +116,8 @@ The bootstrapped server receives a **sanitized copy of the caller's environment*
blocking-modal signatures and their accept keys live in each agent adapter
(`lib_py/agents/adapters/*.py`, published as `MAM_STARTUP_DIALOGS`), and they
are answered while waiting for the TUI rather than after it. `--no-auto-trust`
leaves directory-trust dialogs for a human to accept and still answers other
(or `MAM_AUTO_TRUST=0` in the environment; an explicit flag wins over the
environment) leaves directory-trust dialogs for a human to accept and still answers other
blocking notices (for example codex's update prompt, where Skip changes
nothing). Trust matters most for **codex**: trusting a directory makes it load
that project's local config, hooks and exec policy, so `--no-auto-trust` is the
@@ -66,8 +66,10 @@ ONBOARD=1
# Issue #24: answer a start-up directory-trust dialog for the --workspace the
# operator named. --no-auto-trust leaves those unanswered (notices are always
# answered); codex in particular loads project-local config, hooks and exec
# policy once trusted.
AUTO_TRUST=1
# policy once trusted. MAM_AUTO_TRUST=0 in the environment is the same switch
# (the skill docs say so); an explicit --auto-trust/--no-auto-trust wins over it
# (merge review, codex probe: the export below used to overwrite the caller's 0).
AUTO_TRUST="${MAM_AUTO_TRUST:-1}"
while [ $# -gt 0 ]; do
case "$1" in
@@ -30,7 +30,7 @@ DRY_RUN=0
# Issue #24: a resumed CLI shows the same directory-trust dialog as a fresh
# one, so resume takes the same switch as create (MAM_AUTO_TRUST is what
# handle_startup_dialogs reads).
AUTO_TRUST=1
AUTO_TRUST="${MAM_AUTO_TRUST:-1}" # the environment form of the same switch; a flag wins
while [ $# -gt 0 ]; do
case "$1" in