WeKnora/internal
nullptr-error 524deeaad5
feat(sandbox): run sandboxed execs as root by default (#3067)
* feat(sandbox): run sandboxed execs as root by default

Every chat session owns its own sandbox, so the in-container account is
not a tenant boundary and root is the least surprising default for an
agent that installs packages and writes wherever it needs. Host and
cross-tenant isolation stay at the container boundary.

DefaultSandboxExecUser becomes "root" (remote_client.go) and the sandbox
image ends with USER root. The three backends keep naming the account
explicitly on every exec so the account a call lands on does not depend
on which backend a workspace selected; the adapter default, the file
operations and the artifact-directory bootstrap all follow the constant.
The template still provisions a uid 1000 "user" account for interop with
E2B/Cube tooling that addresses it by name.

Root also makes the skill-install flow's account hand-over pointless, so
it goes: verification no longer runs after a chown/chmod lock-down and a
repair round no longer reopens the tree (normalizeSkillPermissions and
reopenSkillDirForRepair are gone), and the prepare and scratch commands
stop chowning. The scratch wipe now also clears /tmp, and the cache
budget guard sizes only root's caches, since no second account can grow
one. Verification is asserted to stay on the ordinary executor (no
AsRoot, no AllowSkillsRoot) rather than on which account it ran as.

* refactor(skills): install chat-time extras into the skill's own env

PYTHONPATH / NODE_PATH pointed at a per-session overlay
(/workspace/.skill-packages/<skill>) because the skill tree was frozen
after install: root-owned, mode 555, and often built by `uv venv` with no
pip, so `pip install --target` somewhere else was the only way a chat
session could add a package.

None of that holds now. The lock-down is gone and execs run as root, so a
missing package goes straight into the skill's own environment, and the
write is already session-local: a chat sandbox is built from the config's
image and its filesystem dies with the session, so nothing reaches the
image other sessions start from. The overlay bought nothing over that
while splitting one skill's packages across two locations.

SessionSkillPackageDir goes, and applySessionPackagePath becomes
applySkillNodePath: it appends the skill's own node_modules after
whatever the caller supplied, replacing a `+=` that prepended a bare
separator once the overlay stopped seeding the variable. No PYTHONPATH is
injected at all. Python dependencies are reached through the skill's venv
interpreter, which the shell wrapper already puts first on PATH; the
overlay-era value named the venv root, which is not an importable path.
PYTHONPATH stays on the injected-name blacklist so a stored value cannot
shadow the venv.

The runtime hints and every prompt that described the overlay now name
`<skillDir>/.venv/bin/python -m pip install` and `npm install` in the
skill directory. frozenSkillTreeGuidance / isFrozenSkillVenvFailure are
renamed for what they detect now that nothing is frozen.

* docs(prompts): reserve /workspace/output for finished deliverables

/workspace/output is the one directory an artifact collector reads, so
everything written there is offered to the user as a deliverable. The
prompts described it as the place for "deliverables" or "downloadable
artifacts" without saying it is exclusively that, which reads as "the
directory you write results to" — and a model doing multi-step work has
results at every step. Drafts, intermediate renders and debug dumps land
next to the finished file and the user is handed all of them.

The four places that describe the workspace now say the same thing: the
collector reads only /workspace/output, so finished deliverables go there
and everything in progress goes anywhere else under /workspace. The
attachment block gains the matching half for the other direction —
/workspace/input holds the user's own files and is not ours to write to,
which it previously implied by calling the paths "read-only inputs" while
the tools that enforce it say so plainly.

Only the /workspace/input half is enforced (write_sandbox_file refuses
that tree). Whether a file is finished is a judgement no tool can make,
so the output half stays guidance and is stated wherever the model is
already reading about the workspace rather than in one place it might
not see.

* fix(skills): restore executable bundles and package recovery

* style(sandbox): wrap prompt text for repository lint checks

* fix(sandbox): guard recovery paths and document root execution

---------

Co-authored-by: hailongzhao <hailongzhao@tencent.com>
Co-authored-by: wizardchen <wizardchen@tencent.com>
2026-09-07 13:03:35 +08:00
..
agent feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
application feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
assets feat(assets): add ASR test audio file and embed it in the application 2026-04-02 21:27:27 +08:00
common fix(markdown): sanitize invalid UTF-8 and NUL bytes 2026-08-31 12:24:35 +08:00
config feat: support complex password (#2929) 2026-09-01 11:50:10 +08:00
container feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
database feat(mcp): add per-tool enable toggle (#2989) 2026-09-05 17:19:20 +08:00
datasource feat(memory): add cross-session long-term memory 2026-08-13 18:00:02 +08:00
errors feat(agent): keep long sandbox turns from truncating, overflowing, or rewriting files 2026-09-02 22:09:09 +08:00
event feat(agent): keep long sandbox turns from truncating, overflowing, or rewriting files 2026-09-02 22:09:09 +08:00
handler fix(initialization): pass stored ExtraConfig to model connection test 2026-09-07 11:43:44 +08:00
im fix(feishu): preserve images embedded in post messages 2026-09-05 16:48:16 +08:00
infrastructure fix(parser): prefer anydoc for every type it converts when linked 2026-08-31 14:58:15 +08:00
ipclass fix: share IP classification between SSRF and sandbox URL guards 2026-09-01 15:35:14 +08:00
logger fix(sandbox): record product-level Langfuse spans and detach idle sweeps 2026-08-31 19:42:32 +08:00
mcp fix(security): harden outbound URL SSRF protection (#2626) 2026-08-10 13:24:14 +08:00
middleware fix(models): show usage details when deletion is blocked (#2975) 2026-09-02 17:20:37 +08:00
modelcontext feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
models feat(chat): keep prompt prefixes stable and send provider cache markers 2026-09-03 00:45:52 +08:00
ratelimit feat(embed): add backend embed channels with auth and rate limiting (#1657) 2026-06-12 23:10:39 +08:00
router feat(agent): unify sandbox tools and drop host preloaded skills (#3033) 2026-09-05 16:45:59 +08:00
runtime fix(redis): harden TLS tests and surface TLS config at startup 2026-07-06 23:04:52 +08:00
sandbox feat(sandbox): run sandboxed execs as root by default (#3067) 2026-09-07 13:03:35 +08:00
searchutil fix(chat): keep OCR/caption text of scanned-page image hits in merge (#3064) 2026-09-07 11:38:47 +08:00
storageallowlist fix(storage): align default provider fallback with STORAGE_ALLOW_LIST 2026-07-15 11:05:00 +08:00
storageurl fix(api): address resource_urls review follow-ups 2026-08-05 14:42:51 +08:00
stream feat(redis): support TLS for Redis connections (#1930) 2026-07-06 23:02:02 +08:00
tracing/langfuse fix(observability): nest follow-up completions under the chat trace 2026-08-31 19:42:32 +08:00
types fix(knowledge): keep long non-ASCII folder names valid UTF-8 2026-09-07 11:50:32 +08:00
utils fix(security): reject traversal in local prefixes, task IDs, and wiki sort 2026-09-07 11:23:45 +08:00