Skip to content

Commit 2844b16

Browse files
test(acp): the dogfood server gets its own session dir, not the real one
The live-Kiro dogfood test keeps the developer's real HOME on purpose: kiro-cli's auth and the installed `studyloop` agent live there, and running against them is the point. The session DIRECTORY is a different axis. The server it spawns resolves session_state.SESSION_DIR from STUDYLOOP_SESSION_DIR, defaulting to the real ~/.config/studyloop, and the conftest sets that variable per TEST in a function-scoped autouse fixture. This server starts from a module-scoped fixture, before any test's fixtures run, so `{**os.environ}` carried no override and every run wrote an `acp-sql-<id>` directory (CLAUDE.md, the `studyloop` wrapper) into the developer's real sessions folder. Nine had accumulated across the runs that reached a verdict; the conftest's R-49d real-home guard named the tenth on the first run after the trust-write and adapter fixes. Every other spawned server gets its session dir from _playwright_helpers._isolated_child_env; this launcher bypasses that helper only to keep HOME, so it now sets the one variable itself (a fresh mkdtemp). Verified live, twice, against real kiro-cli 2.29.0 after c1accbc: run 1 (before this change) 1 passed in 47.6 s with the R-49d banner naming the new real-home directory; run 2 (with it) 1 passed in 66.7 s, no banner, no new entry under ~/.config/studyloop/sessions, one dir under TMPDIR. Both runs also confirm the two fixes beneath them: ~/.claude/settings.json was byte-identical (same SHA-256, size and mtime) across a real Kiro ACP start and end, and the adapter teardown classified the 17 Sep study-mentor.json.studyloop-backup as obsolete and left the installer's symlink untouched (the discard itself hit this sandbox's EPERM on ~/.kiro/agents and was caught by cleanup._teardown_agent, so the session end still completed; outside the sandbox it is removed).
1 parent c1accbc commit 2844b16

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,16 @@ experience may change before `1.0.0`.
181181
the real agent runs its session-start protocol (several tool calls, each a
182182
permission round-trip) before answering, and a timeout now reports the
183183
console's state instead of a bare "120000ms exceeded". First green run:
184-
48 s.
184+
48 s. The server it spawns also wrote each session's directory (`CLAUDE.md`,
185+
the `studyloop` wrapper, IPC files) into the developer's real
186+
`~/.config/studyloop/sessions/`: the test keeps the real `HOME` on purpose
187+
(Kiro's auth and the installed `studyloop` agent live there), but the
188+
module-scoped server fixture starts before the conftest's per-test
189+
`STUDYLOOP_SESSION_DIR` isolation applies, so the server inherited no
190+
override. The launcher now gives the server its own throwaway session dir,
191+
as every other spawned server already gets from `_isolated_child_env`.
192+
Found by the conftest's R-49d real-home guard on the first run after the
193+
fixes above (nine `acp-sql-*` directories had accumulated).
185194
- The `voice-tts` OpenSpec specification described the architecture that was
186195
deleted, not the one that shipped: it required browser-side Kokoro via
187196
`transformers.js` and forbade any server-side synthesis for the web path,

‎packages/studyloop/tests/test_web_acp_dogfood_kiro.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import shutil
2727
import subprocess
2828
import sys
29+
import tempfile
2930
import time
3031
import urllib.error
3132
import urllib.request
@@ -160,6 +161,18 @@ def _start_web_server_real_kiro() -> subprocess.Popen:
160161
# developer's real, authenticated kiro-cli and StudyLoop's installed
161162
# `studyloop` agent -- that is what makes it dogfood.
162163
env.setdefault("SESSION_CONTEXT_SCOPE", "unclassified")
164+
# The session DIRECTORY is not part of that: it is where the server
165+
# writes CLAUDE.md, the `studyloop` wrapper and the IPC files for each
166+
# session, and session_state.SESSION_DIR defaults to the REAL
167+
# ~/.config/studyloop unless STUDYLOOP_SESSION_DIR says otherwise. The
168+
# conftest autouse fixture sets that variable per TEST, but this server
169+
# starts from a module-scoped fixture, before any test's fixtures run,
170+
# so `{**os.environ}` carried no override and every dogfood run left an
171+
# `acp-sql-<id>` directory in the developer's real sessions folder
172+
# (R-49d banner, 2026-10-12). Every other spawned server gets this from
173+
# _playwright_helpers._isolated_child_env; this launcher bypasses that
174+
# helper only to keep HOME, so it sets the one variable itself.
175+
env["STUDYLOOP_SESSION_DIR"] = tempfile.mkdtemp(prefix="studyloop-dogfood-session-dir-")
163176

164177
cmd = [sys.executable, "-m", "studyloop.cli", "web", "--port", str(WEB_PORT)]
165178
proc = subprocess.Popen(

0 commit comments

Comments
 (0)