DEV Community

Cover image for KodaBot, pt. 1
petersopko
petersopko

Posted on • Updated on

KodaBot, pt. 1

Coordination problems are a well-known subject within the web3 ecosystem. As a remote-first, open-source, and public good company, KodaDot has run into coordination issues related to async workflow. In this article, I will cover the process of designing and deploying our first version of KodaBot -> multi-purpose bot designed to help with the coordination of contributors to KodaDot repositories.

The Problem

Double-spending is a potential flaw in a digital cash scheme in which the same single digital token can be spent more than once. Unlike physical cash, a digital token consists of a digital file that can be duplicated or falsified - Investopedia.com

While the analogy isn't perfect, double-spend is a helpful term to describe a process we saw repeating in KodaDot's GitHub repository. The developer picks an issue she'd like to work on, she posts a comment declaring her intent, and the very next day, PR for the said issue is being opened by another dev. Effectively, two devs were spending their time working on the same problem, and only one solution was accepted. This results in the pointless burning of precious dev's neurons, frustration, and the sense that there is no security in working on long-term issues within the project. "First come, first serve" works in many places, but it kept backfiring in our rich dev's community.

And since we want to keep the devs happy...

The Solution

Assign bot: Autocode + Cloudflare's key-value storage

After numerous iterations, we've decided to solve this problem with a combination of Autocode and Cloudflare's key-value storage. We've set up webhooks in our repositories, which are being sent directly to serverless Autocode's endpoint. To preserve the states of the assignment and developer's profile, we are using Cloudflare's KV storage. The bot is checking the state of assignments every minute.

Assigning Issues

Each developer has a limit of 5 issues being assigned to him at any time. Getting unassigned, dropping out of the queue, or passing on the option to pick the issue forbids dev from further participation in said issue. We've made this decision because we want to incentivize thinking carefully about which issue to pick to avoid stalling and slowing others down. Since we have plenty of outside contributors (70+) to our repository, we needed to create a process in which newcomers can get issues assigned with a guarantee that they'd be able to work on the issues for a given period, based on the bounties provided in labels. When a developer finds an issue she'd like to work on, using :wave: emoji ->['πŸ‘‹', 'πŸ‘‹πŸ»', 'πŸ‘‹πŸΌ', 'πŸ‘‹πŸ½', 'πŸ‘‹πŸΎ', 'πŸ‘‹πŸΏ'] will trigger the bot to assign her the issue. Time allocated for each assignment is calculated based on bounty label, while long term (10+ merged PRs) contributors gain 50% time boost for each issue. Issues without a bounty label get a default 24 hours limit:

- $: 24h
- $$: 48h
- $$$: 72h
- $$$$: 96h
- $$$$$: 120h
Enter fullscreen mode Exit fullscreen mode

KodaBot assigns developer with issue.

Getting into the queue

If the developer finds an issue she'd like to work on, but the problem is already assigned to another dev, she can get into the queue behind the assignee. Once the locked period expires, the next dev in a queue will be given an option of 12 hours to react to the issue (either get it assigned or drop out of the queue). Dropping out of the queue or passing on the option by commenting pass on said issue.

Securing the issue with PR

Once the issue is done or close to being done, opening a PR with the progress made by the developer will ensure that the bot won't unassign the developer even after the time runs out.

KodaBot verifies that developer opened up PR for issue assigned to him.

Ignoring specific issues

Collaborators in the repository (currently seven developers and three non-tech contributors) are given the right to make the bot ignore a particular issue. Devs can do this by commenting with ignore on said issue. We created this function to speed up the process with specific issues that don't require the bot's supervision, such as minor fixes or issues particular to some team members.

Conclusion

Leveraging Autocode and Cloudflare's KV storage provided us with the solution to the coordination problem within the remote+async first dev culture. As we've polished up and finished developing v1 of the bot, there are already numerous ideas about v2, including introducing Quadratic Funding and other automatizing payout processes within the KodaDot.

Come and try out KodaBot πŸ’»πŸ€– yourself!

We are always hiring:

Reach out to KodaDot:

MetaPrime

Top comments (0)