claude-dev-env 8.111.5 → 8.112.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/build-eval/evals/review/README.md +2 -2
- package/.agents/skills/build-eval/evals/review/review_eval_support/account.py +166 -0
- package/.agents/skills/build-eval/evals/review/review_eval_support/config/constants.py +26 -0
- package/.agents/skills/build-eval/evals/review/review_eval_support/execution.py +8 -0
- package/.agents/skills/build-eval/evals/review/test_run.py +261 -0
- package/_shared/advisor/reference/astra-rung.md +13 -5
- package/_shared/advisor/scripts/codex_astra_advisor.py +31 -8
- package/_shared/advisor/scripts/codex_astra_preflight.py +70 -14
- package/_shared/advisor/scripts/config/advisor_scripts_constants/astra_advisor_constants.py +7 -0
- package/_shared/advisor/scripts/tests/test_codex_astra_advisor.py +266 -2
- package/_shared/advisor/scripts/tests/test_codex_astra_preflight.py +114 -8
- package/_shared/pr-loop/scripts/check_convergence.py +5 -1
- package/_shared/pr-loop/scripts/codex_review_account.py +180 -0
- package/_shared/pr-loop/scripts/codex_review_scripts_constants/account_constants.py +28 -0
- package/_shared/pr-loop/scripts/codex_review_scripts_constants/run_constants.py +3 -1
- package/_shared/pr-loop/scripts/run_codex_review.py +144 -15
- package/_shared/pr-loop/scripts/test_check_convergence_codex.py +3 -3
- package/_shared/pr-loop/scripts/test_codex_review_account.py +355 -0
- package/_shared/pr-loop/scripts/test_run_codex_review.py +507 -6
- package/docs/account-broker.md +5 -3
- package/docs/codex-accounts.md +57 -16
- package/docs/rule-guides/question-presentation.md +4 -0
- package/hooks/blocking/final_reply_gate.py +59 -3
- package/hooks/blocking/open_tasks_transcript.py +18 -0
- package/hooks/blocking/test_final_reply_gate.py +160 -0
- package/hooks/features/conduct-gates.md +1 -4
- package/hooks/hooks.json +0 -10
- package/hooks/hooks_constants/final_reply_gate_constants.py +16 -0
- package/hooks/hooks_constants/open_tasks_stop_gate_constants.py +9 -0
- package/package.json +1 -1
- package/rules/question-presentation.md +1 -1
- package/scripts/Sync-RepoMain.ps1 +86 -3
- package/scripts/account_broker.py +50 -25
- package/scripts/account_broker_support.py +54 -3
- package/scripts/codex_account_choice.py +12 -8
- package/scripts/codex_account_chooser.py +110 -0
- package/scripts/codex_account_meters.py +43 -4
- package/scripts/codex_plan_rules.py +156 -0
- package/scripts/dev_env_scripts_constants/account_broker_constants.py +29 -42
- package/scripts/dev_env_scripts_constants/codex_account_constants.py +62 -2
- package/scripts/dev_env_scripts_constants/test_account_broker_constants.py +359 -2
- package/scripts/dev_env_scripts_constants/test_codex_account_constants.py +213 -14
- package/scripts/policy_lint/adapter_configuration.py +0 -5
- package/scripts/policy_lint/config/constants.py +0 -1
- package/scripts/test_account_broker.py +1756 -523
- package/scripts/test_account_broker_support.py +77 -0
- package/scripts/test_codex_account_meters.py +95 -0
- package/scripts/tests/Sync-RepoMain.Tests.ps1 +55 -0
- package/scripts/tests/test_adapter_configuration.py +0 -8
- package/scripts/tests/test_sync_repo_main_mirror.py +60 -0
- package/hooks/blocking/merge_over_review_offer_gate.py +0 -114
- package/hooks/blocking/test_merge_over_review_offer_gate.py +0 -138
- package/hooks/hooks_constants/merge_over_review_offer_gate_constants.py +0 -34
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
"""Behavioral tests for choosing the Codex account a review runs on."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import subprocess
|
|
8
|
+
import sys
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
import pytest
|
|
12
|
+
|
|
13
|
+
SCRIPTS_DIRECTORY = Path(__file__).resolve().parent
|
|
14
|
+
if str(SCRIPTS_DIRECTORY) not in sys.path:
|
|
15
|
+
sys.path.insert(0, str(SCRIPTS_DIRECTORY))
|
|
16
|
+
|
|
17
|
+
import codex_review_account as account
|
|
18
|
+
from codex_review_scripts_constants.account_constants import (
|
|
19
|
+
ACCOUNT_BROKER_CHOOSE_COMMAND,
|
|
20
|
+
ACCOUNT_BROKER_CODEX_PRODUCT,
|
|
21
|
+
ACCOUNT_BROKER_HOME_FLAG,
|
|
22
|
+
ACCOUNT_BROKER_PRODUCT_FLAG,
|
|
23
|
+
ALL_ACCOUNT_BROKER_REQUIRE_TIER_ARGUMENTS,
|
|
24
|
+
ALL_RUN_TIERS,
|
|
25
|
+
BROKER_WAIT_EXIT_CODE,
|
|
26
|
+
NO_ACCOUNT_EXIT_CODE,
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
CODEX_HOME_VARIABLE = "CODEX_HOME"
|
|
30
|
+
ACCOUNT_ENVIRONMENT_VARIABLES = (
|
|
31
|
+
"CODEX_ACCOUNT_PROFILES",
|
|
32
|
+
"CODEX_PROFILES_ROOT",
|
|
33
|
+
"CODEX_WEEKLY_FLOOR_DISABLED",
|
|
34
|
+
"CLAUDE_ACCOUNT_PROFILES",
|
|
35
|
+
"CLAUDE_PROFILES_ROOT",
|
|
36
|
+
)
|
|
37
|
+
NORMAL_ANSWER_REASON = "codex-1 has 62% left"
|
|
38
|
+
WAIT_ANSWER_REASON = "no account has room; next reset at 2026-11-10T00:00:00Z"
|
|
39
|
+
NORMAL_ANSWER_REASON_FOR_DEFAULT_HOME = "default has 62% left"
|
|
40
|
+
FAKE_CODEX_PLAN_VARIABLE = "FAKE_CODEX_PLAN"
|
|
41
|
+
FAKE_CODEX_CREDITS_VARIABLE = "FAKE_CODEX_CREDITS"
|
|
42
|
+
FAKE_CODEX_SCRIPT_NAME = "fake_codex.py"
|
|
43
|
+
WEEKLY_FLOOR_DISABLED_VARIABLE = "CODEX_WEEKLY_FLOOR_DISABLED"
|
|
44
|
+
WINDOWS_LAUNCHER_TEMPLATE = '@"{python}" "{script}" %*'
|
|
45
|
+
POSIX_LAUNCHER_TEMPLATE = '#!/bin/sh\nexec "{python}" "{script}" "$@"'
|
|
46
|
+
FAKE_CODEX_SOURCE = """import json, os, sys
|
|
47
|
+
for each_line in sys.stdin:
|
|
48
|
+
if json.loads(each_line).get("id") == 2:
|
|
49
|
+
window = {"usedPercent": 38, "windowDurationMins": 300}
|
|
50
|
+
limits = {"planType": os.environ["FAKE_CODEX_PLAN"], "primary": window, "secondary": window}
|
|
51
|
+
if os.environ.get("FAKE_CODEX_CREDITS"):
|
|
52
|
+
limits["credits"] = {"hasCredits": True, "unlimited": True, "balance": "12.5"}
|
|
53
|
+
print(json.dumps({"id": 2, "result": {"rateLimits": limits}}), flush=True)
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _answer_text(tier: str, action: str, home: object, reason: object) -> str:
|
|
58
|
+
return json.dumps(
|
|
59
|
+
{
|
|
60
|
+
"decision": {
|
|
61
|
+
"action": action,
|
|
62
|
+
"account": "codex-1",
|
|
63
|
+
"profile": "codex-1",
|
|
64
|
+
"home": home,
|
|
65
|
+
"reason": reason,
|
|
66
|
+
"tier": tier,
|
|
67
|
+
"resets_at": None,
|
|
68
|
+
},
|
|
69
|
+
"accounts": [],
|
|
70
|
+
"state_path": "state.json",
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def test_normal_tier_answer_names_the_home_the_review_runs_on(tmp_path: Path) -> None:
|
|
76
|
+
chosen_home = account.codex_home_from_broker_answer(
|
|
77
|
+
0,
|
|
78
|
+
_answer_text("normal", "run", str(tmp_path / "codex-1"), NORMAL_ANSWER_REASON),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
assert chosen_home == tmp_path / "codex-1"
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def test_wait_answer_refuses_the_review_and_names_the_broker_reason() -> None:
|
|
85
|
+
with pytest.raises(account.CodexAccountUnavailable) as refusal:
|
|
86
|
+
account.codex_home_from_broker_answer(
|
|
87
|
+
BROKER_WAIT_EXIT_CODE,
|
|
88
|
+
_answer_text("wait", "wait", None, WAIT_ANSWER_REASON),
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
assert refusal.value.exit_code == NO_ACCOUNT_EXIT_CODE
|
|
92
|
+
assert WAIT_ANSWER_REASON in refusal.value.reason
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def test_luna_tier_answer_refuses_the_review(tmp_path: Path) -> None:
|
|
96
|
+
with pytest.raises(account.CodexAccountUnavailable) as refusal:
|
|
97
|
+
account.codex_home_from_broker_answer(
|
|
98
|
+
0,
|
|
99
|
+
_answer_text(
|
|
100
|
+
"luna", "run", str(tmp_path / "codex-1"), "codex-1 has 4% left"
|
|
101
|
+
),
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
assert refusal.value.exit_code == NO_ACCOUNT_EXIT_CODE
|
|
105
|
+
assert "codex-1 has 4% left" in refusal.value.reason
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def test_broker_failure_exit_is_reported_with_its_own_exit_code() -> None:
|
|
109
|
+
with pytest.raises(account.CodexAccountUnavailable) as refusal:
|
|
110
|
+
account.codex_home_from_broker_answer(2, "cannot read account list")
|
|
111
|
+
|
|
112
|
+
assert refusal.value.exit_code == 2
|
|
113
|
+
assert "2" in refusal.value.reason
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
@pytest.mark.parametrize(
|
|
117
|
+
"answer_text",
|
|
118
|
+
[
|
|
119
|
+
"",
|
|
120
|
+
"not json",
|
|
121
|
+
"[]",
|
|
122
|
+
"{}",
|
|
123
|
+
'{"decision": "run"}',
|
|
124
|
+
json.dumps({"decision": {"tier": "normal"}}),
|
|
125
|
+
_answer_text("normal", "run", "", NORMAL_ANSWER_REASON),
|
|
126
|
+
_answer_text("normal", "run", None, NORMAL_ANSWER_REASON),
|
|
127
|
+
_answer_text("normal", "run", 7, NORMAL_ANSWER_REASON),
|
|
128
|
+
],
|
|
129
|
+
)
|
|
130
|
+
def test_unusable_answer_refuses_the_review(answer_text: str) -> None:
|
|
131
|
+
with pytest.raises(account.CodexAccountUnavailable) as refusal:
|
|
132
|
+
account.codex_home_from_broker_answer(0, answer_text)
|
|
133
|
+
|
|
134
|
+
assert refusal.value.exit_code == NO_ACCOUNT_EXIT_CODE
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def test_wait_answer_without_a_reason_still_refuses() -> None:
|
|
138
|
+
with pytest.raises(account.CodexAccountUnavailable):
|
|
139
|
+
account.codex_home_from_broker_answer(
|
|
140
|
+
BROKER_WAIT_EXIT_CODE, _answer_text("wait", "wait", None, None)
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def test_broker_path_names_the_script_beside_the_shared_tree() -> None:
|
|
145
|
+
assert account.account_broker_path().is_file()
|
|
146
|
+
assert account.account_broker_path().name == "account_broker.py"
|
|
147
|
+
assert account.account_broker_path().parent.name == "scripts"
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def test_broker_command_asks_for_the_codex_choice() -> None:
|
|
151
|
+
assert account.broker_choose_command() == [
|
|
152
|
+
sys.executable,
|
|
153
|
+
str(account.account_broker_path()),
|
|
154
|
+
ACCOUNT_BROKER_CHOOSE_COMMAND,
|
|
155
|
+
ACCOUNT_BROKER_PRODUCT_FLAG,
|
|
156
|
+
ACCOUNT_BROKER_CODEX_PRODUCT,
|
|
157
|
+
*ALL_ACCOUNT_BROKER_REQUIRE_TIER_ARGUMENTS,
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def test_home_check_command_names_the_home_and_requires_no_tier(tmp_path: Path) -> None:
|
|
162
|
+
assert account.broker_home_check_command(str(tmp_path)) == [
|
|
163
|
+
sys.executable,
|
|
164
|
+
str(account.account_broker_path()),
|
|
165
|
+
ACCOUNT_BROKER_CHOOSE_COMMAND,
|
|
166
|
+
ACCOUNT_BROKER_PRODUCT_FLAG,
|
|
167
|
+
ACCOUNT_BROKER_CODEX_PRODUCT,
|
|
168
|
+
ACCOUNT_BROKER_HOME_FLAG,
|
|
169
|
+
str(tmp_path),
|
|
170
|
+
]
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def test_luna_answer_is_accepted_when_the_caller_allows_every_run_tier(
|
|
174
|
+
tmp_path: Path,
|
|
175
|
+
) -> None:
|
|
176
|
+
chosen_home = account.codex_home_from_broker_answer(
|
|
177
|
+
0,
|
|
178
|
+
_answer_text("luna", "run", str(tmp_path / "codex-1"), "codex-1 has 4% left"),
|
|
179
|
+
ALL_RUN_TIERS,
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
assert chosen_home == tmp_path / "codex-1"
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
def test_wait_answer_is_refused_even_when_the_caller_allows_every_run_tier() -> None:
|
|
186
|
+
with pytest.raises(account.CodexAccountUnavailable):
|
|
187
|
+
account.codex_home_from_broker_answer(
|
|
188
|
+
BROKER_WAIT_EXIT_CODE,
|
|
189
|
+
_answer_text("wait", "wait", None, WAIT_ANSWER_REASON),
|
|
190
|
+
ALL_RUN_TIERS,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def _install_fake_codex(directory: Path) -> None:
|
|
195
|
+
script = directory / FAKE_CODEX_SCRIPT_NAME
|
|
196
|
+
script.write_text(FAKE_CODEX_SOURCE, encoding="utf-8")
|
|
197
|
+
if os.name == "nt":
|
|
198
|
+
launcher = directory / "codex.cmd"
|
|
199
|
+
launcher.write_text(
|
|
200
|
+
WINDOWS_LAUNCHER_TEMPLATE.format(python=sys.executable, script=script),
|
|
201
|
+
encoding="utf-8",
|
|
202
|
+
)
|
|
203
|
+
return
|
|
204
|
+
launcher = directory / "codex"
|
|
205
|
+
launcher.write_text(
|
|
206
|
+
POSIX_LAUNCHER_TEMPLATE.format(python=sys.executable, script=script),
|
|
207
|
+
encoding="utf-8",
|
|
208
|
+
)
|
|
209
|
+
launcher.chmod(0o755)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def _run_broker_without_a_roster(
|
|
213
|
+
tmp_path: Path,
|
|
214
|
+
fake_plan: str | None,
|
|
215
|
+
*,
|
|
216
|
+
is_home_check: bool = False,
|
|
217
|
+
extra_environment: dict[str, str] | None = None,
|
|
218
|
+
) -> tuple[subprocess.CompletedProcess[str], Path]:
|
|
219
|
+
isolated_home = tmp_path / "home"
|
|
220
|
+
isolated_home.mkdir()
|
|
221
|
+
default_home = tmp_path / "default-codex-home"
|
|
222
|
+
default_home.mkdir()
|
|
223
|
+
codex_directory = tmp_path / "codex-bin"
|
|
224
|
+
codex_directory.mkdir()
|
|
225
|
+
if fake_plan is not None:
|
|
226
|
+
_install_fake_codex(codex_directory)
|
|
227
|
+
broker_environment = {
|
|
228
|
+
each_name: each_setting
|
|
229
|
+
for each_name, each_setting in os.environ.items()
|
|
230
|
+
if each_name not in ACCOUNT_ENVIRONMENT_VARIABLES
|
|
231
|
+
}
|
|
232
|
+
broker_environment.update(
|
|
233
|
+
{
|
|
234
|
+
"HOME": str(isolated_home),
|
|
235
|
+
"USERPROFILE": str(isolated_home),
|
|
236
|
+
"PATH": str(codex_directory),
|
|
237
|
+
CODEX_HOME_VARIABLE: str(default_home),
|
|
238
|
+
FAKE_CODEX_PLAN_VARIABLE: fake_plan or "",
|
|
239
|
+
**(extra_environment or {}),
|
|
240
|
+
}
|
|
241
|
+
)
|
|
242
|
+
broker_command = (
|
|
243
|
+
account.broker_home_check_command(str(default_home))
|
|
244
|
+
if is_home_check
|
|
245
|
+
else account.broker_choose_command()
|
|
246
|
+
)
|
|
247
|
+
completed = subprocess.run(
|
|
248
|
+
broker_command,
|
|
249
|
+
capture_output=True,
|
|
250
|
+
text=True,
|
|
251
|
+
check=False,
|
|
252
|
+
timeout=60,
|
|
253
|
+
env=broker_environment,
|
|
254
|
+
)
|
|
255
|
+
return completed, default_home
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def test_broker_answer_with_no_roster_reads_the_default_home_and_accepts_a_paid_plan(
|
|
259
|
+
tmp_path: Path,
|
|
260
|
+
) -> None:
|
|
261
|
+
completed, default_home = _run_broker_without_a_roster(tmp_path, "team")
|
|
262
|
+
|
|
263
|
+
chosen_home = account.codex_home_from_broker_answer(
|
|
264
|
+
completed.returncode, completed.stdout
|
|
265
|
+
)
|
|
266
|
+
answer = json.loads(completed.stdout)
|
|
267
|
+
assert chosen_home == default_home.resolve()
|
|
268
|
+
assert answer["decision"]["tier"] == "normal"
|
|
269
|
+
assert answer["decision"]["reason"] == NORMAL_ANSWER_REASON_FOR_DEFAULT_HOME
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
def test_broker_answer_with_no_roster_refuses_a_free_default_home(
|
|
273
|
+
tmp_path: Path,
|
|
274
|
+
) -> None:
|
|
275
|
+
completed, _ = _run_broker_without_a_roster(tmp_path, "free")
|
|
276
|
+
|
|
277
|
+
with pytest.raises(account.CodexAccountUnavailable) as refusal:
|
|
278
|
+
account.codex_home_from_broker_answer(completed.returncode, completed.stdout)
|
|
279
|
+
|
|
280
|
+
assert completed.returncode == BROKER_WAIT_EXIT_CODE
|
|
281
|
+
assert refusal.value.exit_code == NO_ACCOUNT_EXIT_CODE
|
|
282
|
+
assert "free" in refusal.value.reason
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
@pytest.mark.parametrize("fake_plan", ("free_works", "free trial"))
|
|
286
|
+
def test_broker_answer_with_no_roster_refuses_a_default_home_on_an_unrecognised_plan(
|
|
287
|
+
tmp_path: Path, fake_plan: str
|
|
288
|
+
) -> None:
|
|
289
|
+
completed, _ = _run_broker_without_a_roster(tmp_path, fake_plan)
|
|
290
|
+
|
|
291
|
+
with pytest.raises(account.CodexAccountUnavailable) as refusal:
|
|
292
|
+
account.codex_home_from_broker_answer(completed.returncode, completed.stdout)
|
|
293
|
+
|
|
294
|
+
assert completed.returncode == BROKER_WAIT_EXIT_CODE
|
|
295
|
+
assert refusal.value.exit_code == NO_ACCOUNT_EXIT_CODE
|
|
296
|
+
assert "reports no known plan and is never chosen" in refusal.value.reason
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def test_exported_home_check_refuses_a_home_on_an_unrecognised_plan(tmp_path: Path) -> None:
|
|
300
|
+
completed, _ = _run_broker_without_a_roster(tmp_path, "free_works", is_home_check=True)
|
|
301
|
+
|
|
302
|
+
with pytest.raises(account.CodexAccountUnavailable) as refusal:
|
|
303
|
+
account.codex_home_from_broker_answer(
|
|
304
|
+
completed.returncode, completed.stdout, ALL_RUN_TIERS
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
assert completed.returncode == BROKER_WAIT_EXIT_CODE
|
|
308
|
+
assert refusal.value.exit_code == NO_ACCOUNT_EXIT_CODE
|
|
309
|
+
assert "reports no known plan and is never chosen" in refusal.value.reason
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
def test_exported_home_check_does_not_let_credits_or_the_floor_switch_unlock_an_unrecognised_plan(
|
|
313
|
+
tmp_path: Path,
|
|
314
|
+
) -> None:
|
|
315
|
+
completed, _ = _run_broker_without_a_roster(
|
|
316
|
+
tmp_path,
|
|
317
|
+
"free_works",
|
|
318
|
+
is_home_check=True,
|
|
319
|
+
extra_environment={
|
|
320
|
+
FAKE_CODEX_CREDITS_VARIABLE: "1",
|
|
321
|
+
WEEKLY_FLOOR_DISABLED_VARIABLE: "1",
|
|
322
|
+
},
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
with pytest.raises(account.CodexAccountUnavailable) as refusal:
|
|
326
|
+
account.codex_home_from_broker_answer(
|
|
327
|
+
completed.returncode, completed.stdout, ALL_RUN_TIERS
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
assert completed.returncode == BROKER_WAIT_EXIT_CODE
|
|
331
|
+
assert "reports no known plan and is never chosen" in refusal.value.reason
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
def test_exported_home_check_accepts_a_home_on_a_paid_plan(tmp_path: Path) -> None:
|
|
335
|
+
completed, default_home = _run_broker_without_a_roster(
|
|
336
|
+
tmp_path, "plus", is_home_check=True
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
chosen_home = account.codex_home_from_broker_answer(
|
|
340
|
+
completed.returncode, completed.stdout, ALL_RUN_TIERS
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
assert chosen_home == default_home.resolve()
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
def test_broker_answer_with_no_roster_refuses_when_the_default_home_cannot_be_read(
|
|
347
|
+
tmp_path: Path,
|
|
348
|
+
) -> None:
|
|
349
|
+
completed, _ = _run_broker_without_a_roster(tmp_path, None)
|
|
350
|
+
|
|
351
|
+
with pytest.raises(account.CodexAccountUnavailable) as refusal:
|
|
352
|
+
account.codex_home_from_broker_answer(completed.returncode, completed.stdout)
|
|
353
|
+
|
|
354
|
+
assert completed.returncode == BROKER_WAIT_EXIT_CODE
|
|
355
|
+
assert refusal.value.exit_code == NO_ACCOUNT_EXIT_CODE
|