Skip to content

fix(bots): isolate user homes and disable codex skills - #190

Merged
nixuuu merged 1 commit into
devfrom
fix/bot-skill-isolation
Nov 5, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/bot-skill-isolation

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 5, 2026

Copy link
Copy Markdown
Member

Bots no longer see the device owner's skills or instructions.

Leak: Codex 0.164 finds skills in HOME/.agents/skills regardless of CODEX_HOME. Captured Codex bot requests held a <skills_instructions> block with local skill names and paths, even though the bot catalog sets include_skills_usage_instructions: false. Grok leaked a seeded skill the same way. Claude was clean.

Fix:

  • Codex bots run with a private HOME, USERPROFILE and XDG_* under the bot session. They also run with these settings:

    • skills.include_instructions=false;
    • skills.bundled.enabled=false;
    • features.skip_host_skill_discovery=true.

    Credentials stay file-based in CODEX_HOME/auth.json, linked from the selected instance as before.

  • Grok bots run with a private HOME. Their login stays available through an absolute GROK_AUTH_PATH.

  • Claude bots keep the inherited HOME, so login discovery on macOS (Keychain) is unchanged. Only CLAUDE_CONFIG_DIR points at the session home, as before.

  • Existing bot sessions are rebuilt once (session key isolation: 2), so context that may have leaked earlier is not carried over.

  • Thread sessions keep their skills.

Tests: apps/worker/src/bots/isolation.test.ts seeds a fake user skill plus user AGENTS.md/CLAUDE.md and runs the real CLIs. It asserts that the Claude, Codex and Grok bot requests contain no skill names, no skill paths and no instruction text. The existing tool-schema assertions are unchanged. check:tmp: 1278 passed, 154 skipped, 0 failed.

Not verified:

  • Real macOS Keychain sign-in.
  • Codex logins stored only in the keyring were already unsupported for bots and stay so.

Docs: docs/bots-harness.md.

Copy audit: no UI text changed.

Fixes: #97

Codex 0.164.0 discovers user skills outside CODEX_HOME. Isolate Codex and Grok bot homes, disable Codex skills and explicitly use its linked file login. Keep Claude's HOME for macOS login discovery while isolating CLAUDE_CONFIG_DIR.

Rebuild cached bot sessions and capture official Claude, Codex and Grok requests with seeded user skills and instructions. Preserve tool schemas, selected instance login paths and thread skills. Document file auth and the existing keyring-only limitation.

Fixes: #97
@nixuuu
nixuuu merged commit c709d37 into dev Nov 5, 2026
15 of 17 checks passed
@nixuuu
nixuuu deleted the fix/bot-skill-isolation branch November 5, 2026 15:24
nixuuu added a commit that referenced this pull request Nov 5, 2026
Platform threads no longer read the device owner's global instruction
files. A new scratch thread on a Mac quoted the owner's
`~/.claude/CLAUDE.md` (rules about a plugin that the thread does not
have).

**Cause:** Claude Code (CLI 2.1.308, Agent SDK 0.3.316) loads global
user memory (`~/.claude/CLAUDE.md`) and `CLAUDE.md` files from parent
directories even with `settingSources: ["project", "local"]`. A real-CLI
capture of scratch and project threads contained both fixture texts.

**Fix**
- **Claude:** threads pass `claudeMdExcludes` for the device's
`~/.claude/**` and for `CLAUDE.md`, `CLAUDE.local.md`, `AGENTS.md` and
`.claude/**` in every directory above the workspace root. Instructions
inside the workspace or repo stay. `HOME` and the login setup are
unchanged, so macOS Keychain sign-in is not affected.
- **Codex:** threads keep the real `HOME`, `USERPROFILE` and XDG paths,
so git identity, SSH keys, `gh` and tool configs keep working in agent
shells. The device's skills are left out through Codex's own skill-path
settings; library skills in the isolated `CODEX_HOME` stay. Scratch
threads use `project_root_markers: []`, so no `AGENTS.md` above them is
collected.
- **Grok:** threads keep the real home. An isolated `GROK_HOME`, the
compatibility flags and `[skills].ignore` keep global context out.
Grok's native rules and root instruction files stay.
- **Bots:** unchanged; they stay fully isolated (#190).

**Limitations**
- Codex: a newly installed device skill is picked up only after an
app-server or worker restart.
- Grok: Claude and Cursor compatibility rules and skills are off inside
projects as well.

**Tests:** `apps/worker/src/providers/instruction-isolation.test.ts`
captures requests from the real Claude, Codex and Grok CLIs for scratch
and project threads, using a temporary `HOME` with fixture files. It
checks that:
- global and ancestor instructions are absent;
- repo instructions and assigned library instructions are present;
- agent subprocesses see the real `HOME` and git identity.

Bot isolation tests pass. `check:tmp`: 1398 passed, 0 failed.

Docs: `agent-environment.md`, `claude-adapter.md`, `codex-adapter.md`,
`grok-adapter.md`, `worker-config.md`.

Copy audit: no UI text changed.
nixuuu added a commit that referenced this pull request Nov 15, 2026
Codex and Grok bots replace HOME and XDG. A CLI found through a mise,
asdf or Volta shim (or a launcher that runs `node` from PATH) then could
not find its installs or trusted config and exited at once, so every
bot turn failed with an internal harness error.

Keep the device's version manager directories in the bot environment.

Fixes: #190

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant