From b326cf4e515149f3e35bad6eb15606090b75f208 Mon Sep 17 00:00:00 2001 From: KCM Date: Sun, 3 May 2026 20:05:06 -0500 Subject: [PATCH 1/2] fix(workspaces): preserve local workspace names across autosave and align labels. --- playwright/github-byot-ai.spec.ts | 17 +++++++++++++++++ src/app.js | 2 ++ src/modules/app-core/workspace-local-helpers.js | 13 ++++++++++++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/playwright/github-byot-ai.spec.ts b/playwright/github-byot-ai.spec.ts index a9f2bef..984adc2 100644 --- a/playwright/github-byot-ai.spec.ts +++ b/playwright/github-byot-ai.spec.ts @@ -399,6 +399,23 @@ test('Local workspace can be renamed from Workspaces drawer', async ({ page }) = expect(typeof renamedRecord?.prTitle === 'string' ? renamedRecord.prTitle : '').toBe( renamedTitle, ) + + await setComponentEditorSource( + page, + 'export const App = () =>
rename persists after edit
', + ) + + await expect + .poll(async () => { + const nextRecords = await getAllWorkspaceRecords(page) + const nextRenamedRecord = nextRecords.find( + record => record?.id === sourceWorkspaceId, + ) + return typeof nextRenamedRecord?.prTitle === 'string' + ? nextRenamedRecord.prTitle + : '' + }) + .toBe(renamedTitle) }) test('chat stays usable after opening a Local workspace with PAT connected', async ({ diff --git a/src/app.js b/src/app.js index 3ca41ae..bf52138 100644 --- a/src/app.js +++ b/src/app.js @@ -664,6 +664,8 @@ const getWorkspaceContextSnapshot = createWorkspaceContextSnapshotGetter({ getActivePrContext: () => githubAiContextState.activePrContext, getPrContextState: () => workspacePrContextState, getPrNumber: () => workspacePrNumber, + getWorkspaceScopeMarker: () => workspaceScopeMarker, + getActiveWorkspacePersistedPrTitle: () => activeWorkspacePersistedPrTitle, }) const { getActiveWorkspaceTab, getEntryWorkspaceTab, getPrimaryStyleWorkspaceTab } = diff --git a/src/modules/app-core/workspace-local-helpers.js b/src/modules/app-core/workspace-local-helpers.js index 296f293..4b1ff3f 100644 --- a/src/modules/app-core/workspace-local-helpers.js +++ b/src/modules/app-core/workspace-local-helpers.js @@ -7,6 +7,8 @@ const createWorkspaceContextSnapshotGetter = getActivePrContext, getPrContextState, getPrNumber, + getWorkspaceScopeMarker, + getActiveWorkspacePersistedPrTitle, }) => () => { const toSafeText = value => (typeof value === 'string' ? value.trim() : '') @@ -32,6 +34,15 @@ const createWorkspaceContextSnapshotGetter = const formBaseBranch = toSafeText(githubPrBaseBranch?.value) const formHeadBranch = toSafeText(githubPrHeadBranch?.value) const formPrTitle = toSafeText(githubPrTitle?.value) + const normalizedWorkspaceScope = toSafeText(getWorkspaceScopeMarker?.()).toLowerCase() + const isLocalScope = normalizedWorkspaceScope !== 'repository' + const persistedPrTitle = toSafeText(getActiveWorkspacePersistedPrTitle?.()) + const nextPrTitle = + isActivePrContext && contextPrTitle + ? contextPrTitle + : isLocalScope && !formPrTitle && persistedPrTitle + ? persistedPrTitle + : formPrTitle return { repositoryFullName: getCurrentSelectedRepository(), @@ -39,7 +50,7 @@ const createWorkspaceContextSnapshotGetter = isActivePrContext && contextBaseBranch ? contextBaseBranch : formBaseBranch, headBranch: isActivePrContext && contextHeadBranch ? contextHeadBranch : formHeadBranch, - prTitle: isActivePrContext && contextPrTitle ? contextPrTitle : formPrTitle, + prTitle: nextPrTitle, prNumber, prContextState, } From e028a04bc8596d7ecc97747372658eee933d6c05 Mon Sep 17 00:00:00 2001 From: KCM Date: Sun, 3 May 2026 20:13:17 -0500 Subject: [PATCH 2/2] refactor: address pr comments. --- src/app.js | 4 ++++ .../app-core/workspace-pr-session-handoff-controller.js | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/app.js b/src/app.js index bf52138..725394b 100644 --- a/src/app.js +++ b/src/app.js @@ -1025,6 +1025,10 @@ const workspacePrSessionHandoffController = createWorkspacePrSessionHandoffContr setWorkspacePrContextState, setWorkspacePrNumber, setWorkspaceScopeMarker, + clearActiveWorkspacePersistedMetadata: () => { + activeWorkspacePersistedPrTitle = '' + activeWorkspacePersistedHeadBranch = '' + }, getActiveWorkspaceCreatedAt: () => activeWorkspaceCreatedAt, setActiveWorkspaceRecordId, setActiveWorkspaceCreatedAt: value => (activeWorkspaceCreatedAt = value), diff --git a/src/modules/app-core/workspace-pr-session-handoff-controller.js b/src/modules/app-core/workspace-pr-session-handoff-controller.js index 22ab927..aa86300 100644 --- a/src/modules/app-core/workspace-pr-session-handoff-controller.js +++ b/src/modules/app-core/workspace-pr-session-handoff-controller.js @@ -14,6 +14,7 @@ export const createWorkspacePrSessionHandoffController = ({ setWorkspacePrContextState, setWorkspacePrNumber, setWorkspaceScopeMarker, + clearActiveWorkspacePersistedMetadata, getActiveWorkspaceCreatedAt, setActiveWorkspaceRecordId, setActiveWorkspaceCreatedAt, @@ -87,6 +88,11 @@ export const createWorkspacePrSessionHandoffController = ({ if (typeof setWorkspaceScopeMarker === 'function') { setWorkspaceScopeMarker('local') } + + if (typeof clearActiveWorkspacePersistedMetadata === 'function') { + clearActiveWorkspacePersistedMetadata() + } + lastKnownPrContextMeta = null if (githubPrHeadBranch) {