mirror of
https://github.com/stablyai/orca.git
synced 2026-11-16 02:47:34 +00:00
fix(mobile): let folder repo review actions launch without a Git verdict
Repo-backed folder workspaces have repo::path ids, so the mobile review-action gate sent git.status for them and refused the launch. The gate now reuses the repo the launch context already resolved and, like desktop's isFolderRepo check, skips the verdict for folder repos; Git workspaces still need a fresh 'none'.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { RepoKind } from '../../../../src/shared/repo-types'
|
||||
import { bindDeferredRpcOperation, defineRpcOperation } from '../../transport/rpc/rpc-operation'
|
||||
import { rpcResultVariant } from '../../transport/rpc/rpc-operation-result-reader'
|
||||
import '../../terminal/terminal-reply-schema'
|
||||
@@ -11,6 +12,7 @@ import '../../terminal/quick-commands/mobile-quick-command-reply-schema'
|
||||
import '../../files/workspace-file-paths-reply-schema'
|
||||
|
||||
export type MobileRuntimeRepoSummary = {
|
||||
kind?: RepoKind
|
||||
id: string
|
||||
connectionId?: string | null
|
||||
executionHostId?: string | null
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import type { RpcOperationSender } from '../transport/rpc-operation-sender'
|
||||
import type { RpcOperationSender } from '../transport/rpc/rpc-operation-sender'
|
||||
import type { MobileRuntimeRepoSummary } from './agent-launch/mobile-runtime-repo-operations'
|
||||
import { isFolderRepo } from '../../../src/shared/repo-kind'
|
||||
import { gitRebaseVerdictRead } from '../source-control/mobile-git-read-operations'
|
||||
import { translate } from '../i18n/mobile-i18n'
|
||||
import { workspaceKindForWorktreeId } from '../../../src/shared/workspace-launch-kind'
|
||||
@@ -11,9 +13,12 @@ export type MobileReviewActionAdmission = { ok: true } | { ok: false; message: s
|
||||
*/
|
||||
export async function confirmNoRebaseBeforeMobileReviewAction(
|
||||
client: RpcOperationSender,
|
||||
worktreeId: string
|
||||
worktreeId: string,
|
||||
/** The repo the launch resolved for this workspace (host ambiguity already settled). */
|
||||
repo: Pick<MobileRuntimeRepoSummary, 'kind'> | null
|
||||
): Promise<MobileReviewActionAdmission> {
|
||||
if (workspaceKindForWorktreeId(worktreeId) !== 'git-worktree') {
|
||||
// Folders, native or repo-backed, run no Git operation, so their review launches are unchanged.
|
||||
if (workspaceKindForWorktreeId(worktreeId) !== 'git-worktree' || (repo && isFolderRepo(repo))) {
|
||||
return { ok: true }
|
||||
}
|
||||
let verdict: 'active' | 'none' | 'unverifiable' | undefined
|
||||
|
||||
@@ -6,7 +6,8 @@ import {
|
||||
} from '../../session/agent-launch/mobile-existing-agent-launch'
|
||||
import {
|
||||
hostRefusesOtherRuntimeWorkspace,
|
||||
loadMobileAgentLaunchContext
|
||||
loadMobileAgentLaunchContext,
|
||||
type MobileAgentLaunchContext
|
||||
} from '../../session/agent-launch/mobile-new-tab-agent-loader'
|
||||
import { resolveMobileSourceControlLaunchAgent } from './mobile-source-control-launch-agent'
|
||||
import { projectSourceControlActionLaunch } from '../../../../src/shared/source-control/ai/recipes/source-control-action-launch-preferences'
|
||||
@@ -41,7 +42,9 @@ export async function launchAgentWithPrompt(args: {
|
||||
prompt: string
|
||||
launchSource: string
|
||||
/** Runs after agent resolution so its owner-side check is fresh at launch; a refusal starts nothing. */
|
||||
admitLaunch?: () => Promise<{ ok: true } | { ok: false; message: string }>
|
||||
admitLaunch?: (
|
||||
context: Pick<MobileAgentLaunchContext, 'repo'>
|
||||
) => Promise<{ ok: true } | { ok: false; message: string }>
|
||||
}): Promise<MobilePromptedAgentLaunch> {
|
||||
if (!supportsMobileExistingAgentLaunch(args.hostCapabilities)) {
|
||||
return {
|
||||
@@ -53,15 +56,14 @@ export async function launchAgentWithPrompt(args: {
|
||||
}
|
||||
}
|
||||
let resolved
|
||||
let context: MobileAgentLaunchContext
|
||||
try {
|
||||
resolved = resolveMobileSourceControlLaunchAgent(
|
||||
await loadMobileAgentLaunchContext({
|
||||
client: args.client,
|
||||
worktreeId: args.worktreeId,
|
||||
hostRefusesOtherRuntime: hostRefusesOtherRuntimeWorkspace(args.hostCapabilities)
|
||||
}),
|
||||
args.actionId
|
||||
)
|
||||
context = await loadMobileAgentLaunchContext({
|
||||
client: args.client,
|
||||
worktreeId: args.worktreeId,
|
||||
hostRefusesOtherRuntime: hostRefusesOtherRuntimeWorkspace(args.hostCapabilities)
|
||||
})
|
||||
resolved = resolveMobileSourceControlLaunchAgent(context, args.actionId)
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message.trim() : ''
|
||||
return {
|
||||
@@ -88,7 +90,7 @@ export async function launchAgentWithPrompt(args: {
|
||||
)
|
||||
}
|
||||
}
|
||||
const admission = args.admitLaunch ? await args.admitLaunch() : null
|
||||
const admission = args.admitLaunch ? await args.admitLaunch(context) : null
|
||||
if (admission && !admission.ok) {
|
||||
return { kind: 'not-started', message: admission.message }
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import type { RpcClient } from '../../transport/rpc/rpc-client-contract'
|
||||
import { triggerError, triggerSuccess } from '../../platform/haptics'
|
||||
import { useMobileTranslation } from '../../i18n/use-mobile-translation'
|
||||
import { launchAgentWithPrompt, promptedLaunchNotice } from './pr-ai-triage-launch'
|
||||
import { confirmNoRebaseBeforeMobileReviewAction } from './mobile-review-action-rebase-check'
|
||||
import { confirmNoRebaseBeforeMobileReviewAction } from '../../session/mobile-review-action-rebase-check'
|
||||
import {
|
||||
resolveMobileAgentLaunchAvailability,
|
||||
type MobileAgentLaunchAvailability
|
||||
@@ -102,7 +102,10 @@ export function useMobilePrAiTriage(input: Input) {
|
||||
...TRIAGE_LAUNCH[key],
|
||||
// Review actions need the desktop rule: no launch while the owner is rebasing.
|
||||
...(scope === 'review'
|
||||
? { admitLaunch: () => confirmNoRebaseBeforeMobileReviewAction(client, worktreeId) }
|
||||
? {
|
||||
admitLaunch: ({ repo }) =>
|
||||
confirmNoRebaseBeforeMobileReviewAction(client, worktreeId, repo)
|
||||
}
|
||||
: {})
|
||||
})
|
||||
const notice = promptedLaunchNotice(result, workspaceLabel)
|
||||
|
||||
Reference in New Issue
Block a user