Commit a326c31
test(memory): make the virgin-HOME study test independent of installed agents
CI run 34167164262 (jobs test (3.12) and test (3.13)) failed
test_fresh_install_scope.py::test_studyloop_study_exits_2_with_the_diagnostic_on_a_virgin_home
because on the GitHub runner `studyloop study 'Test Topic'` exits 1 with
"No AI agent found. Install one of: Kiro CLI, Codex, Claude Code,
OpenCode, or pi" before the scope check ever runs. session/start.py calls
detect_agents() (studyloop.agent_launcher) before start_study_session()
raises ScopeUnconfiguredError, so the expected exit 2 + structured scope
diagnostic is unreachable unless some agent binary is resolvable via
shutil.which on the subprocess's PATH. Locally the test only passed
because this machine has agent CLIs installed.
Fix the test, not production code: add a `_fake_agent_bin()` helper that
writes a no-op executable named `claude` (matching
studyloop.adapters.claude.ADAPTER.binary) into a throwaway bin dir and
prepends it to the subprocess PATH via `_usable_path()`/`_virgin_env()`'s
new `agent_bin` parameter. detect_agents() only calls shutil.which(), so
the script is never actually executed -- start_study_session() still
raises ScopeUnconfiguredError immediately after agent selection, well
before any launch command is built. Applied to both
test_studyloop_study_exits_2_with_the_diagnostic_on_a_virgin_home and its
installed-wheel sibling in test_fresh_install_scope_installed.py, which
had the same dependency.
Reproduced RED locally by running both files with a PATH stripped of
every real agent CLI (venv bin + tmux + /usr/bin:/bin only), then
confirmed GREEN with that same stripped PATH after the fix.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>1 parent 8f347b2 commit a326c31
2 files changed
Lines changed: 70 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
72 | 78 | | |
73 | 79 | | |
74 | 80 | | |
75 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
76 | 112 | | |
77 | 113 | | |
78 | | - | |
| 114 | + | |
79 | 115 | | |
80 | 116 | | |
81 | 117 | | |
| |||
85 | 121 | | |
86 | 122 | | |
87 | 123 | | |
88 | | - | |
| 124 | + | |
89 | 125 | | |
90 | 126 | | |
91 | 127 | | |
| |||
144 | 180 | | |
145 | 181 | | |
146 | 182 | | |
147 | | - | |
| 183 | + | |
| 184 | + | |
148 | 185 | | |
149 | 186 | | |
150 | 187 | | |
| |||
Lines changed: 28 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
107 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
108 | 129 | | |
109 | | - | |
| 130 | + | |
| 131 | + | |
110 | 132 | | |
111 | 133 | | |
112 | 134 | | |
113 | | - | |
| 135 | + | |
114 | 136 | | |
115 | 137 | | |
116 | 138 | | |
| |||
149 | 171 | | |
150 | 172 | | |
151 | 173 | | |
152 | | - | |
| 174 | + | |
| 175 | + | |
153 | 176 | | |
154 | 177 | | |
155 | 178 | | |
| |||
0 commit comments