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:
1 parent
f4ba205c9f
commit
05b0ea4762
6 files changed
+76
-5
No files matched your search
@@ -100,6 +100,45 @@ def test_r3_no_auto_trust_reaches_the_dialog_handler(mam_sandbox, mock_herdr, mo
|
||||
assert _calls(log) == ["sess=test-r3-codex timeout=20 agent=codex auto_trust=0"]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("env_value,flag,expected", [
|
||||
("0", (), "0"), # the documented environment form alone
|
||||
("0", ("--auto-trust",), "1"), # an explicit flag wins over the environment
|
||||
("1", ("--no-auto-trust",), "0"),
|
||||
])
|
||||
def test_r3b_the_environment_form_of_the_switch_reaches_the_handler_on_resume(
|
||||
mam_sandbox, mock_herdr, mock_agents, monkeypatch, env_value, flag, expected):
|
||||
"""R3b (merge review, codex probe): MAM_AUTO_TRUST=0 without a flag used to
|
||||
be overwritten by the script's own export of its default."""
|
||||
tmp_path = mam_sandbox
|
||||
ws = _create_and_stop(tmp_path, "codex", "test-r3b-codex")
|
||||
log = _record_dialog_calls(tmp_path)
|
||||
monkeypatch.setenv("MAM_AUTO_TRUST", env_value)
|
||||
res = _resume(tmp_path, "codex", "test-r3b-codex", ws, extra=flag)
|
||||
assert res.returncode == 0, res.stdout + res.stderr
|
||||
assert _calls(log) == ["sess=test-r3b-codex timeout=20 agent=codex auto_trust=%s" % expected]
|
||||
|
||||
|
||||
@pytest.mark.parametrize("env_value,flag,expected", [
|
||||
("0", (), "0"),
|
||||
("0", ("--auto-trust",), "1"),
|
||||
("1", ("--no-auto-trust",), "0"),
|
||||
])
|
||||
def test_c3_the_environment_form_of_the_switch_reaches_the_handler_on_create(
|
||||
mam_sandbox, mock_herdr, mock_agents, monkeypatch, env_value, flag, expected):
|
||||
"""C3 (merge review, codex probe): the same contract on create_session."""
|
||||
tmp_path = mam_sandbox
|
||||
log = _record_dialog_calls(tmp_path)
|
||||
ws = str(tmp_path / "ws_c3")
|
||||
os.makedirs(ws, exist_ok=True)
|
||||
create = _script(tmp_path, SCRIPTS[0])
|
||||
monkeypatch.setenv("MAM_AUTO_TRUST", env_value)
|
||||
res = subprocess.run(["bash", create, "--workspace", ws, "--agent", "codex",
|
||||
"--role", "creator", "--session", "test-c3-codex", "--no-onboard", *flag],
|
||||
cwd=str(tmp_path), capture_output=True, text=True)
|
||||
assert res.returncode == 0, res.stdout + res.stderr
|
||||
assert _calls(log) == ["sess=test-c3-codex timeout=15 agent=codex auto_trust=%s" % expected]
|
||||
|
||||
|
||||
def test_r4_the_shipped_handler_really_runs_for_a_non_claude_resume(
|
||||
mam_sandbox, mock_herdr, mock_agents):
|
||||
"""R4 (no override): with the real handle_startup_dialogs, a codex resume
|
||||
|
||||
Reference in new issue
Block a user