Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: the policy check keeps working when the new engine reloads its plugins

ogsamratefcdaed83cc0
diff --git a/apps/server/src/opencode-plugins/managed-policy-next.ts b/apps/server/src/opencode-plugins/managed-policy-next.ts
index adb18c03..afb099b6 100644
--- a/apps/server/src/opencode-plugins/managed-policy-next.ts
+++ b/apps/server/src/opencode-plugins/managed-policy-next.ts
@@ -1,4 +1,4 @@
-import { check, checkManagedTool, holdPolicyToken } from "./managed-policy-client.js";
+import { check, checkManagedTool } from "./managed-policy-client.js";
import { applyEnginePath } from "../engine-shell-path.js";
// Plugin.define is the identity function in the pinned SDK. The structural
// contract avoids loading either engine's SDK into the other engine.
@@ -13,8 +13,8 @@ export default {
// The next engine spawns shells from process.env; enrich it once so git
// and gh resolve the way the packaged app resolves them.
applyEnginePath();
- // Its shells copy process.env and there is no hook to empty a variable: the policy token leaves it.
- holdPolicyToken();
+ // The policy token stays in the engine's environment: the 2.x engine sets a plugin up again for each
+ // folder (a fresh module), and agent shells get it blanked (omnirush-session-next.ts).
await ctx.tool.hook("execute.before", (event) =>
checkManagedTool(event.tool, event.input, { directory: ctx.directory, callID: event.callID, sessionID: event.sessionID }));
await ctx.shell.hook("create.before", async (event) => { await check("shell", { command: event.command }); });