# Isolated copy-Hermes for QA (guarded launcher) Use when a worker needs a real Hermes dashboard (not the fake gateway) to prove a write path end to end (e.g. SOUL.md edit, profile API). A copy started with the real `$HOME` sees and can write the user's real profiles — setting only `HERMES_HOME` is NOT enough, because Hermes and its children also resolve paths via `$HOME` and inherit the caller's env. So the PM ships ONE guarded launcher and the brief makes it the only allowed way to start a copy. ## Launcher contract (`workspace/sprintNN/qa-hermes-izole.sh ` / `--stop `) 1. Validate args: job code matches the sprint pattern (e.g. `s12-[0-9]+`); port inside a QA range (e.g. ``), never the real dashboard port (``), and not already LISTENing. 2. Root everything under `$QA_ROOT//` (in the PM scratch dir): `HOME=$QA_ROOT//home`, `HERMES_HOME=$HOME/.hermes`. 3. Start with `env -i HOME=... HERMES_HOME=... PATH=/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin LANG=en_US.UTF-8` so nothing leaks from the caller's environment. Record pid + port files. 4. Dashboard API needs a session token: generate a random one, write it with `umask 077` to `$QA_ROOT//session-token`, pass via `HERMES_DASHBOARD_SESSION_TOKEN`, call the API with header `X-Hermes-Session-Token`. Never echo the value. 5. Verify before declaring success: `GET /api/profiles` → every profile name must be `default` or `-*` and every `path` must lie under `$QA_ROOT//`. Empty list, foreign name, empty or outside path → `reddet_ve_durdur`: append `SIZINTI: — süreç öldürüldü` to `izole-kontrol.txt`, run `--stop`, exit non-zero with "Devam ETME, PM'e bildir". 6. On success append `SONUC: IZOLE-OK pid=...` to `izole-kontrol.txt` and print `IZOLE-OK job= port= pid= profiller:`. 7. Test it yourself before dispatch: forbidden port rejected, bad job code rejected, out-of-range port rejected, a fake profile without the `-` prefix triggers SIZINTI+kill, a clean start gives IZOLE-OK, `--stop` leaves no listener. ## Stopping reliably Killing the `sh` wrapper leaves the python server alive (port stays busy). Stop order: `pkill -TERM -P ` → `kill ` → wait up to ~10 s until the port is no longer LISTEN (`lsof -nP -iTCP: -sTCP:LISTEN`) → kill whatever still listens → delete pid/port/token files. ## Brief rules (put in the wave's shared rules file as a "KESİN, İSTİSNASIZ" section) - Never start a test environment with the real `$HOME`/`~/.hermes`; never run `hermes` by hand with or without `HOME=`/`HERMES_HOME=`. Only the launcher, only the assigned port (one distinct port per item). - Do not use the copy until `IZOLE-OK` is printed; on `IZOLE-RED`/`SIZINTI` stop and report to PM. - Real dashboard port (and its emulator alias `10.0.2.2:`) is forbidden; emulator connects to `10.0.2.2:`. - Edit only `wwqa-*` profiles. Token file may be read for curl checks, its value never written anywhere. - Attach `izole-kontrol.txt` to RAPOR; PM rejects integration if it is missing or logcat mentions the real port. ## Pre-seed test fixtures yourself If an acceptance test needs a test profile (e.g. `wwqa-ajan` with a SOUL.md), the PM creates it under the isolated HOME before dispatch and proves it with the launcher (start → IZOLE-OK → curl `/api/profiles/

/soul` → `--stop` → no listener). Otherwise the brief contradicts itself: "create a profile" invites the worker to run hermes manually, which the isolation rule forbids.