diff --git a/packages/opencode/script/kilocode/bubblewrap.ts b/packages/opencode/script/kilocode/bubblewrap.ts index d6f5aa779a..d19a3bae89 100644 --- a/packages/opencode/script/kilocode/bubblewrap.ts +++ b/packages/opencode/script/kilocode/bubblewrap.ts @@ -12,6 +12,7 @@ const cache = process.env.KILO_BWRAP_CACHE ?? path.join(os.tmpdir(), "kilo-bubbl const capability = `#pragma once #include #include +#include #include #include @@ -28,8 +29,10 @@ static inline int capset(cap_user_header_t header, const cap_user_data_t data) { } static inline int cap_from_name(const char *name, cap_value_t *cap) { - (void) name; - (void) cap; + if (strcmp(name, "cap_sys_admin") == 0) { + *cap = CAP_SYS_ADMIN; + return 0; + } errno = EINVAL; return -1; } diff --git a/packages/opencode/test/kilocode/sandbox/config-network.test.ts b/packages/opencode/test/kilocode/sandbox/config-network.test.ts index 4078b23f07..5e8596e80b 100644 --- a/packages/opencode/test/kilocode/sandbox/config-network.test.ts +++ b/packages/opencode/test/kilocode/sandbox/config-network.test.ts @@ -98,8 +98,8 @@ restricted.live("keeps network restriction enabled by default when the sandbox i Effect.exit, ) if (!backendSupport().available) { - expect(Exit.isSuccess(exit)).toBe(true) - expect(target.requests()).toBe(1) + expect(Exit.isFailure(exit)).toBe(true) + expect(target.requests()).toBe(0) return } expect(Exit.isFailure(exit)).toBe(true) @@ -119,8 +119,8 @@ open.live("allows network when restriction is disabled without authenticated ser Effect.exit, ) if (!backendSupport().available) { - expect(Exit.isSuccess(exit)).toBe(true) - expect(target.requests()).toBe(1) + expect(Exit.isFailure(exit)).toBe(true) + expect(target.requests()).toBe(0) return } expect(status.enabled).toBe(true) diff --git a/packages/opencode/test/kilocode/sandbox/state.test.ts b/packages/opencode/test/kilocode/sandbox/state.test.ts index a40a01af2a..a2511b3670 100644 --- a/packages/opencode/test/kilocode/sandbox/state.test.ts +++ b/packages/opencode/test/kilocode/sandbox/state.test.ts @@ -360,6 +360,7 @@ it.instance("prevents a queued toggle from restoring a retired override", () => Effect.gen(function* () { const test = yield* TestInstance const id = SessionID.make("ses_sandbox_retire_race") + if (!(yield* SandboxPolicy.status(id)).available) return const entered = yield* Deferred.make() const release = yield* Deferred.make() const removal = yield* SandboxPolicy.retire(