mirror of
https://github.com/langchain-ai/deepagents.git
synced 2026-08-27 10:51:26 -04:00
feb5736dfb
Closes #5757 `DEEPAGENTS_HOME` now selects the dcode user profile and trust root at launch while preserving `~/.deepagents` as the default. --- This makes the configured home an immutable, normalized path captured before dotenv loading and shared by the client, server, reloads, and child processes. A central path snapshot separates profile data, installation-owned resources, and project configuration so cwd changes and mutable environment state cannot move the trust root. Absolute profiles also remain usable when the launch user's home cannot be resolved; optional home-based integrations are skipped in that case. Profile resolution rejects ambiguous or unsafe roots, including relative and `~user` forms, filesystem and launch-home aliases, dangling symlinks, non-directories, and unreadable or unsearchable directories. The installer applies the same validation as Python and changes ownership only for exact leaves it creates. MCP discovery now retains explicit user or project provenance. Only the exact configured user `.mcp.json` receives user-level trust, and filesystem aliases or collisions fail closed to project scope. This prevents project dotenv files, ancestor homes, checkout-contained profiles, and case or symlink aliases from self-approving project MCP servers. Install and update locks and managed ripgrep prefer installation-scoped locations, with profile-scoped fallbacks when the shared locations are unusable. A fallback ripgrep is checksum-verified and exposed through a process-private `PATH` shim so profile-controlled sibling executables never enter subprocess lookup. Runtime consumers, prompts, bundled skills, UI messages, diagnostics, and token permission hints use the effective configured paths, and failed write-probe cleanup is surfaced without repeated warnings. <details> <summary>Test plan</summary> - Added deterministic path, dotenv, cwd, reload, client/server, missing-home, and subprocess regressions. - Added root-validation and installer parity coverage, including symlink, permission, ownership, and write-probe cases. - Added MCP provenance, filesystem-identity, trust-classification, and project self-approval security regressions. - Added shared-lock, managed-ripgrep fallback, checksum, private-`PATH`-shim, and optional-ripgrep regressions. - Added prompt, bundled-skill, diagnostics, and MCP token-path consumer regressions. - Current-head validation is covered by the `deepagents-code` lint job and Python 3.12–3.14 test matrix. </details> --------- Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>