[eric] agents: pip installs stop no-oping (bundle PYTHONPATH shadow stripped from agent env) and agents self-serve deps instead of nagging (ENG-347)

This commit is contained in:
ciregenz
2026-08-18 19:04:56 -07:00
parent 182409c2ac
commit 82a9860eaa
3 changed files with 12 additions and 1 deletions
@@ -435,7 +435,12 @@ AGENT_IDENTITY = (
f"when the task needs it (real explanation, code, steps), then stay clean and structured. "
f"Don't open with \"Certainly\" or \"Great question\". Hard rule: never put a \"-\" dash in "
f"your prose. No em dashes, no en dashes, no hyphen used as a dash. Use commas, periods, "
f"colons, or parentheses instead."
f"colons, or parentheses instead.\n\n"
f"# Dependencies and tooling\n"
f"Install what you need yourself (pip into a venv you make, npm install) and only mention it "
f"if it fails; never hand the user a raw install command to run. If git or another dev tool "
f"is missing, work without it in the plain directory; suggest installing it only when the "
f"task itself is about that tool, in one plain sentence with the reason."
)
@@ -205,6 +205,11 @@ class RunOptions(AgentManagerProtocol):
)
# The CLI's own auto-memory keys its directory on cwd, and every chat has its own workspace cwd, so it silently files memories into per-chat buckets no other chat reads; MemoryRead/MemoryWrite on the shared store is the one memory surface (ENG-222).
options_kwargs.setdefault("env", {})["CLAUDE_CODE_DISABLE_AUTO_MEMORY"] = "1"
# Packaged builds put the app bundle's site-packages on PYTHONPATH, which shadows any venv an agent makes: pip reports success while installing nothing (ENG-347). Keep only the debugger injection dir.
p_pp = os.environ.get("PYTHONPATH", "")
if p_pp:
p_kept = [e for e in p_pp.split(os.pathsep) if e and "debugger" in os.path.basename(e.rstrip("/\\"))]
options_kwargs["env"]["PYTHONPATH"] = os.pathsep.join(p_kept)
logger.info(f"[SPAWN-PHASE] provider-env done session={session_id[:8]} t={time.monotonic():.3f}")
if mcp_servers:
options_kwargs["mcp_servers"] = mcp_servers
@@ -272,6 +272,7 @@ and flips `BACKEND_PORT` in both `.env` and `.env.example`. Then run
- Use Flask, Django, or any framework other than the FastAPI scaffold
the script gives you.
- Install your own venv or `pip install` manually.
- Ask the user to run pip or install anything. Python deps go in `backend/pyproject.toml`; the framework's restart installs them. Users never run install commands.
- Edit `backend/run.sh` or the SubApp framework.
**Persist anything the user comes back to. Your process is disposable.**