mirror of
https://github.com/stablyai/orca.git
synced 2026-09-29 16:02:50 +00:00
fix(native-chat): ignore resolved default agent args in routing
This commit is contained in:
@@ -24,7 +24,7 @@ import {
|
||||
} from './folder-workspace-composer-helpers'
|
||||
import {
|
||||
hasExplicitTuiLaunchCustomization,
|
||||
hasSemanticallyNonEmptyAgentArgs,
|
||||
hasExplicitTuiAgentArgs,
|
||||
resolveAgentLaunchRoute
|
||||
} from '@/lib/agent-launch-routing'
|
||||
import { readLocalRuntimeCapabilities } from '@/runtime/local-runtime-capabilities'
|
||||
@@ -157,7 +157,7 @@ export async function submitFolderWorkspaceCreate({
|
||||
launchText: launchDraftPrompt ?? note,
|
||||
nativeChatTranscriptIsLocalReadable: !launchIsRemote,
|
||||
requiresTuiLaunchCustomization:
|
||||
hasSemanticallyNonEmptyAgentArgs(agentArgs) ||
|
||||
hasExplicitTuiAgentArgs(quickAgent, agentArgs) ||
|
||||
hasExplicitTuiLaunchCustomization(settings, quickAgent),
|
||||
initialSessionOptions: startupPlan?.sessionOptions
|
||||
})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { STRUCTURED_AGENT_SESSION_RUNTIME_CAPABILITY } from '../../../shared/protocol-version'
|
||||
import {
|
||||
hasExplicitTuiAgentArgs,
|
||||
hasExplicitTuiLaunchCustomization,
|
||||
hasSemanticallyNonEmptyAgentArgs,
|
||||
resolveAgentLaunchRoute
|
||||
@@ -113,4 +114,14 @@ describe('resolveAgentLaunchRoute', () => {
|
||||
)
|
||||
).toBe(false)
|
||||
})
|
||||
|
||||
it('does not classify the resolved default TUI args as customization', () => {
|
||||
expect(hasExplicitTuiAgentArgs('codex', '--dangerously-bypass-approvals-and-sandbox')).toBe(
|
||||
false
|
||||
)
|
||||
expect(hasExplicitTuiAgentArgs('codex', '--model gpt-5.6-sol')).toBe(true)
|
||||
expect(route({ agentArgs: '--dangerously-bypass-approvals-and-sandbox' })).toBe(
|
||||
'structured-native-chat'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -52,9 +52,7 @@ export function hasExplicitTuiLaunchCustomization(
|
||||
Object.entries(configuredEnv).some(([key, value]) => defaultEnv[key] !== value))
|
||||
return (
|
||||
Boolean(settings?.agentCmdOverrides?.[agent]?.trim()) ||
|
||||
(configuredArgs !== undefined &&
|
||||
configuredArgs.trim().length > 0 &&
|
||||
configuredArgs.trim() !== getTuiAgentDefaultArgs(agent).trim()) ||
|
||||
hasExplicitTuiAgentArgs(agent, configuredArgs) ||
|
||||
envIsCustomized
|
||||
)
|
||||
}
|
||||
@@ -63,6 +61,14 @@ export function hasSemanticallyNonEmptyAgentArgs(value: string | null | undefine
|
||||
return Boolean(value?.trim())
|
||||
}
|
||||
|
||||
export function hasExplicitTuiAgentArgs(
|
||||
agent: TuiAgent,
|
||||
value: string | null | undefined
|
||||
): boolean {
|
||||
const trimmed = value?.trim() ?? ''
|
||||
return trimmed.length > 0 && trimmed !== getTuiAgentDefaultArgs(agent).trim()
|
||||
}
|
||||
|
||||
export function resolveAgentLaunchRoute(input: AgentLaunchRoutingInput): AgentLaunchRoute {
|
||||
const initialViewMode = decideInitialAgentTabViewMode({
|
||||
experimentalNativeChat: input.settings?.experimentalNativeChat,
|
||||
|
||||
@@ -35,7 +35,7 @@ import { seedNativeChatAppliedSessionOptions } from '@/components/native-chat/na
|
||||
import { startStructuredCodexLaunch } from '@/lib/structured-agent-session-launch'
|
||||
import {
|
||||
hasExplicitTuiLaunchCustomization,
|
||||
hasSemanticallyNonEmptyAgentArgs,
|
||||
hasExplicitTuiAgentArgs,
|
||||
resolveAgentLaunchRoute
|
||||
} from '@/lib/agent-launch-routing'
|
||||
import { readLocalRuntimeCapabilities } from '@/runtime/local-runtime-capabilities'
|
||||
@@ -217,7 +217,7 @@ function launchAgentInNewTabInternal(
|
||||
initialViewModeOptions.nativeChatTranscriptIsLocalReadable,
|
||||
requiresTuiLaunchCustomization:
|
||||
Boolean(initialCwd?.trim()) ||
|
||||
hasSemanticallyNonEmptyAgentArgs(agentArgs) ||
|
||||
hasExplicitTuiAgentArgs(agent, agentArgs) ||
|
||||
hasExplicitTuiLaunchCustomization(store.settings, agent),
|
||||
initialSessionOptions: startupPlan.sessionOptions
|
||||
})
|
||||
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
import { getExecutionHostIdForWorktree } from '@/lib/worktree-runtime-owner'
|
||||
import {
|
||||
hasExplicitTuiLaunchCustomization,
|
||||
hasSemanticallyNonEmptyAgentArgs,
|
||||
hasExplicitTuiAgentArgs,
|
||||
resolveAgentLaunchRoute
|
||||
} from '@/lib/agent-launch-routing'
|
||||
import { readLocalRuntimeCapabilities } from '@/runtime/local-runtime-capabilities'
|
||||
@@ -268,7 +268,7 @@ export async function launchWorkItemDirect(args: LaunchWorkItemDirectArgs): Prom
|
||||
nativeChatTranscriptIsLocalReadable:
|
||||
isNativeChatTranscriptLocalReadable(launchConnectionId),
|
||||
requiresTuiLaunchCustomization:
|
||||
hasSemanticallyNonEmptyAgentArgs(agentArgs) ||
|
||||
hasExplicitTuiAgentArgs(effectiveAgent, agentArgs) ||
|
||||
hasExplicitTuiLaunchCustomization(settings, effectiveAgent),
|
||||
initialSessionOptions: startupPlan?.sessionOptions
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user