From c4abd3994ca47356fe8ea82e2cf32a3122884e20 Mon Sep 17 00:00:00 2001 From: g1nation Date: Thu, 14 May 2026 01:50:19 +0900 Subject: [PATCH] fix(sidebar): force architectureAutoAttach to true on explicit re-activation Fixed a bug where architectureAutoAttach would stay false even after an explicit attach action due to incorrect nullish coalescing logic. --- src/sidebarProvider.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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,