diff --git a/src/sidebarProvider.ts b/src/sidebarProvider.ts index 223d752..efa30fe 100644 --- a/src/sidebarProvider.ts +++ b/src/sidebarProvider.ts @@ -1082,7 +1082,12 @@ export class SidebarChatProvider implements vscode.WebviewViewProvider, BridgeIn const updated: ProjectProfile = { ...profile, architectureDocPath: result.docPath, - architectureAutoAttach: profile.architectureAutoAttach ?? true, + // [BUGFIX] Previously used `?? true`, but `??` only fallbacks on null/undefined. + // After a user Detach, `architectureAutoAttach === false`, so `false ?? true` + // stays `false` and the chip stays "detached — click Attach to re-enable" + // forever no matter how many times the user clicks Attach. The activation + // path is an explicit user intent to re-enable, so force `true` here. + architectureAutoAttach: true, architectureAutoUpdate: profile.architectureAutoUpdate ?? true, architectureLastUpdated: now, architectureLastScanSignature: result.scan.signature,