Enable first-input rename for folder workspaces

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
brennanb2025
2026-06-11 17:43:13 -07:00
co-authored by Orca
parent d6c9d72f01
commit 8a938cdd89
5 changed files with 138 additions and 19 deletions
@@ -126,7 +126,7 @@ export function AutoRenameBranchFromWorkSetting({
<SearchableSetting
title={translate(
'auto.components.settings.AutoRenameBranchFromWorkSetting.ef787db0e3',
'Auto-Rename Branch'
'Auto-rename branch & worktree'
)}
description={translate(
'auto.components.settings.AutoRenameBranchFromWorkSetting.6a051586d2',
@@ -152,7 +152,7 @@ export function AutoRenameBranchFromWorkSetting({
<Label>
{translate(
'auto.components.settings.AutoRenameBranchFromWorkSetting.ef787db0e3',
'Auto-Rename Branch'
'Auto-rename branch & worktree'
)}
</Label>
<p className="text-xs text-muted-foreground">
@@ -7,7 +7,7 @@ export const getAutoRenameBranchParentSearchEntry = createLocalizedCatalog(
(): SettingsSearchEntry => ({
title: translate(
'auto.components.settings.auto.rename.branch.search.427f2cd1eb',
'Auto-Rename Branch'
'Auto-rename branch & worktree'
),
description: translate(
'auto.components.settings.auto.rename.branch.search.ea94b9da8a',
@@ -88,4 +88,118 @@ describe('submitFolderWorkspaceCreate', () => {
expect.any(Error)
)
})
it('marks a blank folder workspace for first-input rename when launching an agent with a note', async () => {
const createFolderWorkspace = vi.fn(async () => makeFolderWorkspace())
const onOpenChange = vi.fn()
await submitFolderWorkspaceCreate({
projectGroup: makeProjectGroup(),
name: '',
lastAutoName: '',
linkedWorkItem: null,
note: 'Fix the flaky checkout flow',
quickAgent: 'codex',
autoRenameBranchFromWork: true,
agentCmdOverrides: {},
createFolderWorkspace,
onOpenChange
})
expect(createFolderWorkspace).toHaveBeenCalledWith({
projectGroupId: 'group-1',
name: 'Platform workspace',
linkedTask: null,
createdWithAgent: 'codex',
pendingFirstAgentMessageRename: true
})
expect(mocks.activateAndRevealFolderWorkspace).toHaveBeenCalledWith(
'folder-workspace-1',
expect.objectContaining({
startup: expect.objectContaining({
command: expect.stringContaining('codex')
})
})
)
})
it('does not mark first-input rename when the folder workspace has an explicit name', async () => {
const createFolderWorkspace = vi.fn(async () => makeFolderWorkspace())
await submitFolderWorkspaceCreate({
projectGroup: makeProjectGroup(),
name: 'Checkout polish',
lastAutoName: '',
linkedWorkItem: null,
note: 'Fix the flaky checkout flow',
quickAgent: 'codex',
autoRenameBranchFromWork: true,
agentCmdOverrides: {},
createFolderWorkspace,
onOpenChange: vi.fn()
})
expect(createFolderWorkspace).toHaveBeenCalledWith({
projectGroupId: 'group-1',
name: 'Checkout polish',
linkedTask: null,
createdWithAgent: 'codex'
})
})
it('does not mark first-input rename when a linked work item owns the folder workspace name', async () => {
const createFolderWorkspace = vi.fn(async () => makeFolderWorkspace())
const linkedWorkItem = {
provider: 'github' as const,
type: 'issue' as const,
number: 42,
title: 'Restore checkout polish',
url: 'https://github.com/stablyai/orca/issues/42',
repoId: 'repo-1'
}
await submitFolderWorkspaceCreate({
projectGroup: makeProjectGroup(),
name: '',
lastAutoName: '',
linkedWorkItem,
note: 'Use the issue context',
quickAgent: 'codex',
autoRenameBranchFromWork: true,
agentCmdOverrides: {},
createFolderWorkspace,
onOpenChange: vi.fn()
})
expect(createFolderWorkspace).toHaveBeenCalledWith({
projectGroupId: 'group-1',
name: 'Restore checkout polish',
linkedTask: linkedWorkItem,
createdWithAgent: 'codex'
})
})
it('does not mark first-input rename without submitted first input', async () => {
const createFolderWorkspace = vi.fn(async () => makeFolderWorkspace())
await submitFolderWorkspaceCreate({
projectGroup: makeProjectGroup(),
name: '',
lastAutoName: '',
linkedWorkItem: null,
note: ' ',
quickAgent: 'codex',
autoRenameBranchFromWork: true,
agentCmdOverrides: {},
createFolderWorkspace,
onOpenChange: vi.fn()
})
expect(createFolderWorkspace).toHaveBeenCalledWith({
projectGroupId: 'group-1',
name: 'Platform workspace',
linkedTask: null,
createdWithAgent: 'codex'
})
})
})
@@ -54,20 +54,6 @@ export async function submitFolderWorkspaceCreate({
nameIsAutoManaged && linkedName
? linkedName
: name.trim() || linkedName || `${projectGroup.name} workspace`
const pendingFirstAgentMessageRename =
autoRenameBranchFromWork === true && !name.trim() && !linkedWorkItem && Boolean(quickAgent)
const workspace = await createFolderWorkspace({
projectGroupId: projectGroup.id,
name: workspaceName,
linkedTask: toFolderWorkspaceLinkedTask(linkedWorkItem),
...(quickAgent ? { createdWithAgent: quickAgent } : {}),
...(pendingFirstAgentMessageRename ? { pendingFirstAgentMessageRename: true } : {})
})
if (!workspace) {
return
}
const linearCliAvailable = linkedWorkItem?.linearIdentifier
? await isOrcaCliAvailableForLaunch({ remote: projectGroup.connectionId != null })
: false
@@ -80,6 +66,25 @@ export async function submitFolderWorkspaceCreate({
linkedPromptContext.linkedUrls,
linkedPromptContext.linkedContextBlocks
)
// Why: the pending badge should only appear when the submitted prompt can
// actually produce the first agent message that names the workspace.
const pendingFirstAgentMessageRename =
autoRenameBranchFromWork === true &&
!name.trim() &&
!linkedWorkItem &&
Boolean(quickAgent) &&
startupPrompt.trim().length > 0
const workspace = await createFolderWorkspace({
projectGroupId: projectGroup.id,
name: workspaceName,
linkedTask: toFolderWorkspaceLinkedTask(linkedWorkItem),
...(quickAgent ? { createdWithAgent: quickAgent } : {}),
...(pendingFirstAgentMessageRename ? { pendingFirstAgentMessageRename: true } : {})
})
if (!workspace) {
return
}
const startupPlan = quickAgent
? buildAgentStartupPlan({
agent: quickAgent,
+2 -2
View File
@@ -4064,7 +4064,7 @@
"e784ea62dc": "Advanced",
"d9b65054ef": ") to a short name summarizing the task. Only branches Orca named itself are renamed, and never after they have been pushed.",
"12ea4a408d": "When an agent starts working in a new workspace, Orca renames its auto-generated branch (e.g.",
"ef787db0e3": "Auto-Rename Branch",
"ef787db0e3": "Auto-rename branch & worktree",
"6a051586d2": "Rename the auto-generated branch based on the work once an agent starts.",
"ec3e0c388e": "Save",
"cfd82406dd": "Saving...",
@@ -6108,7 +6108,7 @@
"55a1860e47": "rename",
"9319bd9827": "branch",
"ea94b9da8a": "Rename the auto-generated branch based on the work once an agent starts.",
"427f2cd1eb": "Auto-Rename Branch"
"427f2cd1eb": "Auto-rename branch & worktree"
}
}
}