Add mobile Tasks parity (#2452)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Jinwoo Hong
2026-05-21 20:26:07 -07:00
committed by GitHub
co-authored by Orca
parent 3efc669bd4
commit b1973657ea
123 changed files with 26492 additions and 1461 deletions
@@ -57,6 +57,7 @@ describe('worktree RPC methods', () => {
setupDecision: 'skip',
createdWithAgent: undefined,
startup: undefined,
startupDraft: undefined,
lineage: {
parentWorktree: 'id:parent',
noParent: false,
@@ -66,6 +67,35 @@ describe('worktree RPC methods', () => {
})
})
it('forwards task startup drafts to runtime worktree creation', async () => {
const runtime = {
getRuntimeId: () => 'test-runtime',
createManagedWorktree: vi.fn().mockResolvedValue({ worktree: { id: 'wt-1' } })
} as unknown as OrcaRuntimeService
const dispatcher = new RpcDispatcher({ runtime, methods: WORKTREE_METHODS })
await dispatcher.dispatch(
makeRequest('worktree.create', {
repo: 'repo-1',
name: 'issue-123',
startupDraft: 'https://github.com/stablyai/orca/issues/123',
createdWithAgent: 'codex',
activate: true
})
)
expect(runtime.createManagedWorktree).toHaveBeenCalledWith(
expect.objectContaining({
repoSelector: 'repo-1',
name: 'issue-123',
activate: true,
createdWithAgent: 'codex',
startup: undefined,
startupDraft: 'https://github.com/stablyai/orca/issues/123'
})
)
})
it('rejects worktree.create when both parent and no-parent are supplied', async () => {
const runtime = {
getRuntimeId: () => 'test-runtime',
@@ -87,6 +117,56 @@ describe('worktree RPC methods', () => {
expect(runtime.createManagedWorktree).not.toHaveBeenCalled()
})
it('passes explicit repo selectors to PR base resolution', async () => {
const runtime = {
getRuntimeId: () => 'test-runtime',
resolveManagedPrBase: vi.fn().mockResolvedValue({ baseBranch: 'origin/pr-head' })
} as unknown as OrcaRuntimeService
const dispatcher = new RpcDispatcher({ runtime, methods: WORKTREE_METHODS })
const response = await dispatcher.dispatch(
makeRequest('worktree.resolvePrBase', {
repo: 'id:repo-1',
prNumber: 42,
headRefName: 'feature/pr-head',
isCrossRepository: false
})
)
expect(response).toMatchObject({ ok: true })
expect(runtime.resolveManagedPrBase).toHaveBeenCalledWith({
repoSelector: 'id:repo-1',
prNumber: 42,
headRefName: 'feature/pr-head',
isCrossRepository: false
})
})
it('passes explicit repo selectors to MR base resolution', async () => {
const runtime = {
getRuntimeId: () => 'test-runtime',
resolveManagedMrBase: vi.fn().mockResolvedValue({ baseBranch: 'origin/mr-head' })
} as unknown as OrcaRuntimeService
const dispatcher = new RpcDispatcher({ runtime, methods: WORKTREE_METHODS })
const response = await dispatcher.dispatch(
makeRequest('worktree.resolveMrBase', {
repo: 'id:repo-1',
mrIid: 42,
sourceBranch: 'feature/mr-head',
isCrossRepository: false
})
)
expect(response).toMatchObject({ ok: true })
expect(runtime.resolveManagedMrBase).toHaveBeenCalledWith({
repoSelector: 'id:repo-1',
mrIid: 42,
sourceBranch: 'feature/mr-head',
isCrossRepository: false
})
})
it('rejects worktree.set when both parent and no-parent are supplied', async () => {
const runtime = {
getRuntimeId: () => 'test-runtime',