fix(policy): revert allowOverrides in plan mode to fix sandbox tests

This commit is contained in:
Keith Schaab
2026-04-06 23:50:33 +00:00
parent ba5ce67d18
commit 45cd51d3bf
3 changed files with 39 additions and 2 deletions
@@ -2,7 +2,7 @@
network = false
readonly = true
approvedTools = []
allowOverrides = false
allowOverrides = true
[modes.default]
network = false
@@ -69,4 +69,41 @@ describe('SandboxPolicyManager', () => {
const perms = manager.getCommandPermissions('npm');
expect(perms.fileSystem?.read).toContain('/node_modules');
});
describe('getModeConfig', () => {
it('should return default config for plan mode', () => {
const manager = new SandboxPolicyManager(configPath);
const config = manager.getModeConfig('plan');
expect(config.readonly).toBe(true);
expect(config.network).toBe(false);
// Regression test: allowOverrides must be true to support integration tests
// that use the sandbox manager manually with specific permissions.
expect(config.allowOverrides).toBe(true);
});
it('should return default config for default mode', () => {
const manager = new SandboxPolicyManager(configPath);
const config = manager.getModeConfig('default');
expect(config.readonly).toBe(false);
expect(config.network).toBe(false);
expect(config.allowOverrides).toBe(true);
});
it('should return default config for autoEdit mode', () => {
const manager = new SandboxPolicyManager(configPath);
const config = manager.getModeConfig('autoEdit');
expect(config.readonly).toBe(false);
expect(config.network).toBe(false);
expect(config.allowOverrides).toBe(true);
});
it('should return yolo config', () => {
const manager = new SandboxPolicyManager(configPath);
const config = manager.getModeConfig('yolo');
expect(config.readonly).toBe(false);
expect(config.network).toBe(true);
expect(config.allowOverrides).toBe(true);
expect(config.yolo).toBe(true);
});
});
});
@@ -64,7 +64,7 @@ export class SandboxPolicyManager {
network: false,
readonly: true,
approvedTools: [],
allowOverrides: false,
allowOverrides: true,
},
default: {
network: false,