mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 12:54:20 +01:00
fix(sessions): prevent duplicate goal starts and lost autosave updates
- Block prompt submission while an armed goal is starting. - Launch multi-runs with mutate so a failed launch is not an unhandled rejection. - Save changed session automation fields in one update so concurrent autosaves cannot overwrite each other.
This commit is contained in:
1 parent
96e02e9646
commit
2072fae1b6
6 files changed
+137
-38
No files matched your search
@@ -110,6 +110,39 @@ describe('SessionAutomationSettings', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('saves the auditor model and max continuations together after the debounce', () => {
|
||||
vi.useFakeTimers()
|
||||
try {
|
||||
const updateSettings = vi.fn()
|
||||
mockUseSettings({
|
||||
preferences: { ...basePreferences, sessionDefaults: { permissionMode: 'ask', goalMaxContinuations: 20 } },
|
||||
updateSettings,
|
||||
})
|
||||
render(<SessionAutomationSettings />)
|
||||
|
||||
fireEvent.change(screen.getByLabelText('Goal auditor model'), {
|
||||
target: { value: 'anthropic/claude-sonnet-4' },
|
||||
})
|
||||
fireEvent.change(screen.getByLabelText('Max automatic continuations'), {
|
||||
target: { value: '50' },
|
||||
})
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(800)
|
||||
})
|
||||
|
||||
expect(updateSettings).toHaveBeenCalledTimes(1)
|
||||
expect(updateSettings).toHaveBeenCalledWith({
|
||||
sessionDefaults: {
|
||||
permissionMode: 'ask',
|
||||
goalAuditorModel: 'anthropic/claude-sonnet-4',
|
||||
goalMaxContinuations: 50,
|
||||
},
|
||||
})
|
||||
} finally {
|
||||
vi.useRealTimers()
|
||||
}
|
||||
})
|
||||
|
||||
it('saves an in-range max automatic continuations on blur', () => {
|
||||
const updateSettings = vi.fn()
|
||||
mockUseSettings({
|
||||
|
||||
Reference in new issue
Block a user