-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TT-1435] use chatgpt to find new issues in modified Solidity files #14104
Conversation
# throw error openai_result when is not 200 | ||
if [ "$openai_result" != '200' ]; then | ||
echo "::error::OpenAI API call failed with status $openai_result: $(cat prompt_response.json)" | ||
return 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this just be exit 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't that cause the pipeline to fail? If so, that's not what I want, I want to display a warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would return 1 here no from this?
if ./contracts/scripts/ci/find_slither_report_diff.sh "$base_report" "$current_report" "$new_issues_report" "contracts/scripts/ci/prompt-difference.md" "contracts/scripts/ci/prompt-validation.md"; then
then should it be if [[ $x == 1 ]]
maybe the above should be assigned to a var and then use that in the if
to make it clearer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, changed return
to exit
. but I'd keep as-is, as from what I found it's the recommended way of testing command exit code, not to mention the fact that in strict mode capturing that output in a variable and then doing if [[ $? -eq 0 ]];
wouldn't work as expected :/ non-zero exit code would terminate the execution.
5d30d49
to
aac42fa
Compare
first_report_content=$(cat "$first_report_path" | sed 's/"//g' | sed -E 's/\\+$//g' | sed -E 's/\\+ //g') | ||
second_report_content=$(cat "$second_report_path" | sed 's/"//g' | sed -E 's/\\+$//g' | sed -E 's/\\+ //g') | ||
openai_prompt=$(cat "$report_prompt_path" | sed 's/"/\\"/g' | sed -E 's/\\+$//g' | sed -E 's/\\+ //g') | ||
openai_model="gpt-4o" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest that we pin the mode version to the current one that you are testing with (or make it a variable.)
Otherwise you are at risk of behavioral changes as newer versions are deployed to the 4o endpoints, we have seen breaking changes in format / responses before.
exit 1 | ||
fi | ||
|
||
if [[ -z "${OPEN_API_KEY+x}" ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If preferred, you can safely remove this as $openai_result below will fail with ::error:: log telling you that you haven't supplied the key and we won't be charged for the call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer to have it, because it's running in strict mode and will error if env var is not set, when read. I prefer to return a more explicit error than what bash would.
|
||
if [[ -n "$validation_prompt_path" ]]; then | ||
echo "::debug::Validating the diff report using the validation prompt" | ||
openai_model="gpt-4-turbo" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment for version pinning. To check the latest model version number, see: https://platform.openai.com/docs/models
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea!
Quality Gate passedIssues Measures |
Following changes have been implemented:
It's not bullet-proof, but I'd still give it a go and see if for now it's good enough.
Run, when no changes were found: https://github.com/smartcontractkit/chainlink/actions/runs/10385260800?pr=14111
Run, when changes were correctly found: https://github.com/smartcontractkit/chainlink/actions/runs/10385422699