mirror of
https://github.com/stablyai/orca.git
synced 2026-09-25 00:02:35 +00:00
Prevent empty agent-launch fallback on automation dispatch (#13068)
The automation session owns the prompt-bearing agent tab. Passing undefined for createdWithAgent prevents spurious empty agent tabs from opening when dispatching automations.
This commit is contained in:
@@ -293,6 +293,19 @@ describe('useAutomationDispatchEvents setup launch', () => {
|
||||
expect(mockLaunchAgentBackgroundSession).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('does not stamp the created workspace with an empty agent-launch fallback', async () => {
|
||||
await registerAndDispatch()
|
||||
|
||||
expect(mockCreateWorktree.mock.calls[0][10]).toBeUndefined()
|
||||
expect(mockLaunchAgentBackgroundSession).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
agent: 'claude',
|
||||
prompt: 'run this',
|
||||
worktreeId: 'wt-created'
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it('keeps launching the agent when background setup terminal launch fails', async () => {
|
||||
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
|
||||
mockLaunchWorktreeBackgroundTerminals.mockRejectedValue(new Error('tab launch failed'))
|
||||
|
||||
@@ -220,43 +220,43 @@ export function useAutomationDispatchEvents(): void {
|
||||
const automationWorkspaceCreateRequestId = createBrowserUuid()
|
||||
const createResult =
|
||||
automation.workspaceMode === 'new_per_run'
|
||||
? await useAppStore
|
||||
.getState()
|
||||
.createWorktree(
|
||||
runRepoId,
|
||||
buildAutomationWorkspaceName(run.title, run.scheduledFor),
|
||||
automation.baseBranch ?? undefined,
|
||||
automation.setupDecision ?? 'skip',
|
||||
undefined,
|
||||
'unknown',
|
||||
run.title,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
automation.agentId,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
automationProvenanceRequest: {
|
||||
automationId: automation.id,
|
||||
automationRunId: run.id,
|
||||
dispatchToken,
|
||||
createRequestId: automationWorkspaceCreateRequestId
|
||||
}
|
||||
? await useAppStore.getState().createWorktree(
|
||||
runRepoId,
|
||||
buildAutomationWorkspaceName(run.title, run.scheduledFor),
|
||||
automation.baseBranch ?? undefined,
|
||||
automation.setupDecision ?? 'skip',
|
||||
undefined,
|
||||
'unknown',
|
||||
run.title,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
// Why: the automation session below owns the prompt-bearing
|
||||
// agent tab; createdWithAgent would reopen an empty fallback.
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
automationProvenanceRequest: {
|
||||
automationId: automation.id,
|
||||
automationRunId: run.id,
|
||||
dispatchToken,
|
||||
createRequestId: automationWorkspaceCreateRequestId
|
||||
}
|
||||
)
|
||||
}
|
||||
)
|
||||
: null
|
||||
const worktree = createResult
|
||||
? createResult.worktree
|
||||
|
||||
Reference in New Issue
Block a user