opencommit icon indicating copy to clipboard operation
opencommit copied to clipboard

[Bug]: wrong commit : the message is not about the diff

Open iauhc opened this issue 2 years ago • 19 comments

Opencommit Version

v2.4.2

Node Version

v20.1.0

NPM Version

v9.8.0

What OS are you seeing the problem on?

Other Linux Distro

What happened?

The commit seems bugged.
.... (about 20 other files but not server.ts at all) roa/views/formation/liste_formation_programme.php roa/views/formation/voir_formation_programme.php autocron.php │

◇ 📝 Commit message generated │ └ Commit message: —————————————————— fix(server.ts): change the case of the port variable from lowercase to uppercase (PORT) feature(server.ts): add support for the process.env.PORT environment variable

Expected Behavior

Right commit message, at least about the filed changed

Current Behavior

Broken commit message

Possible Solution

No response

Steps to Reproduce

No response

Relevant log output

No response

iauhc avatar Sep 08 '23 08:09 iauhc

Seems like something weird is happening causing the model to use the translation files instead of the current diff as the inspiration for the commit message response: https://github.com/di-sukharev/opencommit/blob/master/src/i18n/en.json

malpou avatar Sep 08 '23 14:09 malpou

Hmm, I use it in French, maybe this can explain. Will switch in en

iauhc avatar Sep 08 '23 14:09 iauhc

Also, there is now a version 3 out, I see you're on 2.4.2 so upgrading might give another result.

malpou avatar Sep 08 '23 14:09 malpou

@iauhc please close the issue if solved

di-sukharev avatar Sep 17 '23 11:09 di-sukharev

Still there in 3.0.4.

Paillat-dev avatar Oct 20 '23 12:10 Paillat-dev

same here, It could be because there is too much code in the diff.

Edited: oops my bad, found out my problem is more related to pr #257

image

Sped0n0ld avatar Oct 28 '23 12:10 Sped0n0ld

Stale issue message

github-actions[bot] avatar Dec 07 '23 21:12 github-actions[bot]

Stale but not this is an actual prompting issue wich breaks half of the commit messages

Paillat-dev avatar Dec 16 '23 10:12 Paillat-dev

reopening, will take a look at this

di-sukharev avatar Feb 28 '24 06:02 di-sukharev

I just experienced this in a small commit using local ollama

◇  📝 Commit message generated
│
└  Generated commit message:
——————————————————
 Changed port variable name in server.ts and added support for configurable port.

The problem is in the prompts.ts file https://github.com/di-sukharev/opencommit/blob/master/src/prompts.ts#L37 which is adding an example result prompt to the engine, and sometimes, the engine might grab it as an actual git diff.

tomasvts avatar Feb 28 '24 11:02 tomasvts

Yup, also, idk what models this is using, but if it is still using complete model it should imo switch to chat models. Also, the prompts need to be changed since the models where updated, they don't work the same anymore

Paillat-dev avatar Feb 28 '24 12:02 Paillat-dev

I think the prompt is fine. This happens only when the context window is too large to handle and gpt3.5 (or ollama/mistral) "forgets" what was the purpose of the server.ts prompt example, and gives this unusual response.

I'll stick with gpt and smaller commits for now to avoid this problem.

tomasvts avatar Feb 28 '24 12:02 tomasvts

I did notice that too, however, I also noticed that depending on the model, it dosen't follow well some instructions, like adding a description, and also, the emojis used are always wrong as per gitmoji. see #249

Paillat-dev avatar Feb 28 '24 13:02 Paillat-dev

heads down, the prompt is weak, it can be 10x better, it happens to fail on large diffs, we should improve splitDiff() function and definitely rework the prompt and make it also configurable, so everybody can play with it locally, any ideas?

di-sukharev avatar Feb 29 '24 03:02 di-sukharev

Dropping some ideas here, it could be nice to be able to set custom settings per repository, including prompt context that a user can add (ex. Your repo is about a collection of separate bash scripts, it could be useful for the model to know that they aren't linked together). Maybe some config folder like .oco or something. Also, standardizing the prompt formats would allow to easily add new ones, maybe even locally (ex. prompts need to contain <<DIFF>>, <<REPO_NAME>>, <<USER_CONTEXT>> which willl then be replaced programmatically. I am not familiar with ts tough so I did not dig too much in this codebase.

Paillat-dev avatar Feb 29 '24 07:02 Paillat-dev

@Paillat-dev or it can be learning on the repo with every commit and make better commits bit by bit 💣 not sure it will help though..

as for the different commit message — its not a bug with library, gpt is simply confused in a large git diff. If the there are too many changes — we can do multiple commits instead of just one, who wants to do a PR, @Paillat-dev would you like to contribute to the repo?

as a temporary workaround, commit in batches, e.g. by folders or commit large files separately

di-sukharev avatar Mar 03 '24 12:03 di-sukharev

As I said I almost never touched Typescript nor JavaScript in my entire life so I don't think I can do much other than opening issues 😅

Paillat-dev avatar Mar 04 '24 07:03 Paillat-dev

Same shit.

◇  2 staged files:
  03_network/extra_kube_yaml/ldap.yaml
  08_sonarqube/values/sq.yaml
│
◇  📝 Commit message generated
│
└  Generated commit message:
——————————————————
1. server.ts: fix port variable case, add support for configurable port
2. Create LDAP Service and Endpoints configuration file
3. Update SonarQube values with new properties and security configurations

It would be wonderful to remove this first message... Tried to investigate source code of opencommit but failed, because I'm not a JS dev

digitalstudium avatar Mar 07 '24 05:03 digitalstudium

And even when I change a single file, same thing happens.

$ opencommit
┌  open-commit
│
◇  1 staged files:
  08_sonarqube/values/sq.yaml
│
◇  📝 Commit message generated
│
└  Generated commit message:
——————————————————
 fix(server.ts): change port variable case (fix semantics)
feat(server.ts): add support for configurable port (run app on a desired port)

modify(sq.yaml): enable persistence and set up SonarQube with LDAP authentication.

digitalstudium avatar Mar 07 '24 05:03 digitalstudium