Skip to content

[BUG] --auto flag commits without any confirmation even when AI generation fails silently β€” risk of empty or garbage commit messagesΒ #55

@Sweksha-Kakkar

Description

@Sweksha-Kakkar

πŸ› Bug Report: --auto flag bypasses safety check when AI generation fails

Summary

When running gitbun --auto, the tool is supposed to commit immediately without preview. However, if the AI model (Ollama or remote API) fails to respond β€” due to network issues, model not being pulled, or Ollama not running β€” Gitbun silently falls back to the rule-based engine but still proceeds with git commit automatically.

The problem: the rule-based fallback sometimes generates overly generic or malformed messages (e.g. feat(src): add index) and there is zero warning to the user that AI was skipped. In a CI/CD pipeline, this silently poisons the commit history.


Steps to Reproduce

  1. Install gitbun globally: npm install -g gitbun
  2. Make sure Ollama is not running (so AI is unavailable)
  3. Stage some files: git add .
  4. Run with auto flag: gitbun --auto
  5. Observe that a commit is made with a fallback-generated message, with no warning printed

Actual Behaviour

  • Gitbun detects AI is unavailable
  • Silently switches to rule-based fallback
  • Generates a generic message like feat(src): add index
  • Commits immediately with --auto β€” no warning, no prompt, no abort

Why This Is a Problem

The --auto flag is documented as "DANGEROUS" in the README itself. That warning implies the user consciously accepts AI-quality output. But if AI silently fails and a degraded fallback message is committed in a CI pipeline, the commit history becomes noisy and the user has no idea why.


Environment

  • OS: macOS 14 / Ubuntu 22.04
  • Node.js: 20.x
  • gitbun version: v1.13.0
  • Ollama: not running (simulated failure)

Expected Behaviour

When --auto is used and AI generation fails:

  1. Gitbun should print a clear warning:
    ⚠ AI unavailable β€” falling back to rule-based engine. Commit message quality may be reduced.
  2. If the fallback message confidence is below a threshold (e.g. generic single-word noun), Gitbun should abort the commit and exit with code 1 rather than committing silently.
  3. A --allow-fallback flag should be introduced to explicitly opt into fallback behaviour in CI pipelines:
    gitbun --auto --allow-fallback

This ensures --auto remains safe to use in automated workflows without hiding degraded output.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions