🔄CI/CD Integration

How to Set Up and Use Cosine for Monitoring CI Workflows

Cosine is designed to help streamline your development process by monitoring specific CI workflow steps on GitHub and automatically iterating on its code until your configured steps pass. Here’s what you need to know:


1. Ensure Your CI Workflow is Set Up

  1. Create or confirm your GitHub Actions workflows: Make sure your repository includes the CI workflow(s) you want Cosine to use (for example, running Black, flake8, pytest, etc. in separate steps or jobs).

  2. Test your workflow manually: Verify that the workflows run as expected when you push changes or open a pull request. Cosine relies on the results and logs of these workflows to figure out what to fix.


2. Configure Cosine to Use Specific Steps

  1. Open your project in Cosine: Go to the Project Settings page in Cosine.

  2. Locate the “Tasks” page: You’ll see a table of tasks that Cosine can work on.

  3. Click into the Settings tab: Under Workflows, specify which CI steps Cosine should “listen to” as it iterates.

    • For instance, you might choose “Setup Python,” “Run Black,” “Run flake8,” “Run pytest,” etc.

Tip: If you only configure some of the steps, Cosine will only use those specific steps’ outcomes when deciding how to iterate its code changes.


3. Let Cosine Open (or Update) a Pull Request

  1. Create or assign a task to Cosine: Tell Cosine what changes or fixes you need. Cosine will open (or update) a Pull Request on GitHub with its proposed changes.

  2. Workflows Run on GitHub: When Cosine opens or updates a PR, your configured GitHub Actions steps will run automatically.


4. Cosine Waits for All Configured Steps

  1. Cosine displays “Running workflows…”: It polls GitHub to see whether your configured workflows have passed or failed.

  2. All steps must complete: Cosine only proceeds to fix code once it sees the final status of all the steps you’ve told it to watch.

  3. Automatic iteration: If one or more of these steps fail, Cosine analyzes the logs and attempts to fix the errors. It then pushes an update to the PR, triggering the workflows again.

Note: Currently, Cosine does not directly run tests or workflows on its own hardware. Instead, it relies on the GitHub Actions runners (or whichever CI environment your repository uses) and then parses the resulting logs.


5. Monitoring Progress

  • Success Path: If Cosine sees that all configured steps eventually pass, it will conclude that the code is fully updated and error-free.

  • Spinner Stuck? If Cosine remains in the “Running workflows…” status after the CI steps have completed, this may indicate a known bug. If so, try:

    1. Checking that every single configured step in the Settings tab has completed on GitHub.

    2. Refreshing Cosine or waiting a few extra minutes in case there is a delay in the log parsing.

    3. If the problem persists, reach out to support as we continue refining the workflow-monitoring feature.


Questions or Issues?

If you have any further questions, feel free to:

  • Message Cosine again, reminding it to generate or update tests (it can often add or adjust tests upon request).

  • Reach out to our support team if you encounter any persistent issues with CI monitoring or workflow parsing.

With this setup, Cosine should be able to automatically fix failing code and iterate until all your configured checks turn green, reducing the manual work you need to do in the PR process.

Automatic iteration until configured steps pass.

Last updated

Was this helpful?