Skip to content

sbx engine, MCP OAuth, plugin update, ACP approvals, custom commands over ACP with allowed-tools and @file - #14

Merged
blockmandev merged 1 commit into
mainfrom
claude/laughing-darwin-hyqkjj
Oct 20, 2026
Merged

blockmandev merged 1 commit into
mainfrom
claude/laughing-darwin-hyqkjj

Conversation

@blockmandev

@blockmandev blockmandev commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Sandbox engine (sandbox_engine = "sbx")

  • Runs the Bash tool and background jobs under crates/sandbox instead of the built-in engine, which stays the default.
  • What sbx adds:
    • a host allowlist (sandbox_allow_hosts);
    • the Linux seccomp filter;
    • .git/hooks and .git/config put back after each command;
    • git-redirect, agent-session and loader-injection variables stripped;
    • a private temp directory per command.
  • Linux and macOS use the library in-process, with incode as its own helper. Windows uses sbx.exe, native or in WSL2 per sandbox_backend.
  • A run sbx cannot start is refused, never run unconfined.

MCP

  • OAuth 2.1 for remote servers:
    • protected-resource and authorization-server discovery, dynamic client registration, PKCE (S256) and the resource parameter;
    • a loopback callback;
    • tokens stored with 0600 permissions in ~/.incode/mcp-tokens.json, refreshed on expiry or a 401;
    • incode mcp login / logout, with auth status in incode mcp list.
  • A server needing a login it lacks is skipped with the command to run; nothing waits on a browser.
  • A server's oauth entry is part of its approval key, so a changed client or wider scopes is asked about again.
  • --acp asks the client (session/request_permission: allow once, always, reject) about an unapproved project server after session/new has been answered, and connects it in the background. "Always" is remembered like incode mcp approve.
  • Fix: an HTTP POST now waits for the notification sent before it. notifications/initialized could reach a server after tools/list, which is against MCP's ordering.

Plugins

  • incode plugin update [name] [--project] re-fetches from the recorded git or path source into a staging folder and swaps it in, or leaves the old copy if anything fails.
  • An update whose manifest names a different plugin is refused.

Custom commands

  • Offered over --acp (listed after the built-ins, with description and hint) and expanded there like in the REPL.
  • allowed-tools is enforced for that one turn through the toolbox, on the API and Claude routes and in -t.
    • It never overrides the deny or ask rules, guards or the permission mode.
    • On codex and agy, which run their own tools, the user gets a notice that it is not enforced.
  • @path includes in the command file's text:
    • limited to the workspace (.., outside absolute paths and symlinks pointing out are refused);
    • capped at 256 KB per file and 1 MB in total;
    • emails and @mentions are left alone, and typed arguments are never read as files.

Tests

  • The ACP role-picker test now also reads the update that can race the reply. It used to fail about one run in four.

Test plan

  • cargo fmt --check, cargo clippy --all-targets (no warnings)
  • cargo test --lib: 2100 passed; cargo test --bins: 50 passed
  • cargo test --test sbx_engine: live Linux checks (a write outside is refused, with an unconfined control; a hook is undone; GIT_DIR is stripped)
  • cargo test -p incord-sandbox: 78 passed
  • cargo check --target x86_64-pc-windows-gnu --all-targets (at the sbx engine commit)
  • OAuth end to end against a local fake authorization server and MCP server (401 → login → call → refresh)
  • The MCP HTTP test 15/15 and the ACP role-picker test 12/12 run alone (both used to be flaky)
  • Windows: the sbx.exe path and browser opening, on a real machine
  • macOS: the incode build (only the sbx crate could be checked here)
  • --acp approval and custom commands with a real editor; plugin update against a real remote

🤖 Generated with Claude Code

https://claude.ai/code/session_011DiH8n52ifWoCd5Kx2aHwT

A second engine for the Bash tool and background jobs, beside the built-in
Landlock/Seatbelt/token one, which stays the default. Under "sbx" the same
mode and network switch are handed to crates/sandbox, which adds a host
allowlist (sandbox_allow_hosts, through its proxy), the Linux seccomp filter,
.git/hooks and .git/config put back after each command, the git-redirect,
agent-session and loader-injection variables stripped, and a private temp
directory per command.

Linux and macOS use the library in-process; incode's main hands
`__sbx-enter` to sbx first, so incode is its own helper. Windows runs
sbx.exe (beside incode.exe or on PATH), natively or in WSL2 per
sandbox_backend. A run sbx cannot start is refused, never run unconfined;
what a machine cannot enforce is named in the note.

Sandbox::wrap now takes the filtered environment and returns what must live
until the command exits; sbx gains Sandbox::inherit_from for that base
environment. tests/sbx_engine.rs (harness = false, its own main as the
helper) checks a write outside the workspace is refused (with an unconfined
control), a planted hook is undone and GIT_DIR is stripped; CI runs it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011DiH8n52ifWoCd5Kx2aHwT
@blockmandev
blockmandev merged commit 58bdae8 into main Oct 20, 2026
0 of 4 checks passed
@blockmandev blockmandev changed the title sandbox: run incode's shell commands under sbx (sandbox_engine = "sbx") sbx engine, MCP OAuth, plugin update, ACP approvals, custom commands over ACP with allowed-tools and @file Oct 20, 2026
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.

2 participants