-
Notifications
You must be signed in to change notification settings - Fork 63
ci: bring new changes from tokenizer work to main (ai loop) #53
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,69 +13,52 @@ BRANCH=${BRANCH:-tokenizer} | |
| success=0 | ||
|
|
||
| for i in $(seq 1 $attempts); do | ||
| echo "=== Attempt $i/$attempts ===" | tee -a attempts.txt | ||
| echo "=== Attempt $i/$attempts ===" | ||
|
|
||
| # Run tests and print output to console, capture to temp file | ||
| cargo test -- --test accepts_model_from_config --test-threads=1 2>&1 | tee test_output.tmp | ||
| test_exit_code=${PIPESTATUS[0]} | ||
| # Run tests and print output to console | ||
| test_output=$(cargo test -- --test accepts_model_from_config --test-threads=1 2>&1) | ||
| test_exit_code=$? | ||
| echo "$test_output" >test_output.tmp | ||
|
|
||
| # Trim output to only include failures section | ||
| test_output=$(sed -n '/failures:/,/failures:/p' test_output.tmp | sed '1d; $d') | ||
| rm test_output.tmp | ||
|
|
||
| # Append trimmed test results to attempts.txt | ||
| echo "$test_output" >>attempts.txt | ||
| echo -e "\n\n" >>attempts.txt | ||
| # Append last attempt to test output if it exists | ||
| if [ -f last_attempt.txt ]; then | ||
| echo "## Last time we tried this but we failed:" | ||
| cat last_attempt.txt >>test_output.tmp | ||
| fi | ||
|
|
||
| # Exit loop if tests passed | ||
| if [ $test_exit_code -eq 0 ]; then | ||
| success=1 | ||
| if [ "$GITHUB_ACTIONS" ]; then | ||
| echo "ATTEMPTS=$i" >>$GITHUB_ENV | ||
| fi | ||
| echo "Tests passed!!" | ||
| break | ||
| fi | ||
|
|
||
| # Create temp file for askds input and clean it up | ||
| askds_input=$(tail -c 250000 attempts.txt | sed 's/===/---/g') | ||
| echo "$askds_input" >askds_input.tmp | ||
|
|
||
| # Run askds and stream output to both console and variable | ||
| echo "--- askds Output ---" | tee -a attempts.txt | ||
|
|
||
| askds_output=$( | ||
| askds \ | ||
| --hide-ui \ | ||
| --fix \ | ||
| --auto-apply \ | ||
| --serialize="yek --max-size=100KB | cat" \ | ||
| --test-file-pattern='tests/*.rs' \ | ||
| --source-file-pattern='src/**/*.rs' \ | ||
| --system-prompt=./prompts/fix-tests.txt \ | ||
| --run="cat askds_input.tmp" 2>&1 | tee /dev/stderr | ||
| ) | ||
| askds_exit_code=$? | ||
|
|
||
| if [ $askds_exit_code -ne 0 ]; then | ||
| echo "askds failed with exit code $askds_exit_code" >>attempts.txt | ||
| echo "askds failed. Guessing we ran out of context window. Trimming attempts.txt to last 30KB" | ||
| tail -c 30000 attempts.txt >attempts.tmp | ||
| mv attempts.tmp attempts.txt | ||
| continue | ||
| fi | ||
| # Run askds to fix the tests | ||
| askds \ | ||
| --hide-ui \ | ||
| --fix \ | ||
| --auto-apply \ | ||
| --serialize="yek --max-size=100KB | cat" \ | ||
| --test-file-pattern='tests/*.rs' \ | ||
| --source-file-pattern='src/**/*.rs' \ | ||
| --system-prompt=./prompts/fix-tests.txt \ | ||
| --run="cat test_output.tmp" || true | ||
|
|
||
| echo "$askds_output" >>attempts.txt | ||
| echo "--- End askds Output ---" >>attempts.txt | ||
| # Cleanup temp files | ||
| rm askds_input.tmp | ||
| rm last_attempt.txt | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: rm last_attempt.txt will fail if file doesn't exist - should use rm -f |
||
| cargo fmt | ||
| cargo clippy --fix --allow-dirty | ||
|
|
||
| # Commit changes if any | ||
| if ! git diff --quiet; then | ||
| git add . | ||
| git commit -m "fix attempt $i (${BRANCH})" | ||
| echo "Applied fixes for ${BRANCH} tests" | tee -a attempts.txt | ||
| echo "Applied fixes for ${BRANCH} tests" | ||
| else | ||
| echo "No changes in attempt $i" | tee -a attempts.txt | ||
| echo "No changes in attempt $i" | ||
| cp test_output.tmp last_attempt.txt | ||
| continue | ||
| fi | ||
| done | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
style: Using both GH_TOKEN and token with the same PAT value is redundant. One environment variable is sufficient.