Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(settings): capability toggles persist — the setter now schedules the workspace save

enesc3b3318be3d4
diff --git a/src/renderer/state/projects.test.ts b/src/renderer/state/projects.test.ts
index 3467ee558..346cd5158 100644
--- a/src/renderer/state/projects.test.ts
+++ b/src/renderer/state/projects.test.ts
@@ -225,3 +225,37 @@ describe('setProjectColor', () => {
expect(useProjects.getState().projects).toHaveLength(0)
})
})
+
+// Issue #318: the AgentsSection capability toggle (and the clone-notice answers) mutate the store
+// only — nothing scheduled a workspace save, so the choice was lost on restart unless an unrelated
+// canvas edit happened to dirty the workspace afterwards. The setters own the persist now, through
+// the same markWorkspaceDirty seam PR #317's identity edits use.
+describe('capability setters schedule a workspace save', () => {
+ it('setProjectCapability rings the workspace-dirty seam (on and off)', async () => {
+ const { registerWorkspaceDirty } = await import('./workspaceDirty')
+ const p = useProjects.getState().addProject('my-app', '/Users/me/dev/my-app')
+ let dirtied = 0
+ const unregister = registerWorkspaceDirty(() => dirtied++)
+ try {
+ useProjects.getState().setProjectCapability(p.id, 'agentMessaging', true)
+ expect(dirtied).toBe(1)
+ useProjects.getState().setProjectCapability(p.id, 'agentMessaging', false)
+ expect(dirtied).toBe(2)
+ } finally {
+ unregister()
+ }
+ })
+
+ it('recordProjectCapabilityAck rings it too (the notice answer must survive restart)', async () => {
+ const { registerWorkspaceDirty } = await import('./workspaceDirty')
+ const p = useProjects.getState().addProject('my-app', '/Users/me/dev/my-app')
+ let dirtied = 0
+ const unregister = registerWorkspaceDirty(() => dirtied++)
+ try {
+ useProjects.getState().recordProjectCapabilityAck(p.id, 'agentMessaging', 'kept')
+ expect(dirtied).toBe(1)
+ } finally {
+ unregister()
+ }
+ })
+})
diff --git a/src/renderer/state/projects.ts b/src/renderer/state/projects.ts
index f12be87a6..31642813a 100644
--- a/src/renderer/state/projects.ts
+++ b/src/renderer/state/projects.ts
@@ -14,6 +14,7 @@ import type { ProjectCapability } from '@shared/project-capabilities'
import type { ProjectIcon } from '@shared/project-icon'
import { recordCapabilityAck, type CapabilityAnswer } from '@shared/project-capability-consent'
import { applyCanvasMutation, createProject, reorderGroupWithinParent } from './workspace'
+import { markWorkspaceDirty } from './workspaceDirty'
interface ProjectsState {
projects: Project[]
@@ -371,12 +372,19 @@ export const useProjects = create<ProjectsState>((set, get) => ({
return recordCapabilityAck(next, cap, 'declined')
})
}))
+ // The setter owns the persist (issue #318): its call sites — the AgentsSection toggle, the
+ // clone notice's decline — schedule no save of their own, so without this the choice was lost
+ // on restart unless an unrelated canvas edit happened to dirty the workspace afterwards.
+ markWorkspaceDirty()
},
recordProjectCapabilityAck(id, cap, answer) {
set((s) => ({
projects: s.projects.map((p) => (p.id === id ? recordCapabilityAck(p, cap, answer) : p))
}))
+ // Same persistence gap as setProjectCapability: the notice's 'kept' answer rides
+ // IndexEntryV3.capabilityAck on the next save — which must actually be scheduled.
+ markWorkspaceDirty()
},
setDinoHighScore(id, score) {