# My agent status board said 40 cards were waiting to be merged. 34 of them had no worktree left

> Source: <https://dev.to/tomxiaoyz/my-agent-status-board-said-40-cards-were-waiting-to-be-merged-34-of-them-had-no-worktree-left-56n1>
> Published: 2026-11-19 15:09:35+00:00

**Recommendation:** When building multi-agent status boards, read only structured fields, order checks by which evidence is newest, and flag missing fields as "cannot derive" rather than treating them as negative.
More in the playbook "Running AI in production": <https://wpnews.pro/playbooks/production-ops>

The short version: **every row on a multi-agent status board has to trace back to a structured field or a piece of outside evidence, and when the field is empty the code has to go look, not quietly treat "unknown" as "no".** My board script has been wrong four times in four weeks. Each time looked different. Each time it was this. The fourth one is still open, and the numbers below are from a run I did this morning.

Setup: Claude Code writes task cards and reviews the results, Codex does the implementation. Every dispatched card leaves an evidence folder: a start record, an event stream, and Codex's receipt. A read-only script scans those folders and prints a table saying who each card is waiting on: Codex, the reviewer, or me. That table is how I find out who is waiting on whom.

On October 26 I ran a review. Since the previous one, the project sessions had dispatched 13 tasks on their own. The script's output listed zero of them.

Each session had written its evidence files slightly differently. Some had no start record, some used a different name for the event stream. The script knew one layout and treated everything else as absent.

The fix was to discover tasks by their event-stream files and to pin the evidence layout in the dispatch instructions. The lesson is plain: an empty board does not mean nothing is running.

On October 31 the board showed a card in an e-commerce tooling repo as blocked, apparently waiting for a second round.

In reality that card had been accepted and merged two days earlier. The "blocked" in the receipt came from a temp-directory problem inside the sandbox. The reviewer had run the full test suite outside the sandbox, and 2099 tests passed.

The script could not see that, for two reasons:

That day I rewrote how the board derives status, borrowing a rule from an open-source multi-agent research prototype: **a card has exactly one stage, decided by what it is waiting for; read structured fields only, match in order, stop at the first hit, and never infer from free text.** Receipts must carry `status` and `human_action`. Verdicts must carry `verdict` and `final`. A card that cannot be found gets its own label, "cannot derive", instead of being filed under "waiting for review".

On November 13 I noticed a card that had been accepted a week earlier and still showed as waiting for my answer.

The cause was match order. The receipt's `human_action` held a question, the script matched that first, and stopped. But the task session had already answered the question and written an accept verdict after it.

The fix: a verdict on the latest round outranks the receipt's `human_action`. Two days later I added one more: only a verdict on the latest round decides who is waiting, so an already-answered round-1 "blocked" cannot hold up round 2.

"First match wins" is a fine rule, but it puts all the correctness into the ordering. **Order the checks by which evidence is newer, not by which condition sounds more serious.**

In a November 15 audit the board had about 265 rows. 39 of them said "accepted: waiting for commit/PR/merge and worktree return", and 32 of those were in one repository, a data platform. I spot-checked one. Its task branch had been merged long before.

This morning, November 19, I ran the script again without changing it:

So at least 34 rows in the "waiting for merge and worktree return" column do not match reality: every worktree is gone, and for 15 of them I can show the merge directly. Those rows were burying the 8 that needed me.

The cause is one line:

```
returned = bool(worktree) and not os.path.isdir(worktree)
```

It reads: the start record has a worktree path, and that directory no longer exists, so the worktree has been returned. But 33 of these 34 cards have no worktree path in their start record at all. The empty field makes the whole expression false, and the script concludes "not returned yet".

**An empty field was read as "no".** It is the same mistake as miss 2. With evidence missing, the script picked an answer when it should have said "unknown" or looked somewhere else.

The fix for this one is written up in my November 15 improvement list and has not been merged. I am leaving that on the record here.

The same run also shows 16 rows of "running, no receipt", aged from 25 to 549 hours. The script flags anything past 6 hours, but a flag is all it does, and nobody has gone to close them. Whether the board is accurate and whether anyone acts on it are two separate problems.

Here is a simplified version of the stage derivation, plus the fix for miss 4. The second function is the proposed fix and is not merged in my own script yet.

``` python
def stage(n_runs, receipt, verdict, returned):
    """receipt: fields of the latest receipt; verdict: (round, outcome, is_final). One stage per card."""
    current = verdict if verdict and verdict[0] >= n_runs else None
    if current and current[1] == 'accept':
        return 'accepted and returned' if returned else 'waiting for merge'
    if current and current[1] == 'blocked':
        return 'waiting for a human answer'
    if current and current[1] == 'return':
        return 'waiting for a human to split' if current[2] else 'waiting for next round'
    if receipt is None:
        return 'running'
    if receipt.get('human_action') not in (None, 'none'):
        return 'waiting for a human answer'
    return 'waiting for review'

def is_returned(worktree_field, repo, task):
    # Field has a value: check whether the directory is still there.
    if worktree_field:
        return not os.path.isdir(worktree_field)
    # Field is empty: that is not a "no". Fall back to outside evidence.
    if os.path.isdir(os.path.join(repo, '.worktrees', task)):
        return False
    merged = subprocess.run(['git', '-C', repo, 'branch', '--merged', 'HEAD'],
                            capture_output=True, text=True).stdout
    return f'task/{task}' in merged.split()
```

Four things to watch when you build your own:

A quick way to test whether a board can be trusted: pick one column and reconcile it. Take each row in that column to the system it describes and check. I did that for "waiting for merge" today, and at least 34 of 40 rows did not hold up. With a mismatch rate like that, the column should not drive decisions until it is fixed.

This is part 7 of a series. Part 2 covered how a hook can wrongly blame the implementing agent. This is the other end: the table built for the human can be wrong about the human's queue, too.

`derive_stage` function (dated November 13 and 15, 2026) and the matching commits.`is_returned` as shown is a proposal that I have not run in my own environment.
