di-sukharev / di-sukharev/opencommit

[Bug]: json (malformed?) output when there is a lot of changes

Open
#455 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
7.5k
Forks
445
Avg merge
18m
Merged PRs (30d)
2

Description

Opencommit Version

3.2.7

Node Version

23.9.0

NPM Version

10.9.2

What OS are you seeing the problem on?

Mac

What happened?

hello

When I make big changes in the code, I get malformed commit messages.

what am i doing wrong?

~/.opencommit:
OCO_ONE_LINE_COMMIT=false
OCO_MODEL=qwen2.5-coder
OCO_API_URL=http://127.0.0.1:11434/api/chat
OCO_API_KEY=none
OCO_AI_PROVIDER=ollama
OCO_TOKENS_MAX_INPUT=40960
OCO_TOKENS_MAX_OUTPUT=4096
OCO_DESCRIPTION=false
OCO_EMOJI=false
OCO_LANGUAGE=en
OCO_MESSAGE_TEMPLATE_PLACEHOLDER=$msg
OCO_PROMPT_MODULE=conventional-commit
OCO_TEST_MOCK_TYPE=commit-message
OCO_OMIT_SCOPE=undefined
OCO_GITPUSH=false
OCO_WHY=false

Expected Behavior

The provided code snippet appears to be part of a larger project that has been significantly refactored or deleted. The files and their contents have been removed, leaving only the directory structure and some variable declarations. It's unclear what specific functionality was contained in these files without additional context. If you need assistance with understanding or recovering from this situation, please provide more details about your goals or any relevant information about the project.

Current Behavior

[master c4aaadc] json { "response": "The provided code snippet appears to be part of a larger project that has been significantly refactored or deleted. The files and their contents have been removed, leaving only the directory structure and some variable declarations. It's unclear what specific functionality was contained in these files without additional context. If you need assistance with understanding or recovering from this situation, please provide more details about your goals or any relevant information about the project." }

Possible Solution

No response

Steps to Reproduce
  1. remove all from ./src/ in codebase
  2. commit
  3. malformed output
  4. put everything back
  5. commit
  6. malformed output
Relevant log output

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by removing and restoring the contents of ./src/ with the listed Ollama configuration, then inspect the commit-message generation flow in src/. Compare the model response with the malformed commit output; done means large changes produce a valid commit message rather than embedded JSON or explanatory text.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, javascript, node.js, ollama
Domain
ai, cli, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.