Skip to content

finish command returns exit code 0 when user aborts commit message review #398

@acreeger

Description

@acreeger

Problem

When a user aborts the commit message review during il finish (by selecting "Abort" at the prompt or editing the message to be empty), the command returns exit code 0 (success) instead of a non-zero exit code.

This makes it impossible for calling tools (like the VS Code extension) to distinguish between a successful finish and an aborted one.

Current Behavior

  1. User runs il finish
  2. User selects "Abort" at the commit message prompt (or edits message to empty)
  3. UserAbortedCommitError is thrown
  4. Error is caught in finish.ts (lines 676-686) and handled with return (no re-throw)
  5. CLI wrapper sees no error → calls process.exit(0)

Result: Exit code 0 (same as success)

Expected Behavior

When the user aborts, the command should return a non-zero exit code (e.g., 130 for user cancellation, following Unix conventions).

Affected Code

src/commands/finish.ts lines 676-686 (and similar block around line 943-954 for PR workflow):

catch (error) {
  if (error instanceof UserAbortedCommitError) {
    getLogger().info('Commit aborted by user')
    result.operations.push({
      type: 'commit',
      message: 'Commit aborted by user',
      success: false,
    })
    return  // Exit workflow gracefully - NO THROW
  }
  throw error
}

Suggested Fix

Either:

  1. Re-throw the error so the CLI wrapper can catch it and exit with non-zero code, OR
  2. Return a result object that signals abort, and have the CLI wrapper check for it

Context

This issue was discovered while fixing iloom-ai/iloom-vscode#75, where aborting finish was incorrectly closing the VS Code workspace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions