Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
feat(daemon): remove the Linux Codex per-task HOME; default Linux to danger-full-access (MUL-5578) (#6233)
Bohan Jiang98766cc06acf
diff --git a/apps/docs/content/docs/meta.ja.json b/apps/docs/content/docs/meta.ja.jsonindex 515480ad0e..3d9aca960c 100644--- a/apps/docs/content/docs/meta.ja.json+++ b/apps/docs/content/docs/meta.ja.json@@ -43,6 +43,7 @@"desktop-app","mobile-app","---セルフホスティング---",+ "security-model","environment-variables","auth-setup","troubleshooting",diff --git a/apps/docs/content/docs/meta.json b/apps/docs/content/docs/meta.jsonindex bcdabb8a16..66eea0b098 100644--- a/apps/docs/content/docs/meta.json+++ b/apps/docs/content/docs/meta.json@@ -43,6 +43,7 @@"desktop-app","mobile-app","---Self-hosting---",+ "security-model","environment-variables","auth-setup","troubleshooting",diff --git a/apps/docs/content/docs/meta.ko.json b/apps/docs/content/docs/meta.ko.jsonindex ab1760b5f5..b8a70dce4d 100644--- a/apps/docs/content/docs/meta.ko.json+++ b/apps/docs/content/docs/meta.ko.json@@ -43,6 +43,7 @@"desktop-app","mobile-app","---자체 호스팅---",+ "security-model","environment-variables","auth-setup","troubleshooting",diff --git a/apps/docs/content/docs/meta.zh.json b/apps/docs/content/docs/meta.zh.jsonindex 7ef7e289fe..cd632a2e64 100644--- a/apps/docs/content/docs/meta.zh.json+++ b/apps/docs/content/docs/meta.zh.json@@ -43,6 +43,7 @@"desktop-app","mobile-app","---自托管---",+ "security-model","environment-variables","auth-setup","troubleshooting",diff --git a/apps/docs/content/docs/security-model.ja.mdx b/apps/docs/content/docs/security-model.ja.mdxnew file mode 100644index 0000000000..953a26c57e--- /dev/null+++ b/apps/docs/content/docs/security-model.ja.mdx@@ -0,0 +1,59 @@+---+title: セキュリティモデル+description: Multica のタスクが実行マシン上で何にアクセスできるのか、そして本当の分離境界がどこにあるのかを説明します。+---++import { Callout } from "fumadocs-ui/components/callout";++エージェントがタスクを受け取ると、デーモンは AI コーディングツール(Codex、Claude Code など)を子プロセスとして起動します。このプロセスが何に触れられるかを理解することが、セキュリティモデルのすべてです。++## 境界はデーモンを実行しているユーザー++デフォルトでは、タスクは**デーモンを実行している OS ユーザーの全権限**で動きます。そのユーザーが読み書きできるファイルはすべて読み書きでき、そのユーザーの認証情報を利用でき、ネットワークにも制限なくアクセスできます。++Multica はファイルシステムのサンドボックスを一切保証しません。現時点で例外は 1 つだけ、Windows で Codex のネイティブサンドボックスを明示的に有効にした場合です。そもそもどのプラットフォームと設定の組み合わせでサンドボックスが効くかはツールのバージョンとともに変わる互換性上の詳細です。すべてのタスクをサンドボックスなしとみなし、境界はデーモンの外側に用意してください。++<Callout type="warning">+Multica はファイルシステムのサンドボックスを提供しません。デーモンを個人アカウントで動かしている場合、タスクは SSH 秘密鍵を読み、シェルの設定を書き換え、ドキュメントを削除できます。分離はデーモンの外側に用意する必要があります。+</Callout>++これは意図的な設計です。エージェントには依存関係のインストール、ビルドの実行、クラウド CLI の利用が求められ、これらのツールは通常のホームディレクトリがあることを前提にしています。中途半端なファイルシステムサンドボックスは、こうした作業を診断しづらい形で壊します(ツールが「ログインしていません」と言う、あるいは黙って別のアカウントを使う)。しかも最も重要な部分は守れません。タスクが認証情報を読み取ってネットワーク経由で送信することは止められないからです。++そのため Multica は自らを境界とは称しません。外側に境界を用意してください。++## 推奨構成++インフラに合うものを選んでください。軽いものから順に挙げます:++1. **専用 Unix ユーザー。** `multica` ユーザーを作成し、エージェントに必要なリポジトリと認証情報だけを与えて、そのユーザーでデーモンを実行します。自分のアカウントは影響を受けません。+2. **コンテナ。** 必要なマウントとシークレットだけを与えたコンテナ内でデーモンを実行します。+3. **仮想マシン。** 分離は最も強固ですが、マシンの用意が必要です。++いずれの場合も、その環境から到達できる認証情報は「エージェントが使う可能性のある認証情報」として扱ってください。トークンの権限は最小限にし、個人の SSH 鍵ではなく用途別のデプロイキーを使い、無関係な本番環境の認証情報をそのユーザーのホームに残さないようにします。++## Multica が実際に分離しているもの++以下は実在する分離ですが、利便性と影響範囲の縮小のためのものであり、能動的に脱出を試みるタスクに対するセキュリティ境界では**ありません**:++- **タスクごとの作業ディレクトリ。** 各タスクは `~/multica_workspaces/` 配下に専用の workdir を持ち、同時実行のタスクが同じチェックアウトで衝突しません。+- **タスクごとのエージェント状態。** Codex タスクはタスクスコープの `CODEX_HOME` を持ち、設定・セッション・スキルを保持するため、`~/.codex/` を汚しません。+- **タスクスコープの API トークン。** タスクに渡される `MULTICA_TOKEN` はサーバー側でそのエージェントとタスクに紐づけられており、タスクが Multica API 上であなたや他のエージェントとして振る舞うことはできません。++## 境界ではないもの++- **コーディングツール自身のサンドボックスと承認設定。** Multica はエージェントを無人で実行するため、承認要求は自動的に応答されます。デフォルトの経路ではファイルシステムのサンドボックスも無効で、Codex は `sandbox_mode = "danger-full-access"`、Claude Code は `--permission-mode bypassPermissions` で動作します。例外は Windows です。Codex のネイティブサンドボックス(`windows.sandbox = "unelevated"` または `"elevated"`)を明示的に設定した場合、Multica はそのオプトインを尊重し、該当タスクでは `workspace-write` を維持します。使える場面では有効ですが、1 つのプラットフォームの 1 つのツールに限られる話であり、デーモンユーザーの権限をどこまで絞るべきかという判断は変わりません。+- **`HOME` ディレクトリの構成。** タスクはデーモンユーザーの実際の `HOME` と `XDG_*` 変数を引き継ぎます。だからこそ `gh`、`aws`、`kubectl`、`gcloud`、`glab` などのホスト CLI がシェルと同じようにタスク内で動作します。同時に、そのホーム配下のすべてに到達できるということでもあります。++<Callout>+Linux では以前、Codex タスクは `workspace-write` サンドボックスとタスクごとにリダイレクトした `HOME` の下で実行されていました。この仕組みは削除されました。ホスト CLI がタスク内で未設定状態になるうえ、書き込みしか制限しないため、認証情報の読み取りと持ち出しは元から防げていなかったからです。現在 Linux は macOS と Windows のデフォルトと同じ挙動です。+</Callout>++## タスクが実際にどのモードで動いたかを確認する++タスクがサンドボックスなしで起動すると、デーモンは warn レベルでログを出します:++```bash+multica daemon logs --lines 200 | grep "codex sandbox"+```++Codex の実効設定を確認するには、そのタスクの `CODEX_HOME` にある `config.toml` の管理ブロックを見てください。`# BEGIN multica-managed` と `# END multica-managed` に挟まれた部分は、実行のたびにデーモンが書き込みます。diff --git a/apps/docs/content/docs/security-model.ko.mdx b/apps/docs/content/docs/security-model.ko.mdxnew file mode 100644index 0000000000..a5c201c74a--- /dev/null+++ b/apps/docs/content/docs/security-model.ko.mdx@@ -0,0 +1,59 @@+---+title: 보안 모델+description: Multica 작업이 실행 머신에서 접근할 수 있는 범위와 실제 격리 경계가 어디인지 설명합니다.+---++import { Callout } from "fumadocs-ui/components/callout";++에이전트가 작업을 맡으면 데몬은 AI 코딩 도구(Codex, Claude Code 등)를 자식 프로세스로 실행합니다. 이 프로세스가 무엇에 접근할 수 있는지 이해하는 것이 보안 모델의 전부입니다.++## 경계는 데몬을 실행하는 사용자++기본적으로 작업은 **데몬을 실행하는 운영체제 사용자의 모든 권한**으로 동작합니다. 해당 사용자가 읽고 쓸 수 있는 파일은 모두 읽고 쓸 수 있으며, 그 사용자의 자격 증명을 사용할 수 있고, 네트워크에도 제한 없이 접근합니다.++Multica는 파일 시스템 샌드박스를 보장하지 않습니다. 현재 예외는 하나뿐으로, Windows에서 Codex의 네이티브 샌드박스를 명시적으로 활성화한 경우입니다. 게다가 어떤 플랫폼과 설정 조합에서 샌드박스가 적용되는지는 도구 버전에 따라 달라지는 호환성 세부사항입니다. 모든 작업을 샌드박스가 없는 것으로 간주하고, 경계는 데몬 바깥에 두세요.++<Callout type="warning">+Multica는 파일 시스템 샌드박스를 제공하지 않습니다. 데몬을 개인 계정으로 실행 중이라면 작업이 SSH 키를 읽고, 셸 설정을 수정하고, 문서를 삭제할 수 있습니다. 격리는 데몬 바깥에 직접 마련해야 합니다.+</Callout>++이는 의도된 설계입니다. 에이전트는 의존성 설치, 빌드 실행, 클라우드 CLI 사용을 요구받으며, 이런 도구들은 정상적인 홈 디렉터리를 전제로 동작합니다. 불완전한 파일 시스템 샌드박스는 이런 작업을 진단하기 어려운 방식으로 망가뜨립니다(도구가 "로그인되지 않음"이라고 하거나, 조용히 잘못된 계정을 사용). 그러면서도 정작 가장 중요한 것은 보호하지 못합니다. 작업이 자격 증명을 읽어 네트워크로 내보내는 것은 막을 수 없기 때문입니다.++그래서 Multica는 스스로를 경계라고 주장하지 않습니다. 바깥에 경계를 두세요.++## 권장 구성++인프라에 맞는 것을 선택하세요. 가벼운 순서대로 나열했습니다:++1. **전용 Unix 사용자.** `multica` 사용자를 만들고 에이전트에 필요한 저장소와 자격 증명만 부여한 뒤 그 사용자로 데몬을 실행합니다. 본인 계정은 영향을 받지 않습니다.+2. **컨테이너.** 필요한 마운트와 시크릿만 제공한 컨테이너에서 데몬을 실행합니다.+3. **가상 머신.** 가장 강력한 격리이지만 머신을 따로 준비해야 합니다.++어떤 방식을 선택하든, 그 환경에서 접근 가능한 자격 증명은 에이전트가 사용할 수 있는 자격 증명으로 간주하세요. 토큰 권한은 최소로 좁히고, 개인 SSH 키 대신 용도별 배포 키를 사용하며, 무관한 프로덕션 자격 증명을 해당 사용자의 홈에 남겨두지 마세요.++## Multica가 실제로 격리하는 것++아래는 실제로 존재하는 격리이지만 편의성과 영향 범위 축소를 위한 것이며, 능동적으로 탈출을 시도하는 작업에 대한 보안 경계는 **아닙니다**:++- **작업별 작업 디렉터리.** 각 작업은 `~/multica_workspaces/` 아래에 전용 workdir를 가지므로 동시 실행 작업이 같은 체크아웃에서 충돌하지 않습니다.+- **작업별 에이전트 상태.** Codex 작업은 설정, 세션, 스킬을 담는 작업 범위 `CODEX_HOME`을 가지므로 `~/.codex/`를 오염시키지 않습니다.+- **작업 범위 API 토큰.** 작업에 전달되는 `MULTICA_TOKEN`은 서버가 해당 에이전트와 작업에 바인딩하므로, 작업이 Multica API에서 사용자나 다른 에이전트로 행세할 수 없습니다.++## 경계가 아닌 것++- **코딩 도구 자체의 샌드박스와 승인 설정.** Multica는 에이전트를 무인으로 실행하므로 승인 요청은 자동 응답됩니다. 기본 경로에서는 파일 시스템 샌드박스도 꺼져 있어 Codex는 `sandbox_mode = "danger-full-access"`, Claude Code는 `--permission-mode bypassPermissions`로 동작합니다. 예외는 Windows입니다. Codex의 네이티브 샌드박스(`windows.sandbox = "unelevated"` 또는 `"elevated"`)를 명시적으로 설정하면 Multica는 그 옵트인을 존중해 해당 작업에 `workspace-write`를 유지합니다. 적용 가능한 환경에서는 권장하지만, 한 플랫폼의 한 도구에 국한된 이야기이며 데몬 사용자의 권한을 얼마나 좁혀야 하는지는 달라지지 않습니다.+- **`HOME` 디렉터리 구성.** 작업은 데몬 사용자의 실제 `HOME`과 `XDG_*` 변수를 그대로 상속합니다. 덕분에 `gh`, `aws`, `kubectl`, `gcloud`, `glab` 같은 호스트 CLI가 셸에서와 동일하게 작업 안에서도 동작합니다. 동시에 그 홈 아래의 모든 것에 접근할 수 있다는 뜻이기도 합니다.++<Callout>+Linux에서 Codex 작업은 이전에 `workspace-write` 샌드박스와 작업별로 리디렉션된 `HOME` 아래에서 실행되었습니다. 이 방식은 제거되었습니다. 호스트 CLI가 작업 안에서 미설정 상태가 되는 데다, 쓰기만 제한했기 때문에 자격 증명을 읽어 유출하는 것은 애초에 막지 못했기 때문입니다. 이제 Linux는 macOS 및 Windows의 기본 동작과 같습니다.+</Callout>++## 작업이 실제 어떤 모드로 실행되었는지 확인하기++작업이 샌드박스 없이 시작되면 데몬이 warn 레벨 로그를 남깁니다:++```bash+multica daemon logs --lines 200 | grep "codex sandbox"+```++Codex의 실제 적용 설정을 확인하려면 해당 작업의 `CODEX_HOME` 아래 `config.toml`에 있는 관리 블록을 보세요. `# BEGIN multica-managed`와 `# END multica-managed` 사이의 내용은 실행할 때마다 데몬이 작성합니다.diff --git a/apps/docs/content/docs/security-model.mdx b/apps/docs/content/docs/security-model.mdxnew file mode 100644index 0000000000..481f7e863f--- /dev/null+++ b/apps/docs/content/docs/security-model.mdx@@ -0,0 +1,59 @@+---+title: Security model+description: What a Multica task can reach on the machine that runs it, and where the real isolation boundary lives.+---++import { Callout } from "fumadocs-ui/components/callout";++When an agent picks up a task, the daemon spawns an AI coding tool (Codex, Claude Code, and so on) as a child process. Understanding what that process can touch is the whole security model.++## The boundary is the daemon user++By default a task runs with the **full permissions of the operating-system user running the daemon**. It can read and write every file that user can, use that user's credentials, and reach the network without restriction.++Multica makes no filesystem-sandbox guarantee. One narrow exception exists today — Windows, where you have explicitly opted into Codex's native sandbox — but which platform and configuration combinations sandbox anything is a compatibility detail that moves with tool versions. Treat every task as unsandboxed and put the boundary outside the daemon.++<Callout type="warning">+Multica does not sandbox the filesystem for you. If the daemon runs as your personal user account, a task can read your SSH keys, edit your shell profile, and delete your documents. Isolation has to come from the boundary you put the daemon in.+</Callout>++This is deliberate. Agents are asked to install dependencies, run builds, use your cloud CLIs, and drive tooling that expects a normal home directory. A partial filesystem sandbox breaks that work in ways that are hard to diagnose — the tool reports "not logged in" or silently uses the wrong account — while still not protecting the thing that matters most, since it cannot stop a task from reading credentials and sending them over the network.++So Multica does not pretend to be the boundary. Put one around it.++## Recommended setups++Pick whichever fits your infrastructure — they are listed from lightest to strongest:++1. **Dedicated Unix user.** Create a `multica` user, give it only the repositories and credentials the agents need, and run the daemon as that user. Your own account stays untouched.+2. **Container.** Run the daemon in a container with only the mounts and secrets the agents need.+3. **Virtual machine.** Full isolation, at the cost of provisioning a machine.++Whichever you choose, treat the credentials reachable from that environment as credentials the agent may use: scope tokens narrowly, prefer per-purpose deploy keys over your personal SSH key, and avoid leaving unrelated production credentials in that user's home directory.++## What Multica does isolate++These are real, but they are conveniences and blast-radius reduction — not a security boundary against a task that actively tries to escape:++- **Per-task working directory.** Each task gets its own workdir under `~/multica_workspaces/`, so concurrent tasks do not collide on the same checkout.+- **Per-task agent state.** Codex tasks get a task-scoped `CODEX_HOME` holding config, sessions, and skills, so per-task settings do not pollute your `~/.codex/`.+- **Task-scoped API tokens.** The `MULTICA_TOKEN` handed to a task is bound to that agent and that task by the server, so a task cannot act as you or as another agent through the Multica API.++## What is not a boundary++- **The coding tool's own sandbox and approval settings.** Multica runs agents unattended, so approval prompts are answered automatically. On the default path the filesystem sandbox is off as well: Codex runs with `sandbox_mode = "danger-full-access"` and Claude Code with `--permission-mode bypassPermissions`. The exception is Windows — if you explicitly configure Codex's native sandbox (`windows.sandbox = "unelevated"` or `"elevated"`), Multica honors that opt-in and keeps `workspace-write` for those tasks. Worth doing where it fits, but it is one tool on one platform and it does not change how you should scope the daemon user.+- **Your `HOME` directory layout.** Tasks inherit the daemon user's real `HOME` and `XDG_*` variables, which is what makes host CLIs (`gh`, `aws`, `kubectl`, `gcloud`, `glab`) work inside a task exactly as they do in your shell. It also means everything under that home is reachable.++<Callout>+On Linux, Codex tasks previously ran under the `workspace-write` sandbox with a redirected per-task `HOME`. That was removed: it left host CLIs unconfigured inside tasks, and because it restricted writes only, it never prevented a task from reading and exfiltrating credentials. Linux now matches the macOS and Windows default.+</Callout>++## Checking what a task ran with++The daemon logs the effective sandbox mode at warn level when a task starts unsandboxed:++```bash+multica daemon logs --lines 200 | grep "codex sandbox"+```++To confirm the effective Codex configuration, read the managed block in the task's `config.toml` under the task's `CODEX_HOME` — the section between the `# BEGIN multica-managed` and `# END multica-managed` markers is written by the daemon on every run.diff --git a/apps/docs/content/docs/security-model.zh.mdx b/apps/docs/content/docs/security-model.zh.mdxnew file mode 100644index 0000000000..ee657d5e21--- /dev/null+++ b/apps/docs/content/docs/security-model.zh.mdx@@ -0,0 +1,59 @@+---+title: 安全模型+description: 一个 Multica 任务能访问运行它的机器上的哪些内容,以及真正的隔离边界在哪里。+---++import { Callout } from "fumadocs-ui/components/callout";++当智能体接到任务时,守护进程会把 AI 编程工具(Codex、Claude Code 等)作为子进程启动。理解这个进程能碰到什么,就理解了全部安全模型。++## 边界是运行守护进程的那个用户++默认情况下,任务以**运行守护进程的操作系统用户的全部权限**执行。该用户能读写的文件,任务都能读写;该用户的凭据,任务都能使用;网络访问不受限制。++Multica 不对文件系统沙箱作任何保证。目前只有一个狭窄的例外——在 Windows 上显式开启 Codex 原生沙箱——而且哪些平台与配置组合会真正启用沙箱属于兼容性细节,会随工具版本变化。请把每一个任务都当作无沙箱来对待,并把边界放在守护进程之外。++<Callout type="warning">+Multica 不会替你做文件系统沙箱。如果守护进程跑在你的个人账号下,任务可以读取你的 SSH 私钥、修改你的 shell 配置、删除你的文档。隔离必须来自你为守护进程设置的外层边界。+</Callout>++这是有意为之。智能体需要安装依赖、执行构建、使用你的云 CLI,这些工具都假设自己面对一个正常的 home 目录。不完整的文件系统沙箱会以极难排查的方式破坏这些工作——工具报"未登录",或者悄悄用错了账号——同时又保护不了最要紧的东西:它无法阻止任务读取凭据并通过网络发出去。++所以 Multica 不假装自己是边界。请在它外面加一层。++## 推荐部署方式++按从轻到重排列,选择适合你基础设施的一种:++1. **专用 Unix 用户。** 创建一个 `multica` 用户,只给它智能体需要的仓库和凭据,用该用户运行守护进程。你自己的账号完全不受影响。+2. **容器。** 在容器里运行守护进程,只挂载智能体需要的目录和密钥。+3. **虚拟机。** 隔离最彻底,代价是要额外准备一台机器。++无论选哪种,都应把该环境中可触达的凭据视为智能体可能会用到的凭据:token 权限尽量收窄,优先使用专用部署密钥而不是你的个人 SSH 私钥,也不要把无关的生产凭据留在该用户的 home 目录里。++## Multica 确实隔离的部分++以下是真实存在的隔离,但它们属于便利性与影响面收敛,**不是**用来防御主动逃逸的安全边界:++- **每任务独立工作目录。** 每个任务在 `~/multica_workspaces/` 下拥有独立 workdir,并发任务不会在同一份 checkout 上打架。+- **每任务独立的智能体状态。** Codex 任务拥有任务级 `CODEX_HOME`,保存配置、会话与技能,不会污染你的 `~/.codex/`。+- **任务级 API token。** 交给任务的 `MULTICA_TOKEN` 由服务端绑定到该智能体与该任务,因此任务无法通过 Multica API 以你或其他智能体的身份行事。++## 不构成边界的部分++- **编程工具自带的沙箱与审批设置。** Multica 以无人值守方式运行智能体,审批请求会被自动应答。默认路径下文件系统沙箱同样处于关闭状态:Codex 使用 `sandbox_mode = "danger-full-access"`,Claude Code 使用 `--permission-mode bypassPermissions`。例外是 Windows——如果你显式配置了 Codex 原生沙箱(`windows.sandbox = "unelevated"` 或 `"elevated"`),Multica 会尊重这个 opt-in,对这些任务保留 `workspace-write`。适用场景下值得开启,但它只覆盖一个平台上的一个工具,不改变你应当如何收窄守护进程用户的权限。+- **你的 `HOME` 目录结构。** 任务继承守护进程用户真实的 `HOME` 与 `XDG_*` 变量——正因如此,`gh`、`aws`、`kubectl`、`gcloud`、`glab` 等宿主 CLI 在任务内的行为与在你 shell 里完全一致。这同时也意味着该 home 下的一切都可触达。++<Callout>+在 Linux 上,Codex 任务过去运行在 `workspace-write` 沙箱下并使用重定向的每任务 `HOME`。该机制已被移除:它会让宿主 CLI 在任务内处于未配置状态,而且由于它只限制写入,从未能阻止任务读取并外传凭据。现在 Linux 与 macOS、Windows 的默认行为一致。+</Callout>++## 如何确认任务实际以什么模式运行++任务以无沙箱方式启动时,守护进程会记录 warn 级日志:++```bash+multica daemon logs --lines 200 | grep "codex sandbox"+```++要确认 Codex 的实际生效配置,可以查看该任务 `CODEX_HOME` 下 `config.toml` 中的托管块——`# BEGIN multica-managed` 与 `# END multica-managed` 标记之间的内容由守护进程在每次运行时写入。diff --git a/apps/docs/content/docs/self-host-quickstart.ja.mdx b/apps/docs/content/docs/self-host-quickstart.ja.mdxindex 7f3799206e..3ddc197bfa 100644--- a/apps/docs/content/docs/self-host-quickstart.ja.mdx+++ b/apps/docs/content/docs/self-host-quickstart.ja.mdx@@ -169,6 +169,10 @@ docker compose -f docker-compose.selfhost.yml logs backend \以下のコマンドは **AI コーディングツールを実行するコンピュータ**で実行します。Docker を実行しているサーバーとは限りません。+<Callout type="warning">+タスクはデーモンを実行しているユーザーの全権限で動作し、そのユーザーが読み書きできるものはすべて読み書きできます。個人アカウントではなく、専用の Unix ユーザー、コンテナ、または VM でデーモンを実行してください。[セキュリティモデル](/security-model)を参照してください。+</Callout>+まず Multica CLI をインストールします。**macOS / Linux**diff --git a/apps/docs/content/docs/self-host-quickstart.ko.mdx b/apps/docs/content/docs/self-host-quickstart.ko.mdxindex 334528150e..b2a8b0eede 100644--- a/apps/docs/content/docs/self-host-quickstart.ko.mdx+++ b/apps/docs/content/docs/self-host-quickstart.ko.mdx@@ -169,6 +169,10 @@ docker compose -f docker-compose.selfhost.yml logs backend \다음 명령은 Docker 서버가 아니라 **AI 코딩 도구를 실행할 컴퓨터**에서 실행합니다. 두 컴퓨터가 같을 수도 있습니다.+<Callout type="warning">+작업은 데몬을 실행하는 사용자의 모든 권한으로 동작하며, 그 사용자가 읽고 쓸 수 있는 모든 것에 접근할 수 있습니다. 개인 계정 대신 전용 Unix 사용자, 컨테이너, 또는 VM에서 데몬을 실행하세요. [보안 모델](/security-model)을 참고하세요.+</Callout>+먼저 Multica CLI를 설치합니다.**macOS / Linux**diff --git a/apps/docs/content/docs/self-host-quickstart.mdx b/apps/docs/content/docs/self-host-quickstart.mdxindex 675e23d014..2066386cf8 100644--- a/apps/docs/content/docs/self-host-quickstart.mdx+++ b/apps/docs/content/docs/self-host-quickstart.mdx@@ -169,6 +169,10 @@ Self-hosted deployments default to `APP_ENV=production`, which disables fixed veRun the commands below on **the computer that runs your AI coding tools**, which is not necessarily the server running Docker.+<Callout type="warning">+Tasks run with the full permissions of the user running the daemon — they can read and write everything that user can. Run the daemon as a dedicated Unix user, in a container, or in a VM rather than under your personal account. See the [security model](/security-model).+</Callout>+Install the Multica CLI first:**macOS / Linux**diff --git a/apps/docs/content/docs/self-host-quickstart.zh.mdx b/apps/docs/content/docs/self-host-quickstart.zh.mdxindex fa32a78f8e..dc7ea1375d 100644--- a/apps/docs/content/docs/self-host-quickstart.zh.mdx+++ b/apps/docs/content/docs/self-host-quickstart.zh.mdx@@ -169,6 +169,10 @@ docker compose -f docker-compose.selfhost.yml logs backend \下面的命令在**运行 AI 编程工具的电脑**上执行,不一定是运行 Docker 的服务器。+<Callout type="warning">+任务以运行守护进程的用户的全部权限执行——该用户能读写的一切,任务都能读写。请用专用 Unix 用户、容器或虚拟机来运行守护进程,而不是你的个人账号。详见[安全模型](/security-model)。+</Callout>+先安装 Multica CLI:**macOS / Linux**diff --git a/server/internal/daemon/daemon.go b/server/internal/daemon/daemon.goindex f00d698534..91dd548ae0 100644--- a/server/internal/daemon/daemon.go+++ b/server/internal/daemon/daemon.go@@ -5197,18 +5197,10 @@ func (d *Daemon) runTask(ctx context.Context, task Task, provider string, slot iif env.CodexHome != "" {agentEnv["CODEX_HOME"] = env.CodexHome}- // Redirect HOME/XDG/npm_config_cache to the per-task writable home under the- // Linux codex workspace-write sandbox, where the real home is read-only. This- // lets tools that write to `~` (npm, Prisma, …) succeed without per-tool env- // tweaks. Set before custom_env below so a user override still wins for the- // non-blocklisted XDG keys; HOME itself stays blocklisted. Empty TaskHome- // (macOS/Windows, non-sandboxed providers) leaves the real HOME untouched- // (MUL-4856).- if env.TaskHome != "" {- for k, v := range execenv.TaskHomeEnv(env.TaskHome) {- agentEnv[k] = v- }- }+ // HOME and the XDG base dirs are deliberately not touched here: tasks run+ // with the daemon user's real home on every platform, so host CLI config+ // and credentials resolve inside a task exactly as they do in the daemon+ // user's shell (MUL-5578).// (Hermes HERMES_HOME is applied after custom_env below so the per-task// overlay can win over a user-set HERMES_HOME; see// layerCustomEnvAndHermesHome.)diff --git a/server/internal/daemon/daemon_test.go b/server/internal/daemon/daemon_test.goindex fbe100a4e2..c3bae715e7 100644--- a/server/internal/daemon/daemon_test.go+++ b/server/internal/daemon/daemon_test.go@@ -23,6 +23,7 @@ import ("github.com/multica-ai/multica/server/internal/daemon/execenv""github.com/multica-ai/multica/server/internal/daemon/repocache""github.com/multica-ai/multica/server/pkg/agent"+ "github.com/pelletier/go-toml/v2")func createDaemonTestRepo(t *testing.T) string {@@ -323,6 +324,65 @@ func TestConfigureCodexTaskShellEnvironment(t *testing.T) {})}+// TestCodexTaskShellEnvInheritsRealHome pins the MUL-5578 contract at the layer+// where the daemon assembles the environment a Codex task actually launches+// with: HOME and the XDG base dirs reach the task's shell tools from the+// *inherited* daemon process environment, so `gh`, `aws`, `kubectl`, and npm+// resolve the daemon user's real config inside a task.+//+// This guards the pass-through, not runTask's decision not to inject a HOME of+// its own — that decision lives inline in runTask and has no unit seam.+func TestCodexTaskShellEnvInheritsRealHome(t *testing.T) {+ t.Parallel()++ codexHome := t.TempDir()+ inherited := []string{+ "HOME=/home/daemon-user",+ "XDG_CONFIG_HOME=/home/daemon-user/.config",+ "XDG_CACHE_HOME=/home/daemon-user/.cache",+ "XDG_DATA_HOME=/home/daemon-user/.local/share",+ "XDG_STATE_HOME=/home/daemon-user/.local/state",+ "PATH=/usr/local/bin:/usr/bin",+ }+ // What runTask layers on top for a Codex task: task identity plus the+ // task-scoped CODEX_HOME, and — since MUL-5578 — no HOME/XDG entry.+ explicit := map[string]string{+ "CODEX_HOME": codexHome,+ "MULTICA_TOKEN": "mat_task",+ "MULTICA_SERVER_URL": "https://task.example",+ }++ if err := configureCodexTaskShellEnvironment("codex", codexHome, inherited, explicit, nil, slog.Default()); err != nil {+ t.Fatalf("configureCodexTaskShellEnvironment: %v", err)+ }++ data, err := os.ReadFile(filepath.Join(codexHome, "config.toml"))+ if err != nil {+ t.Fatalf("read config.toml: %v", err)+ }+ var parsed struct {+ ShellEnvironmentPolicy struct {+ IncludeOnly []string `toml:"include_only"`+ } `toml:"shell_environment_policy"`+ }+ if err := toml.Unmarshal(data, &parsed); err != nil {+ t.Fatalf("parse config.toml: %v\n%s", err, data)+ }+ include := parsed.ShellEnvironmentPolicy.IncludeOnly++ // The daemon user's real home must survive into the task's shell tools, or+ // gh / aws / kubectl / npm stop resolving their config there.+ for _, want := range []string{"HOME", "XDG_CONFIG_HOME", "XDG_CACHE_HOME", "XDG_DATA_HOME", "XDG_STATE_HOME"} {+ if !slices.Contains(include, want) {+ t.Errorf("include_only missing %q, got %v", want, include)+ }+ }+ // CODEX_HOME is the one home-shaped variable the daemon does own.+ if !slices.Contains(include, "CODEX_HOME") {+ t.Errorf("include_only missing CODEX_HOME, got %v", include)+ }+}+func TestCodexShellAuthorizedCustomEnvNamesUsesDaemonBlocklist(t *testing.T) {t.Parallel()diff --git a/server/internal/daemon/execenv/codex_home.go b/server/internal/daemon/execenv/codex_home.goindex 014aad1bd8..4e2afcd374 100644--- a/server/internal/daemon/execenv/codex_home.go+++ b/server/internal/daemon/execenv/codex_home.go@@ -77,12 +77,6 @@ type CodexHomeOptions struct {// task with no issue), in which case sessions/ stays task-local. See// codexSessionStoreDir and prepareCodexSessionsDir (MUL-4424).SessionStoreKey string- // WritableRoots are extra absolute paths written into the config.toml- // `[sandbox_workspace_write] writable_roots` so the workspace-write sandbox- // (Linux) can write outside the task workdir — the per-task writable HOME.- // Only meaningful when the policy resolves to workspace-write; ignored on- // darwin danger-full-access. See task_home.go and MUL-4856.- WritableRoots []string// CodexCustomArgs are the effective Codex CLI args this task will launch// with (daemon defaults + profile-fixed + per-agent custom_args). Only the// Windows sandbox decision reads them, to honor a `-c windows.sandbox=...`@@ -92,9 +86,10 @@ type CodexHomeOptions struct {}// prepareCodexHome is a thin wrapper around prepareCodexHomeWithOpts kept for-// tests that don't care about platform-aware sandbox configuration. It-// assumes a Linux-like environment where workspace-write + network_access-// works correctly.+// tests that don't care about platform-aware sandbox configuration. It pins+// GOOS to linux, which resolves to the danger-full-access default (MUL-5578),+// so the sandbox block it writes is stable regardless of the host running the+// test.func prepareCodexHome(codexHome string, logger *slog.Logger) error {return prepareCodexHomeWithOpts(codexHome, CodexHomeOptions{GOOS: "linux"}, logger)}@@ -284,7 +279,6 @@ func prepareCodexHomeWithOpts(codexHome string, opts CodexHomeOptions, logger *swinState = resolveWindowsSandboxState(configFile, configSyncErr, statSharedCodexConfig(sharedHome), opts.CodexCustomArgs, logger)}policy := codexSandboxPolicyForConfig(opts.GOOS, opts.CodexVersion, winState)- policy.WritableRoots = opts.WritableRootsif err := ensureCodexSandboxConfig(configFile, policy, opts.CodexVersion, logger); err != nil {// The managed block is the authoritative on-disk sandbox policy. If it// can't be written, config.toml keeps whatever it already had — on adiff --git a/server/internal/daemon/execenv/codex_real_home_test.go b/server/internal/daemon/execenv/codex_real_home_test.gonew file mode 100644index 0000000000..23f1effcb9--- /dev/null+++ b/server/internal/daemon/execenv/codex_real_home_test.go@@ -0,0 +1,98 @@+package execenv++import (+ "os"+ "path/filepath"+ "testing"+)++// Codex tasks keep the daemon user's real HOME on every platform. Earlier+// daemons redirected HOME/XDG into a seeded per-task `home/` directory under+// the env root so the Linux workspace-write sandbox could write to `~`; Linux+// now runs danger-full-access and that mechanism is gone (MUL-5578 / #6218).+//+// These tests pin the two halves that are easy to regress: the per-task home+// must not come back, and the task-scoped CODEX_HOME — a separate, still-live+// mechanism — must not be confused with it.++// legacyTaskHomeDirName is the directory older daemons created under the env+// root to hold the redirected HOME. Nothing writes it anymore; it is named here+// only so the tests can assert its absence.+const legacyTaskHomeDirName = "home"++func TestPrepareCodexKeepsRealHomeAndScopesOnlyCodexHome(t *testing.T) {+ // Cannot use t.Parallel() with t.Setenv.++ sharedHome := t.TempDir()+ t.Setenv("CODEX_HOME", sharedHome)++ env, err := Prepare(PrepareParams{+ WorkspacesRoot: t.TempDir(),+ WorkspaceID: "ws-codex-real-home",+ TaskID: "b1c2d3e4-f5a6-7890-bcde-f01234567890",+ AgentName: "Codex Agent",+ Provider: "codex",+ Task: TaskContextForEnv{IssueID: "real-home-test"},+ }, testLogger())+ if err != nil {+ t.Fatalf("Prepare failed: %v", err)+ }+ defer env.Cleanup(true)++ if _, err := os.Lstat(filepath.Join(env.RootDir, legacyTaskHomeDirName)); !os.IsNotExist(err) {+ t.Errorf("per-task HOME directory must not be created under the env root (err=%v)", err)+ }++ // The task-scoped CODEX_HOME is a different mechanism and stays: it is+ // managed Codex state (config, sessions, skills, MCP), not the Unix HOME.+ if want := filepath.Join(env.RootDir, codexHomeDirName); env.CodexHome != want {+ t.Errorf("CodexHome = %q, want %q", env.CodexHome, want)+ }+ if _, err := os.Stat(env.CodexHome); err != nil {+ t.Errorf("task-scoped CODEX_HOME should exist: %v", err)+ }+}++// TestReuseCodexToleratesLegacyTaskHome covers an env root prepared by an older+// daemon: its leftover `home/` directory (including the credential symlinks it+// seeded) must neither break reuse nor be adopted as a HOME again.+func TestReuseCodexToleratesLegacyTaskHome(t *testing.T) {+ // Cannot use t.Parallel() with t.Setenv.++ sharedHome := t.TempDir()+ t.Setenv("CODEX_HOME", sharedHome)++ env, err := Prepare(PrepareParams{+ WorkspacesRoot: t.TempDir(),+ WorkspaceID: "ws-codex-legacy-home",+ TaskID: "c1d2e3f4-a5b6-7890-cdef-012345678901",+ AgentName: "Codex Agent",+ Provider: "codex",+ Task: TaskContextForEnv{IssueID: "legacy-home-test"},+ }, testLogger())+ if err != nil {+ t.Fatalf("Prepare failed: %v", err)+ }+ defer env.Cleanup(true)++ // Simulate what an older daemon left behind.+ legacyHome := filepath.Join(env.RootDir, legacyTaskHomeDirName)+ if err := os.MkdirAll(filepath.Join(legacyHome, ".config"), 0o700); err != nil {+ t.Fatalf("seed legacy task home: %v", err)+ }+ if err := os.WriteFile(filepath.Join(legacyHome, ".npmrc"), []byte("//registry:_authToken=x\n"), 0o600); err != nil {+ t.Fatalf("seed legacy .npmrc: %v", err)+ }++ reused := Reuse(ReuseParams{+ WorkDir: env.WorkDir,+ Provider: "codex",+ Task: TaskContextForEnv{IssueID: "legacy-home-test"},+ }, testLogger())+ if reused == nil {+ t.Fatal("Reuse returned nil on an env root carrying a legacy task home")+ }+ if reused.CodexHome == "" {+ t.Error("expected CodexHome to be restored on reuse")+ }+}diff --git a/server/internal/daemon/execenv/codex_sandbox.go b/server/internal/daemon/execenv/codex_sandbox.goindex 99b251ca29..c2c6bd8c16 100644--- a/server/internal/daemon/execenv/codex_sandbox.go+++ b/server/internal/daemon/execenv/codex_sandbox.go@@ -22,9 +22,10 @@ import (//// Until a fixed Codex release ships, the per-task Codex config on macOS needs// to fall back to `sandbox_mode = "danger-full-access"` so the agent can-// actually reach the Multica API. On Linux (and on macOS once the upstream-// fix is released), the normal `workspace-write` + `network_access = true`-// combo is preferred because it keeps the filesystem sandbox intact.+// actually reach the Multica API.+//+// Linux runs danger-full-access as a deliberate product decision (MUL-5578,+// #6218), not as a compatibility fallback — see codexSandboxPolicyFor.//// CodexDarwinNetworkAccessFixedVersion is the earliest Codex CLI version in// which `network_access = true` is honored under Seatbelt on macOS. Bump this@@ -40,15 +41,6 @@ type codexSandboxPolicy struct {// NetworkAccess controls `[sandbox_workspace_write] network_access`.// Only meaningful when Mode is "workspace-write".NetworkAccess bool- // WritableRoots are extra absolute paths added to- // `[sandbox_workspace_write] writable_roots`, granting write access outside- // the sandbox cwd (the task workdir). Under workspace-write (Linux Landlock)- // everything outside the cwd is read-only, which breaks tools that write to- // $HOME (npm, Prisma). The daemon points this at the per-task writable HOME.- // Only emitted when Mode is "workspace-write"; empty on darwin- // danger-full-access, where the filesystem is not sandboxed at all. See- // task_home.go.- WritableRoots []string// Reason is a short human-readable label used in warn-level logs.Reason string// Hint is an optional, actionable remediation surfaced in warn-level logs@@ -73,8 +65,18 @@ func resolveGOOS(goos string) string {// detected Codex CLI version. It is the platform baseline; per-task user config// can refine it (see codexSandboxPolicyForConfig).//-// - Linux: workspace-write with network access. Landlock enforces the-// filesystem sandbox and is not affected by the macOS Seatbelt bug.+// - Linux (and any other non-darwin, non-windows platform):+// danger-full-access on the daemon user's real HOME. Landlock could enforce+// workspace-write here, but enforcing it meant redirecting HOME/XDG per task+// and seeding a hand-maintained allowlist of credential paths back into it,+// which left every un-listed host CLI (aws, kube, gcloud, glab, rclone, …)+// unconfigured inside tasks and could not converge. The containment it+// bought was also narrower than it looked: workspace-write restricts writes+// only — reads and network were already unrestricted, so credentials under+// the real HOME were readable and exfiltratable regardless. The task+// filesystem boundary is therefore the boundary the daemon itself runs+// inside (VM, container, or dedicated Unix user), matching macOS/Windows.+// See MUL-5578 / #6218, and apps/docs security-model.// - Windows: danger-full-access, as a deliberate compatibility choice.// Codex ships a native Windows sandbox (windows.sandbox = "unelevated" via// a Restricted Token, or "elevated"), but it is still experimental with@@ -105,9 +107,9 @@ func codexSandboxPolicyFor(goos, detectedVersion string) codexSandboxPolicy {}if goos != "darwin" {return codexSandboxPolicy{- Mode: "workspace-write",- NetworkAccess: true,- Reason: "non-darwin platform — seatbelt bug does not apply",+ Mode: "danger-full-access",+ Reason: "codex on " + goos + ": tasks run with the daemon user's real HOME and full filesystem access; isolation comes from the boundary the daemon runs inside (MUL-5578)",+ Hint: codexLinuxIsolationHint(),}}if codexDarwinNetworkAccessFixed(detectedVersion) {@@ -316,6 +318,13 @@ func codexUpgradeHint() string {return "upgrade Codex CLI (e.g. `brew upgrade codex` or `npm i -g @openai/codex`) once a release including openai/codex#10390 is available to restore workspace-write + network_access"}+// codexLinuxIsolationHint returns the actionable remediation for the Linux+// full-access default: unlike the macOS bug, there is no version to upgrade to —+// the containment has to come from the boundary the daemon runs inside.+func codexLinuxIsolationHint() string {+ return "run the daemon inside a VM, container, or dedicated Unix user — tasks can read and write everything that user can"+}+// multicaManagedBeginMarker / multicaManagedEndMarker delimit the block the// daemon writes into the per-task config.toml. Everything between the markers// is owned by the daemon and will be rewritten idempotently; anything outside@@ -347,29 +356,12 @@ func renderMulticaManagedBlock(policy codexSandboxPolicy) string {b.WriteString(fmt.Sprintf("sandbox_mode = %q\n", policy.Mode))if policy.Mode == "workspace-write" {b.WriteString(fmt.Sprintf("sandbox_workspace_write.network_access = %t\n", policy.NetworkAccess))- if len(policy.WritableRoots) > 0 {- b.WriteString("sandbox_workspace_write.writable_roots = ")- b.WriteString(renderTomlStringArray(policy.WritableRoots))- b.WriteString("\n")- }}b.WriteString(multicaManagedEndMarker)b.WriteString("\n")return b.String()}-// renderTomlStringArray renders a TOML inline array of basic strings, e.g.-// ["/a/b", "/c d"]. Each element is quoted with Go's %q, whose escaping (\\,-// \", \n, …) is a subset of TOML basic-string escaping, so ordinary-// filesystem paths — including ones with spaces — round-trip safely.-func renderTomlStringArray(vals []string) string {- parts := make([]string, len(vals))- for i, v := range vals {- parts[i] = fmt.Sprintf("%q", v)- }- return "[" + strings.Join(parts, ", ") + "]"-}-// managedBlockRe captures the daemon-owned block (including the surrounding// markers and any trailing blank lines) so it can be replaced idempotently.// `\n*` rather than `\n?` so reruns don't accumulate blank lines when the@@ -441,8 +433,10 @@ func stripLegacySandboxDirectives(content string) string {// twice produces the same file contents. The file is created if it doesn't// exist.//-// The function logs (at warn level) when it falls back to danger-full-access-// on macOS so the incident is visible in daemon logs.+// The function logs (at warn level) whenever the resolved mode is+// danger-full-access — the Linux default, the macOS seatbelt fallback, and the+// Windows no-native-sandbox fallback alike — so that every unsandboxed task is+// visible in daemon logs.func ensureCodexSandboxConfig(configPath string, policy codexSandboxPolicy, detectedVersion string, logger *slog.Logger) error {data, err := os.ReadFile(configPath)if err != nil && !os.IsNotExist(err) {diff --git a/server/internal/daemon/execenv/execenv.go b/server/internal/daemon/execenv/execenv.goindex 96f3ddb597..202f2a779b 100644--- a/server/internal/daemon/execenv/execenv.go+++ b/server/internal/daemon/execenv/execenv.go@@ -203,14 +203,6 @@ type Environment struct {// ClaudeSettingsPath is a task-local --settings JSON file that applies// disabled runtime-skill policy without mutating the user's Claude config.ClaudeSettingsPath string- // TaskHome is the per-task writable HOME directory (set only for the codex- // provider on Linux, where the workspace-write Landlock sandbox makes the- // real HOME read-only). When non-empty the daemon redirects- // HOME/XDG/npm_config_cache here so tools that write to `~` (npm, Prisma, …)- // land in a sandbox-writable location. Empty on macOS/Windows and for- // non-sandboxed providers, where the real HOME stays in place. See- // task_home.go and MUL-4856.- TaskHome string// OpenclawConfigPath is the path to the per-task synthesized OpenClaw// config (set only for openclaw provider). The daemon exports this as// OPENCLAW_CONFIG_PATH on the openclaw subprocess so its native skill@@ -344,15 +336,7 @@ func Prepare(params PrepareParams, logger *slog.Logger) (*Environment, error) {// For Codex, set up a per-task CODEX_HOME seeded from ~/.codex/ with skills.if params.Provider == "codex" {codexHome := filepath.Join(envRoot, codexHomeDirName)- // Under the Linux workspace-write sandbox the real HOME is read-only;- // give the task a writable HOME and grant write access to it in the- // Codex config so npm/Prisma can write their caches (MUL-4856).- taskHome, writableRoots, err := prepareCodexSandboxHome(envRoot, "", params.CodexVersion, logger)- if err != nil {- return nil, fmt.Errorf("execenv: prepare task home: %w", err)- }- env.TaskHome = taskHome- if err := prepareCodexHomeWithOpts(codexHome, CodexHomeOptions{CodexVersion: params.CodexVersion, IsLocalDirectory: params.LocalWorkDir != "", SessionStoreKey: codexSessionStoreKey(params.Profile, params.Task.AgentID, params.Task.IssueID), WritableRoots: writableRoots, CodexCustomArgs: params.CodexCustomArgs}, logger); err != nil {+ if err := prepareCodexHomeWithOpts(codexHome, CodexHomeOptions{CodexVersion: params.CodexVersion, IsLocalDirectory: params.LocalWorkDir != "", SessionStoreKey: codexSessionStoreKey(params.Profile, params.Task.AgentID, params.Task.IssueID), CodexCustomArgs: params.CodexCustomArgs}, logger); err != nil {return nil, fmt.Errorf("execenv: prepare codex-home: %w", err)}if err := hydrateCodexSkills(codexHome, params.Task.AgentSkills, params.Task.DisabledRuntimeSkills, logger); err != nil {@@ -568,15 +552,7 @@ func Reuse(params ReuseParams, logger *slog.Logger) *Environment {// config (especially sandbox/network access) is up to date.if params.Provider == "codex" {codexHome := filepath.Join(env.RootDir, codexHomeDirName)- // Refresh the per-task writable HOME (re-seed credential symlinks in- // case the user's real home changed) and recompute the sandbox- // writable_roots on reuse, mirroring the fresh Prepare path (MUL-4856).- taskHome, writableRoots, err := prepareCodexSandboxHome(env.RootDir, "", params.CodexVersion, logger)- if err != nil {- logger.Warn("execenv: refresh task home failed", "error", err)- }- env.TaskHome = taskHome- if err := prepareCodexHomeWithOpts(codexHome, CodexHomeOptions{CodexVersion: params.CodexVersion, ResumeSessionID: params.ResumeSessionID, IsLocalDirectory: params.LocalDirectory, SessionStoreKey: codexSessionStoreKey(params.Profile, params.Task.AgentID, params.Task.IssueID), WritableRoots: writableRoots, CodexCustomArgs: params.CodexCustomArgs}, logger); err != nil {+ if err := prepareCodexHomeWithOpts(codexHome, CodexHomeOptions{CodexVersion: params.CodexVersion, ResumeSessionID: params.ResumeSessionID, IsLocalDirectory: params.LocalDirectory, SessionStoreKey: codexSessionStoreKey(params.Profile, params.Task.AgentID, params.Task.IssueID), CodexCustomArgs: params.CodexCustomArgs}, logger); err != nil {logger.Warn("execenv: refresh codex-home failed", "error", err)} else {env.CodexHome = codexHomediff --git a/server/internal/daemon/execenv/execenv_test.go b/server/internal/daemon/execenv/execenv_test.goindex c4eaf9fefa..37b41d95a2 100644--- a/server/internal/daemon/execenv/execenv_test.go+++ b/server/internal/daemon/execenv/execenv_test.go@@ -2296,14 +2296,14 @@ func TestPrepareCodexHomeSeedsFromShared(t *testing.T) {t.Errorf("config.json content = %q", data)}- // config.toml should be copied and have network access appended.+ // config.toml should be copied and have the managed sandbox block prepended.data, _ = os.ReadFile(filepath.Join(codexHome, "config.toml"))tomlStr := string(data)if !strings.Contains(tomlStr, `model = "o3"`) {t.Errorf("config.toml missing original model setting, got: %q", tomlStr)}- if !strings.Contains(tomlStr, "network_access = true") {- t.Errorf("config.toml missing network_access, got: %q", tomlStr)+ if !strings.Contains(tomlStr, "sandbox_mode = ") {+ t.Errorf("config.toml missing managed sandbox_mode, got: %q", tomlStr)}// instructions.md should be copied.@@ -2757,18 +2757,14 @@ func TestEnsureCodexSandboxConfigCreatesDefaultLinux(t *testing.T) {if !strings.Contains(s, multicaManagedBeginMarker) || !strings.Contains(s, multicaManagedEndMarker) {t.Errorf("missing managed block markers, got:\n%s", s)}- if !strings.Contains(s, `sandbox_mode = "workspace-write"`) {+ if !strings.Contains(s, `sandbox_mode = "danger-full-access"`) {t.Error("missing sandbox_mode")}- // The managed block uses TOML dotted-key form rather than a- // `[sandbox_workspace_write]` section header so it cannot leak into or- // inherit from any surrounding table scope. See upsertMulticaManagedBlock- // for why.- if strings.Contains(s, "[sandbox_workspace_write]") {- t.Errorf("managed block must not open a [sandbox_workspace_write] table header, got:\n%s", s)- }- if !strings.Contains(s, "sandbox_workspace_write.network_access = true") {- t.Errorf("missing dotted-key network_access = true, got:\n%s", s)+ // Linux tasks run unsandboxed on the daemon user's real HOME, so nothing+ // under sandbox_workspace_write applies — neither the table header nor the+ // dotted-key form should be emitted (MUL-5578).+ if strings.Contains(s, "sandbox_workspace_write") {+ t.Errorf("must not emit any sandbox_workspace_write key under danger-full-access, got:\n%s", s)}}@@ -2904,8 +2900,8 @@ approval_policy = "on-failure"if !strings.Contains(s, "approval_policy") {t.Error("lost existing approval_policy")}- if !strings.Contains(s, "network_access = true") {- t.Error("missing network_access = true")+ if !strings.Contains(s, `sandbox_mode = "danger-full-access"`) {+ t.Error("missing managed sandbox_mode")}}@@ -3060,14 +3056,16 @@ func TestCodexSandboxPolicyFor(t *testing.T) {version stringwantMode stringwantNet bool- // wantHint is whether the policy carries an actionable upgrade hint.- // Only the macOS seatbelt fallback has one; the Windows compatibility- // fallback has no generic upgrade action, so it must not surface a- // misleading macOS hint.+ // wantHint is whether the policy carries an actionable remediation hint.+ // macOS points at a Codex upgrade and Linux at running the daemon inside+ // an outer boundary; the Windows compatibility fallback has no generic+ // action, so it must not surface a misleading macOS hint.wantHint bool}{- {"linux any version", "linux", "0.100.0", "workspace-write", true, false},- {"linux unknown version", "linux", "", "workspace-write", true, false},+ // Linux runs unsandboxed by product decision, on any Codex version+ // (MUL-5578) — there is no version-dependent branch to exercise here.+ {"linux any version", "linux", "0.100.0", "danger-full-access", false, true},+ {"linux unknown version", "linux", "", "danger-full-access", false, true},{"windows any version", "windows", "0.144.5", "danger-full-access", false, false},{"windows unknown version", "windows", "", "danger-full-access", false, false},{"darwin old version", "darwin", "0.121.0", "danger-full-access", false, true},@@ -3108,7 +3106,7 @@ func TestCodexSandboxPolicyForConfig(t *testing.T) {{"windows undecidable fails closed", "windows", windowsSandboxUndecidable, "workspace-write", true},{"windows absent falls back", "windows", windowsSandboxAbsent, "danger-full-access", false},// Non-Windows platforms ignore winState entirely.- {"linux ignores winState", "linux", windowsSandboxNative, "workspace-write", true},+ {"linux ignores winState", "linux", windowsSandboxNative, "danger-full-access", false},{"darwin ignores winState", "darwin", windowsSandboxNative, "danger-full-access", false},}for _, tc := range cases {@@ -3363,7 +3361,12 @@ func TestPrepareCodexHomeFailsClosedWhenSandboxWriteFails(t *testing.T) {}}-func TestPrepareCodexHomeEnsuresNetworkAccess(t *testing.T) {+// TestPrepareCodexHomeWritesManagedSandboxBlock checks that preparing a codex+// home wires the resolved policy all the way into config.toml. With an empty+// shared home the resolved mode is danger-full-access on every platform — Linux+// and macOS by their own defaults, Windows because no native windows.sandbox is+// configured — so the expectation is host-independent.+func TestPrepareCodexHomeWritesManagedSandboxBlock(t *testing.T) {// Cannot use t.Parallel() with t.Setenv.// Empty shared home — no config.toml to copy.@@ -3371,22 +3374,25 @@ func TestPrepareCodexHomeEnsuresNetworkAccess(t *testing.T) {t.Setenv("CODEX_HOME", sharedHome)codexHome := filepath.Join(t.TempDir(), "codex-home")- // Default prepareCodexHome assumes linux-like behavior.if err := prepareCodexHome(codexHome, testLogger()); err != nil {t.Fatalf("prepareCodexHome failed: %v", err)}- // config.toml should be created with network access defaults.data, err := os.ReadFile(filepath.Join(codexHome, "config.toml"))if err != nil {t.Fatalf("config.toml not created: %v", err)}s := string(data)- if !strings.Contains(s, "network_access = true") {- t.Error("config.toml missing network_access = true")+ if !strings.Contains(s, multicaManagedBeginMarker) {+ t.Errorf("config.toml missing managed block, got:\n%s", s)+ }+ if !strings.Contains(s, `sandbox_mode = "danger-full-access"`) {+ t.Errorf("config.toml missing danger-full-access sandbox_mode, got:\n%s", s)}- if !strings.Contains(s, `sandbox_mode = "workspace-write"`) {- t.Error("config.toml missing sandbox_mode")+ // Nothing under sandbox_workspace_write applies when the filesystem is not+ // sandboxed; emitting it would imply containment that does not exist.+ if strings.Contains(s, "sandbox_workspace_write") {+ t.Errorf("config.toml must not emit sandbox_workspace_write under danger-full-access, got:\n%s", s)}}diff --git a/server/internal/daemon/execenv/task_home.go b/server/internal/daemon/execenv/task_home.godeleted file mode 100644index 3490da6f6b..0000000000--- a/server/internal/daemon/execenv/task_home.go+++ /dev/null@@ -1,168 +0,0 @@-package execenv--import (- "fmt"- "log/slog"- "os"- "path/filepath"- "runtime"-)--// Background (MUL-4856)-//-// On Linux the Codex sandbox runs in `workspace-write` mode (Landlock): every-// path outside the task workdir (the sandbox cwd) is read-only. The agent's-// real $HOME is therefore read-only, which breaks the standard tools that write-// under `~` by default:-//-// - npm writes `~/.npm/_cacache` → EROFS on `npm install`.-// - Prisma hardcodes `os.homedir()/.cache/prisma` (it ignores XDG) → EROFS on-// `prisma generate`. Only redirecting HOME can fix Prisma.-//-// Reads are unrestricted under workspace-write — only writes are sandboxed — so-// the fix is to (1) give each task a writable HOME under its env root, (2) point-// HOME/XDG/npm_config_cache at it, and (3) add that home to the Codex-// `writable_roots` (it lives outside the cwd, so it needs an explicit grant).-// Because the redirected HOME is otherwise empty, we seed it with symlinks to-// the user's real credential/identity files so private-registry `npm install`-// (and git/gh reads, when git is usable) keep working — reads through the-// symlink resolve the real file, which stays read-only, and those flows only-// read them. This mirrors the existing per-task CODEX_HOME seeding precedent.-//-// Scope: Linux codex only. macOS Codex uses danger-full-access (no filesystem-// sandbox), and Windows has no Landlock sandbox (and unreliable symlink-// permissions), so neither needs — nor should get — a redirected HOME. Other-// providers are not sandboxed either.-//-// `git commit` inside a linked worktree has the same root sandbox constraint:-// Codex resolves the worktree's `.git` pointer and keeps the external gitdir-// read-only even inside a writable_root. The repo checkout path handles that-// separately by giving Linux Codex tasks an isolated, task-local `.git`-// directory instead of widening this writable-root grant (#2925).--// taskHomeSeedEntries are top-level entries symlinked from the user's real home-// into the per-task HOME so credential/identity reads keep resolving after HOME-// is redirected. Best-effort: missing sources are skipped. Writable cache dirs-// (.npm, .cache, .local) are intentionally NOT seeded — tools create them fresh-// inside the writable task home.-var taskHomeSeedEntries = []string{- ".gitconfig", // git identity, aliases, credential.helper, url rewrites- ".npmrc", // npm registry + auth token- ".netrc", // https credentials for git/curl- ".git-credentials", // git credential store helper- ".ssh", // ssh keys/config for git over ssh (directory)-}--// taskHomeConfigSeedEntries are `~/.config/<name>` subdirectories symlinked into-// the per-task `.config` (XDG_CONFIG_HOME) so config-in-XDG tools keep their-// auth after XDG_CONFIG_HOME is redirected. Best-effort: missing sources are-// skipped.-var taskHomeConfigSeedEntries = []string{- "gh", // GitHub CLI auth (hosts.yml) used as a git credential helper- "git", // XDG git config location-}--// prepareTaskHome creates a writable per-task HOME directory and seeds it with-// symlinks to the user's real credential/identity files so tools that write to-// `~` land in a sandbox-writable location while still reading the user's real-// git/npm/ssh credentials. Best-effort: seeding failures are logged, not fatal —-// the writable home still resolves the EROFS problem for cache writes even if a-// particular credential source is absent.-func prepareTaskHome(taskHome string, logger *slog.Logger) error {- if err := os.MkdirAll(taskHome, 0o700); err != nil {- return fmt.Errorf("create task home: %w", err)- }-- sharedHome, err := os.UserHomeDir()- if err != nil || sharedHome == "" {- // No real home to seed from — the writable home still fixes cache- // writes; git identity / credentials simply aren't seeded.- if logger != nil {- logger.Warn("execenv: task home: no user home to seed credentials from", "error", err)- }- return nil- }-- for _, name := range taskHomeSeedEntries {- src := filepath.Join(sharedHome, name)- if _, err := os.Lstat(src); err != nil {- continue // best-effort: skip missing sources- }- if err := ensureSymlink(src, filepath.Join(taskHome, name)); err != nil && logger != nil {- logger.Warn("execenv: task home: seed symlink failed", "entry", name, "error", err)- }- }-- // Seed read-shared XDG config subdirs (gh auth, git config) under a real,- // writable .config so other tools can still create new config there while- // gh/git resolve the user's existing auth through the symlinks.- configDir := filepath.Join(taskHome, ".config")- if err := os.MkdirAll(configDir, 0o700); err != nil {- if logger != nil {- logger.Warn("execenv: task home: create .config failed", "error", err)- }- return nil- }- sharedConfig := filepath.Join(sharedHome, ".config")- for _, name := range taskHomeConfigSeedEntries {- src := filepath.Join(sharedConfig, name)- if _, err := os.Lstat(src); err != nil {- continue // best-effort: skip missing sources- }- if err := ensureSymlink(src, filepath.Join(configDir, name)); err != nil && logger != nil {- logger.Warn("execenv: task home: seed .config symlink failed", "entry", name, "error", err)- }- }-- return nil-}--// TaskHomeEnv returns the environment overrides that redirect a task's HOME and-// XDG base dirs into the per-task writable home. The daemon layers these onto-// the agent's environment so npm, Prisma, and other tools that default to `~`-// write into the sandbox-writable home instead of the read-only real one.-//-// XDG_* are set explicitly (not left to derive from HOME) so an inherited-// XDG_CACHE_HOME/etc. pointing at the read-only real home cannot win. Likewise-// npm_config_cache is set explicitly to override any inherited value.-func TaskHomeEnv(taskHome string) map[string]string {- return map[string]string{- "HOME": taskHome,- "XDG_CACHE_HOME": filepath.Join(taskHome, ".cache"),- "XDG_CONFIG_HOME": filepath.Join(taskHome, ".config"),- "XDG_DATA_HOME": filepath.Join(taskHome, ".local", "share"),- "XDG_STATE_HOME": filepath.Join(taskHome, ".local", "state"),- "npm_config_cache": filepath.Join(taskHome, ".npm"),- }-}--// prepareCodexSandboxHome sets up the per-task writable HOME and computes the-// Codex `writable_roots`, but only for Linux codex under the workspace-write-// sandbox. On macOS (danger-full-access) and Windows (no Landlock sandbox) it-// returns an empty home and nil roots, and the caller leaves the real HOME in-// place. goos defaults to runtime.GOOS; it is a parameter so tests can exercise-// each platform deterministically.-//-// It returns the task home path (empty when no redirect is needed) and the-// writable roots to add to the config.toml — just the task home, which lives-// outside the sandbox cwd and is not a git metadata dir, so Codex does not-// re-protect it.-func prepareCodexSandboxHome(envRoot, goos, codexVersion string, logger *slog.Logger) (taskHome string, writableRoots []string, err error) {- if envRoot == "" {- // No task env root to anchor the home under (legacy local_directory- // reuse fallback). Leave the real HOME in place.- return "", nil, nil- }- if goos == "" {- goos = runtime.GOOS- }- if goos != "linux" || codexSandboxPolicyFor(goos, codexVersion).Mode != "workspace-write" {- return "", nil, nil- }-- taskHome = filepath.Join(envRoot, "home")- if err := prepareTaskHome(taskHome, logger); err != nil {- return "", nil, err- }- return taskHome, []string{taskHome}, nil-}diff --git a/server/internal/daemon/execenv/task_home_test.go b/server/internal/daemon/execenv/task_home_test.godeleted file mode 100644index ff8fe58224..0000000000--- a/server/internal/daemon/execenv/task_home_test.go+++ /dev/null@@ -1,253 +0,0 @@-package execenv--import (- "os"- "path/filepath"- "strings"- "testing"-- "github.com/pelletier/go-toml/v2"-)--// TestRenderManagedBlockWritableRoots verifies the workspace-write managed block-// emits writable_roots as a top-level dotted key (never a table header) and that-// the result — including the network_access dotted key sharing the same implicit-// table — is valid TOML.-func TestRenderManagedBlockWritableRoots(t *testing.T) {- t.Parallel()- policy := codexSandboxPolicyFor("linux", "0.121.0")- policy.WritableRoots = []string{"/home/u/multica_workspaces/ws/abc/home", "/home/u/multica_workspaces/.repos/ws"}-- block := renderMulticaManagedBlock(policy)-- if !strings.Contains(block, `sandbox_workspace_write.writable_roots = ["/home/u/multica_workspaces/ws/abc/home", "/home/u/multica_workspaces/.repos/ws"]`) {- t.Errorf("missing dotted-key writable_roots array, got:\n%s", block)- }- if strings.Contains(block, "[sandbox_workspace_write]") {- t.Errorf("must not open a [sandbox_workspace_write] table header, got:\n%s", block)- }-- // Both network_access and writable_roots build the same implicit table via- // dotted keys — assert the parser accepts it.- var parsed map[string]any- if err := toml.Unmarshal([]byte(block[strings.Index(block, "sandbox_mode"):]), &parsed); err != nil {- t.Fatalf("generated block is invalid TOML: %v\nblock:\n%s", err, block)- }- sww, ok := parsed["sandbox_workspace_write"].(map[string]any)- if !ok {- t.Fatalf("sandbox_workspace_write not parsed as a table: %#v", parsed["sandbox_workspace_write"])- }- roots, ok := sww["writable_roots"].([]any)- if !ok || len(roots) != 2 {- t.Fatalf("writable_roots did not round-trip as a 2-element array: %#v", sww["writable_roots"])- }-}--// TestRenderManagedBlockNoWritableRoots verifies that with no writable roots (or-// under danger-full-access), the writable_roots key is omitted entirely.-func TestRenderManagedBlockNoWritableRoots(t *testing.T) {- t.Parallel()-- linux := renderMulticaManagedBlock(codexSandboxPolicyFor("linux", "0.121.0"))- if strings.Contains(linux, "writable_roots") {- t.Errorf("workspace-write with no roots must omit writable_roots, got:\n%s", linux)- }-- // danger-full-access must never emit workspace-write keys even if roots set.- darwin := codexSandboxPolicyFor("darwin", "0.121.0")- darwin.WritableRoots = []string{"/should/not/appear"}- block := renderMulticaManagedBlock(darwin)- if strings.Contains(block, "writable_roots") || strings.Contains(block, "sandbox_workspace_write") {- t.Errorf("danger-full-access must omit all workspace-write keys, got:\n%s", block)- }-}--// TestEnsureCodexSandboxConfigWritableRoots verifies the writable_roots flow all-// the way through ensureCodexSandboxConfig into the on-disk config.toml.-func TestEnsureCodexSandboxConfigWritableRoots(t *testing.T) {- t.Parallel()- dir := t.TempDir()- configPath := filepath.Join(dir, "config.toml")-- policy := codexSandboxPolicyFor("linux", "0.121.0")- policy.WritableRoots = []string{filepath.Join(dir, "home"), filepath.Join(dir, "repos")}- if err := ensureCodexSandboxConfig(configPath, policy, "0.121.0", testLogger()); err != nil {- t.Fatalf("ensureCodexSandboxConfig failed: %v", err)- }-- data, err := os.ReadFile(configPath)- if err != nil {- t.Fatalf("read config.toml: %v", err)- }- if !strings.Contains(string(data), "sandbox_workspace_write.writable_roots = [") {- t.Errorf("config.toml missing writable_roots, got:\n%s", data)- }- // Whole file must be valid TOML (the managed block coexists with any user- // content — here there is none, so parsing the file directly is enough).- var parsed map[string]any- if err := toml.Unmarshal(data, &parsed); err != nil {- t.Fatalf("on-disk config.toml is invalid TOML: %v", err)- }-}--// TestPrepareCodexSandboxHomeLinux verifies the Linux path creates a writable-// home and returns exactly that home as the only writable root (no repo cache —-// Codex re-protects resolved gitdirs, so writable_roots can't unblock git; see-// task_home.go / #2925).-func TestPrepareCodexSandboxHomeLinux(t *testing.T) {- // Not parallel: mutates HOME via os.UserHomeDir seeding in prepareTaskHome.- fakeHome := t.TempDir()- t.Setenv("HOME", fakeHome)-- envRoot := t.TempDir()- home, roots, err := prepareCodexSandboxHome(envRoot, "linux", "", testLogger())- if err != nil {- t.Fatalf("prepareCodexSandboxHome: %v", err)- }-- wantHome := filepath.Join(envRoot, "home")- if home != wantHome {- t.Errorf("home = %q, want %q", home, wantHome)- }- if fi, err := os.Stat(home); err != nil || !fi.IsDir() {- t.Errorf("task home dir not created: err=%v", err)- }- if len(roots) != 1 || roots[0] != wantHome {- t.Errorf("writable roots = %v, want [%q]", roots, wantHome)- }-}--// TestPrepareCodexSandboxHomeNonLinux verifies macOS and Windows skip the-// redirect entirely (real HOME stays writable / no Landlock sandbox), and that-// no home directory is created.-func TestPrepareCodexSandboxHomeNonLinux(t *testing.T) {- for _, goos := range []string{"darwin", "windows"} {- t.Run(goos, func(t *testing.T) {- envRoot := t.TempDir()- home, roots, err := prepareCodexSandboxHome(envRoot, goos, "", testLogger())- if err != nil {- t.Fatalf("prepareCodexSandboxHome(%s): %v", goos, err)- }- if home != "" || roots != nil {- t.Fatalf("%s should skip the writable home, got home=%q roots=%v", goos, home, roots)- }- if _, err := os.Stat(filepath.Join(envRoot, "home")); !os.IsNotExist(err) {- t.Errorf("%s must not create a task home dir, stat err=%v", goos, err)- }- })- }-}--// TestPrepareTaskHomeSeedsCredentials verifies the per-task home is created-// writable and seeded with symlinks to the user's real credential/config files,-// skipping missing sources.-func TestPrepareTaskHomeSeedsCredentials(t *testing.T) {- fakeHome := t.TempDir()- // Present sources (writeFile creates parent dirs, so .ssh and .config/gh- // become directories).- writeFile(t, filepath.Join(fakeHome, ".gitconfig"), "[user]\n\tname = X\n")- writeFile(t, filepath.Join(fakeHome, ".npmrc"), "//registry/:_authToken=abc\n")- writeFile(t, filepath.Join(fakeHome, ".ssh", "id_ed25519"), "KEY\n")- writeFile(t, filepath.Join(fakeHome, ".config", "gh", "hosts.yml"), "github.com: {}\n")- // .netrc and .config/git deliberately absent — must be skipped.-- t.Setenv("HOME", fakeHome)-- taskHome := filepath.Join(t.TempDir(), "home")- if err := prepareTaskHome(taskHome, testLogger()); err != nil {- t.Fatalf("prepareTaskHome: %v", err)- }-- assertSymlinkTo(t, filepath.Join(taskHome, ".gitconfig"), filepath.Join(fakeHome, ".gitconfig"))- assertSymlinkTo(t, filepath.Join(taskHome, ".npmrc"), filepath.Join(fakeHome, ".npmrc"))- assertSymlinkTo(t, filepath.Join(taskHome, ".ssh"), filepath.Join(fakeHome, ".ssh"))- assertSymlinkTo(t, filepath.Join(taskHome, ".config", "gh"), filepath.Join(fakeHome, ".config", "gh"))-- // A read through the .gitconfig symlink resolves the real content.- if b, err := os.ReadFile(filepath.Join(taskHome, ".gitconfig")); err != nil || !strings.Contains(string(b), "name = X") {- t.Errorf("gitconfig not readable through symlink: %q err=%v", b, err)- }-- // Missing sources are skipped, not linked as broken symlinks.- if _, err := os.Lstat(filepath.Join(taskHome, ".netrc")); !os.IsNotExist(err) {- t.Errorf(".netrc should be skipped (missing source), lstat err=%v", err)- }- if _, err := os.Lstat(filepath.Join(taskHome, ".config", "git")); !os.IsNotExist(err) {- t.Errorf(".config/git should be skipped (missing source), lstat err=%v", err)- }-- // .config must be a real, writable directory (not a symlink) so other tools- // can write new config there.- fi, err := os.Lstat(filepath.Join(taskHome, ".config"))- if err != nil {- t.Fatalf(".config not created: %v", err)- }- if fi.Mode()&os.ModeSymlink != 0 {- t.Error(".config must be a real directory, not a symlink")- }- // The task home is writable: creating a cache file under it succeeds.- if err := os.MkdirAll(filepath.Join(taskHome, ".cache", "prisma"), 0o755); err != nil {- t.Errorf("task home not writable: %v", err)- }-}--// TestPrepareTaskHomeNoRealHome verifies prepareTaskHome degrades gracefully when-// there is no user home to seed from — the writable home is still created.-func TestPrepareTaskHomeNoRealHome(t *testing.T) {- // An empty HOME makes os.UserHomeDir fail on unix.- t.Setenv("HOME", "")-- taskHome := filepath.Join(t.TempDir(), "home")- if err := prepareTaskHome(taskHome, testLogger()); err != nil {- t.Fatalf("prepareTaskHome should not fail without a real home: %v", err)- }- if fi, err := os.Stat(taskHome); err != nil || !fi.IsDir() {- t.Errorf("task home not created without a real home: err=%v", err)- }-}--func TestTaskHomeEnv(t *testing.T) {- t.Parallel()- home := filepath.FromSlash("/tmp/task/home")- env := TaskHomeEnv(home)-- want := map[string]string{- "HOME": home,- "XDG_CACHE_HOME": filepath.Join(home, ".cache"),- "XDG_CONFIG_HOME": filepath.Join(home, ".config"),- "XDG_DATA_HOME": filepath.Join(home, ".local", "share"),- "XDG_STATE_HOME": filepath.Join(home, ".local", "state"),- "npm_config_cache": filepath.Join(home, ".npm"),- }- for k, v := range want {- if env[k] != v {- t.Errorf("TaskHomeEnv[%q] = %q, want %q", k, env[k], v)- }- }- if len(env) != len(want) {- t.Errorf("TaskHomeEnv returned %d keys, want %d: %v", len(env), len(want), env)- }-}--// --- helpers -----func assertSymlinkTo(t *testing.T, link, wantTarget string) {- t.Helper()- fi, err := os.Lstat(link)- if err != nil {- t.Errorf("expected symlink %s: %v", link, err)- return- }- if fi.Mode()&os.ModeSymlink == 0 {- t.Errorf("%s is not a symlink", link)- return- }- target, err := os.Readlink(link)- if err != nil {- t.Errorf("readlink %s: %v", link, err)- return- }- if target != wantTarget {- t.Errorf("symlink %s -> %s, want %s", link, target, wantTarget)- }-}diff --git a/server/internal/service/builtin_skills/multica-runtimes-and-repos/SKILL.md b/server/internal/service/builtin_skills/multica-runtimes-and-repos/SKILL.mdindex d905e1bea1..6d06dcb3de 100644--- a/server/internal/service/builtin_skills/multica-runtimes-and-repos/SKILL.md+++ b/server/internal/service/builtin_skills/multica-runtimes-and-repos/SKILL.md@@ -45,7 +45,7 @@ multica repo checkout <url>multica repo checkout <url> --ref <branch-or-sha>```-`runtime update` and `runtime delete` are writes. Starting a runtime update is limited to its owner or a workspace owner/admin; the original initiator may keep polling that specific in-flight request if their admin role changes. `runtime delete` removes a runtime registration; if active agents are still bound, it refuses unless the user explicitly passes `--cascade`, which archives those agents and cancels their queued/running tasks before deleting the runtime. `repo checkout` creates a dedicated branch in the task working directory. Most runtimes use a linked worktree; Linux Codex uses task-local Git metadata so its `workspace-write` sandbox can stage and commit without making the shared `.repos` cache writable.+`runtime update` and `runtime delete` are writes. Starting a runtime update is limited to its owner or a workspace owner/admin; the original initiator may keep polling that specific in-flight request if their admin role changes. `runtime delete` removes a runtime registration; if active agents are still bound, it refuses unless the user explicitly passes `--cascade`, which archives those agents and cancels their queued/running tasks before deleting the runtime. `repo checkout` creates a dedicated branch in the task working directory. Most runtimes use a linked worktree; Linux Codex uses task-local Git metadata so a task can stage and commit without making the shared `.repos` cache writable.`repo checkout` requires `MULTICA_DAEMON_PORT`; it is intended to run inside a daemon task. If absent, you are not in the normal agent checkout path. When a project `github_repo` resource has `resource_ref.ref`, `repo checkout <url>` uses that ref by default for the current task; an explicit `repo checkout <url> --ref <branch-or-sha>` overrides it.