Revert Claude scoped settings launch path (#2809)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Brennan Benson
2026-05-25 19:03:14 -07:00
committed by GitHub
co-authored by Orca
parent e0af80ddec
commit add481978e
20 changed files with 171 additions and 287 deletions
-19
View File
@@ -1,19 +0,0 @@
export const ORCA_CLAUDE_AGENT_STATUS_SETTINGS_ENV = 'ORCA_CLAUDE_AGENT_STATUS_SETTINGS'
export const ORCA_CLAUDE_AGENT_STATUS_SETTINGS_FILE = 'claude-agent-status-settings.json'
type ClaudeSettingsShell = 'posix' | 'powershell' | 'cmd'
export function appendOrcaClaudeAgentStatusSettings(
command: string,
shell: ClaudeSettingsShell
): string {
// Why: Claude's --settings is a per-process overlay. CLAUDE_CONFIG_DIR
// would fork auth/session state and normal external Claude launches.
if (shell === 'powershell') {
return `${command} --settings $Env:${ORCA_CLAUDE_AGENT_STATUS_SETTINGS_ENV}`
}
if (shell === 'cmd') {
return `${command} --settings "%${ORCA_CLAUDE_AGENT_STATUS_SETTINGS_ENV}%"`
}
return `${command} --settings "$HOME/.orca/agent-hooks/${ORCA_CLAUDE_AGENT_STATUS_SETTINGS_FILE}"`
}
+5 -45
View File
@@ -47,55 +47,16 @@ describe('tui agent startup plans', () => {
expect(plan?.launchCommand).toBe("codex 'fix it'")
})
it('does not inject Codex profile flags through the shared agent-status option', () => {
const plan = buildAgentStartupPlan({
agent: 'codex',
prompt: 'fix it',
cmdOverrides: {},
platform: 'linux',
useOrcaClaudeAgentStatusSettings: true
})
expect(plan?.launchCommand).toBe("codex 'fix it'")
expect(plan?.launchCommand).not.toContain('--profile')
expect(plan?.launchCommand).not.toContain('orca-agent-status')
})
it('launches Claude with the Orca settings file when agent status hooks are enabled', () => {
it('launches Claude without Orca settings injection', () => {
const plan = buildAgentStartupPlan({
agent: 'claude',
prompt: 'fix it',
cmdOverrides: {},
platform: 'linux',
useOrcaClaudeAgentStatusSettings: true
platform: 'linux'
})
expect(plan?.launchCommand).toBe(
'claude --settings "$HOME/.orca/agent-hooks/claude-agent-status-settings.json" \'fix it\''
)
})
it('uses the target shell syntax for Claude settings injection', () => {
expect(
buildAgentStartupPlan({
agent: 'claude',
prompt: 'fix it',
cmdOverrides: {},
platform: 'win32',
useOrcaClaudeAgentStatusSettings: true
})?.launchCommand
).toBe("claude --settings $Env:ORCA_CLAUDE_AGENT_STATUS_SETTINGS 'fix it'")
expect(
buildAgentStartupPlan({
agent: 'claude',
prompt: 'fix it',
cmdOverrides: {},
platform: 'win32',
shell: 'cmd',
useOrcaClaudeAgentStatusSettings: true
})?.launchCommand
).toBe('claude --settings "%ORCA_CLAUDE_AGENT_STATUS_SETTINGS%" "fix it"')
expect(plan?.launchCommand).toBe("claude 'fix it'")
expect(plan?.launchCommand).not.toContain('--settings')
})
it('leaves Claude command overrides untouched', () => {
@@ -103,8 +64,7 @@ describe('tui agent startup plans', () => {
agent: 'claude',
prompt: 'fix it',
cmdOverrides: { claude: 'claude --dangerously-skip-permissions' },
platform: 'linux',
useOrcaClaudeAgentStatusSettings: true
platform: 'linux'
})
expect(plan?.launchCommand).toBe("claude --dangerously-skip-permissions 'fix it'")
+2 -11
View File
@@ -1,5 +1,4 @@
import { isShellProcess } from './agent-detection'
import { appendOrcaClaudeAgentStatusSettings } from './claude-settings'
import { TUI_AGENT_CONFIG } from './tui-agent-config'
import type { TuiAgent } from './types'
@@ -49,16 +48,12 @@ function resolveBaseCommand(args: {
agent: TuiAgent
cmdOverrides: Partial<Record<TuiAgent, string>>
shell: AgentStartupShell
useOrcaClaudeAgentStatusSettings?: boolean
}): string {
const override = args.cmdOverrides[args.agent]
if (override) {
return override
}
const command = TUI_AGENT_CONFIG[args.agent].launchCmd
if (args.agent === 'claude' && args.useOrcaClaudeAgentStatusSettings) {
return appendOrcaClaudeAgentStatusSettings(command, args.shell)
}
// Why: Codex status hooks live in Orca's runtime CODEX_HOME; adding
// --profile-v2 makes Codex load a second hook representation and warn.
return command
@@ -71,7 +66,6 @@ export function buildAgentStartupPlan(args: {
platform: NodeJS.Platform
shell?: AgentStartupShell
allowEmptyPromptLaunch?: boolean
useOrcaClaudeAgentStatusSettings?: boolean
}): AgentStartupPlan | null {
const { agent, prompt, cmdOverrides, platform, allowEmptyPromptLaunch = false } = args
const shell = resolveStartupShell(platform, args.shell)
@@ -80,8 +74,7 @@ export function buildAgentStartupPlan(args: {
const baseCommand = resolveBaseCommand({
agent,
cmdOverrides,
shell,
useOrcaClaudeAgentStatusSettings: args.useOrcaClaudeAgentStatusSettings
shell
})
if (!trimmedPrompt) {
@@ -155,7 +148,6 @@ export function buildAgentDraftLaunchPlan(args: {
cmdOverrides: Partial<Record<TuiAgent, string>>
platform: NodeJS.Platform
shell?: AgentStartupShell
useOrcaClaudeAgentStatusSettings?: boolean
}): AgentDraftLaunchPlan | null {
const { agent, draft, cmdOverrides, platform } = args
const shell = resolveStartupShell(platform, args.shell)
@@ -167,8 +159,7 @@ export function buildAgentDraftLaunchPlan(args: {
const baseCommand = resolveBaseCommand({
agent,
cmdOverrides,
shell,
useOrcaClaudeAgentStatusSettings: args.useOrcaClaudeAgentStatusSettings
shell
})
if (config.draftPromptFlag) {
const quoted = quoteStartupArg(trimmed, shell)