Effects that share a `lock` and are ordered with `after` deadlock unless their names sort in dependency order

Open
#290 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Padraic-O-Mhuiris is already working on this.

Since Nov 12, 2026.

  • #293 by @Padraic-O-Mhuiris — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python, sql
Domain
backend, databases

Research direction

Start with nixbot/nixbot/queries/work_queue.sql, especially the ordering in EnqueueEffectItems and the shared deduplication behavior in ClaimNextWorkItem. Trace how dependency readiness interacts with FIFO claiming for effects that share a lock. Done means the dependent effect runs after its prerequisite, and later effects on that lock are no longer blocked.

Written by the indexing model from the issue text.

Description

At 171a8c7 (current main).

Two push effects share a lock, and one runs after the other:

herculesCI = { ... }: {
  onPush.default.outputs.effects = {
    migrate = mkEffect { lock = "env"; effectScript = "echo migrate"; };
    apply = mkEffect {
      lock = "env";
      after = [ [ "default" "migrate" ] ];
      effectScript = "echo apply";
    };
  };
};

Expected: after a green build, migrate runs, then apply.

Actual: both stay pending indefinitely, and so does every later effect on the env lock, in this build and the ones after it. Renaming the effects so the dependency sorts first (a-migrate,
b-apply) works around it.

Why:

  • EnqueueEffectItems queues a build's effect items ORDER BY u.name (work_queue.sql#L26), so apply is
    queued before migrate.
  • ClaimNextWorkItem (L31-L80) serves items that share a dedup_key, here the lock, strictly first
    in, first out, so migrate can't be claimed while the older apply is pending.
  • apply is held back until its dependency settles, so neither ever runs.
Dominant language
Python
Stars
118
Forks
22
Avg merge
1d 23h
Merged PRs (30d)
13

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Mic92/nixbot

All issues in Mic92/nixbot

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.