Files
orca/src/shared/source-control-recovery-agent-command.test.ts
T
Jinjinganddalveytech-vincent 070a956a72 feat(source-control): add push failure AI recovery (#7826)
* feat(source-control): add Fix push failure with AI for pre-push hooks

Detect pre-push hook failures separately from auth/transport errors so
push toasts and inline messages no longer suggest checking repo access.
Mirror the commit-failure recovery flow with a fixPushFailure action,
summary panel, details dialog, and agent launch recipe in Settings.

Fixes #6497

* feat(source-control): add push failure AI recovery

Co-authored-by: dalveytech-vincent <vincent@dalveytech.com>

---------

Co-authored-by: dalveytech-vincent <vincent@dalveytech.com>
2026-07-08 18:59:28 -07:00

54 lines
1.8 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { buildCommitFailureAgentCommandInput } from './source-control-commit-failure-agent-command'
import { buildPushFailureAgentCommandInput } from './source-control-push-failure-agent-command'
import { buildSourceControlRecoveryAgentCommandInput } from './source-control-recovery-agent-command'
describe('source-control recovery agent command input', () => {
it('renders a generic recovery command template for a launch action', () => {
expect(
buildSourceControlRecoveryAgentCommandInput({
actionId: 'fixPushFailure',
commandInputTemplate: 'agent {basePrompt}',
basePrompt: 'Fix this push failure.'
})
).toBe('agent Fix this push failure.')
})
it('leaves blank templates blank so the launcher can reject them', () => {
expect(
buildSourceControlRecoveryAgentCommandInput({
actionId: 'fixCommitFailure',
commandInputTemplate: ' ',
basePrompt: 'Fix this commit failure.'
})
).toBe('')
})
it('uses prompt overrides before saved templates', () => {
expect(
buildSourceControlRecoveryAgentCommandInput({
actionId: 'fixCommitFailure',
promptOverride: ' custom prompt ',
commandInputTemplate: '{basePrompt}',
basePrompt: 'Fix this commit failure.'
})
).toBe('custom prompt')
})
it('keeps commit and push compatibility wrappers on the generic builder', () => {
expect(
buildCommitFailureAgentCommandInput({
commandInputTemplate: undefined,
basePrompt: 'Fix this commit failure.'
})
).toBe('Fix this commit failure.')
expect(
buildPushFailureAgentCommandInput({
commandInputTemplate: undefined,
basePrompt: 'Fix this push failure.'
})
).toBe('Fix this push failure.')
})
})