Increase Quick Command agent prompt limit (#6283)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Brennan Benson 2026-06-24 11:58:51 -07:00 committed by GitHub
parent 52b0f8bf68
commit 20882d7a25
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 61 additions and 3 deletions

View File

@ -159,6 +159,61 @@ describe('terminal quick commands', () => {
])
})
it('keeps larger reusable agent prompts while bounding shell commands separately', () => {
const largePrompt = 'Review this diff.\n'.repeat(320)
const overLimitPrompt = 'x'.repeat(6001)
const overLimitCommand = 'y'.repeat(4001)
expect(
normalizeTerminalQuickCommands([
{
id: 'large-review',
label: 'Review',
action: 'agent-prompt',
agent: 'codex',
prompt: largePrompt
},
{
id: 'over-limit-review',
label: 'Review with cap',
action: 'agent-prompt',
agent: 'codex',
prompt: overLimitPrompt
},
{
id: 'over-limit-command',
label: 'Run long command',
command: overLimitCommand
}
])
).toEqual([
{
id: 'large-review',
label: 'Review',
action: 'agent-prompt',
agent: 'codex',
prompt: largePrompt.trimEnd(),
scope: { type: 'global' }
},
{
id: 'over-limit-review',
label: 'Review with cap',
action: 'agent-prompt',
agent: 'codex',
prompt: 'x'.repeat(6000),
scope: { type: 'global' }
},
{
id: 'over-limit-command',
label: 'Run long command',
action: 'terminal-command',
command: 'y'.repeat(4000),
appendEnter: true,
scope: { type: 'global' }
}
])
})
it('matches global commands everywhere and repo commands only in their repo', () => {
expect(
terminalQuickCommandMatchesRepo(

View File

@ -10,7 +10,10 @@ import type {
const MAX_QUICK_COMMANDS = 40
const MAX_QUICK_COMMAND_LABEL_LENGTH = 80
const MAX_QUICK_COMMAND_REPO_ID_LENGTH = 200
const MAX_QUICK_COMMAND_TEXT_LENGTH = 4000
const MAX_QUICK_COMMAND_TERMINAL_TEXT_LENGTH = 4000
// Why: agent prompt quick commands still launch through startup commands for
// argv/flag agents, so this must stay within Orca's Windows shell safety cap.
const MAX_QUICK_COMMAND_AGENT_PROMPT_LENGTH = 6000
const REMOVED_PRESET_IDS = new Set(['default-pwd', 'default-git-status'])
const DEFAULT_TERMINAL_QUICK_COMMANDS: TerminalQuickCommand[] = []
@ -133,7 +136,7 @@ export function normalizeTerminalQuickCommands(input: unknown): TerminalQuickCom
agent: agentId,
prompt: (hasPrompt ? String(record.prompt).trimEnd() : '').slice(
0,
MAX_QUICK_COMMAND_TEXT_LENGTH
MAX_QUICK_COMMAND_AGENT_PROMPT_LENGTH
)
})
} else {
@ -141,7 +144,7 @@ export function normalizeTerminalQuickCommands(input: unknown): TerminalQuickCom
normalized.push({
...base,
action: 'terminal-command',
command: command.slice(0, MAX_QUICK_COMMAND_TEXT_LENGTH),
command: command.slice(0, MAX_QUICK_COMMAND_TERMINAL_TEXT_LENGTH),
appendEnter: record.appendEnter !== false
})
}