fix(devin): migrate existing workspace trust defaults

This commit is contained in:
Neil
2026-09-21 00:31:17 -07:00
parent 0286c8e5b8
commit e7e8ea2fe7
3 changed files with 19 additions and 3 deletions
@@ -12,4 +12,17 @@ describe('migrateAgentYoloDefaults', () => {
expect(migrated.agentDefaultArgs?.droid).toBe('')
expect(migrated.agentDefaultEnv?.goose).toEqual({})
})
it('updates the previous Devin default for existing profiles', () => {
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: This test only supplies the settings fields consumed by this migration.
const migrated = migrateAgentYoloDefaults({
agentYoloDefaultsMigrated: true,
agentDefaultArgs: { devin: '--permission-mode bypass' },
agentDefaultEnv: {}
} as never)
expect(migrated.agentDefaultArgs?.devin).toBe(
'--permission-mode bypass --respect-workspace-trust false'
)
})
})
@@ -126,6 +126,9 @@ export function migrateAgentYoloDefaults(
): Pick<GlobalSettings, 'agentDefaultArgs' | 'agentDefaultEnv' | 'agentYoloDefaultsMigrated'> {
const existingArgs = normalizeTuiAgentArgsRecord(settings?.agentDefaultArgs)
const existingEnv = normalizeTuiAgentEnvRecord(settings?.agentDefaultEnv)
if (existingArgs.devin === '--permission-mode bypass') {
existingArgs.devin = DEFAULT_TUI_AGENT_ARGS.devin
}
if (settings?.agentYoloDefaultsMigrated === true) {
// Keep newly added agents manual for profiles migrated by an older build.
// Missing keys otherwise fall through to the current (possibly yolo) defaults.
@@ -252,12 +252,12 @@ describe('buildAgentStartupPlan', () => {
})
).toEqual({
agent: 'devin',
launchCommand: "devin '--permission-mode' 'bypass'",
launchCommand: "devin '--permission-mode' 'bypass' '--respect-workspace-trust' 'false'",
expectedProcess: 'devin',
followupPrompt: 'Trace the failing test',
launchConfig: {
agentCommand: "devin '--permission-mode' 'bypass'",
agentArgs: '--permission-mode bypass',
agentCommand: "devin '--permission-mode' 'bypass' '--respect-workspace-trust' 'false'",
agentArgs: '--permission-mode bypass --respect-workspace-trust false',
agentEnv: {}
}
})