Skip to content

agents: fix --issue next loop + harden the plugin - #9

Merged
huhn511 merged 2 commits into
mainfrom
fix/agents-claim-on-start
Jun 5, 2026
Merged

huhn511 merged 2 commits into
mainfrom
fix/agents-claim-on-start

Conversation

@huhn511

@huhn511 huhn511 commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

The bug

Running the coding agent repeatedly kept landing on the same issue: mind agents start coder --issue next always re-picked the head of the queue.

Root cause — --issue <ref> read the issue body but never claimed it, so the issue stayed ready-for-agent (handoff: agent) and agentQueue returned it at the head every run. The intended loop (mind issues next --claim) transitions the pick to in-progress, which removes it from the queue — the launcher skipped that.

Fix: claim on launch

Claim the issue on launch (→ in-progress, with config.coordination.claimTtl), after the PATH check and before spawn — reusing assertClaimable + appendEvent. The next --issue next then advances.

  • A crash mid-run leaves it in-progress until the ttl lapses, then it returns to the queue (⏱ stale mark) — no work lost.
  • --no-claim keeps the old read-only coupling; --force steals a live claim; --dry-run reports whether it would claim without spawning.
  • The agent still never closes the issue — a human reviews and closes.

Plus: hardening / improvements

  • Fold the tracker once per --issue run — loadIssue returns the folded cfg, so the claim path no longer re-folds (re-reading every event file).
  • Read-only personas: a persona with claim: false in frontmatter (e.g. guide) inspects an issue without claiming it. Added lenient isFalsey() for frontmatter booleans.
  • mind agents list backend health: the table flags (not installed) / (unknown) backends, and --json carries backend/backendInstalled/backendKnown per persona.
  • onPath splits on path.delimiter (cross-platform) instead of a hardcoded :.
  • Fixed a stale comment claiming codex uses a config-file override (it prepends).

Tests

spawnSync integration tests (fake codex on PATH, no model call): claim advances the queue, --no-claim and claim: false leave it claimable, and list --json reports backend health. Plus isFalsey + readPersonas units. 42/42 green.

🤖 Generated with Claude Code

huhn511 and others added 2 commits June 6, 2026 01:42
`mind agents start --issue <ref>` read the issue body but never claimed it,
so the issue stayed in `ready-for-agent` (handoff: agent) and `agentQueue`
kept returning it at the head — `--issue next` re-picked the same issue on
every run, no matter how many times the agent ran.

Claim the issue on launch (→ in-progress, with config.coordination.claimTtl)
after the PATH check and before spawn, mirroring `mind issues next --claim`.
A crash mid-run leaves it in-progress until the ttl lapses, then it returns
to the queue. `--no-claim` keeps the old loose coupling; `--force` steals a
live claim; `--dry-run` reports whether it would claim without spawning. The
agent still never *closes* the issue — a human reviews and closes.

Two spawnSync integration tests (fake `codex` on PATH, no model call) prove
the claim advances the queue and that `--no-claim` leaves it claimable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Follow-up hardening of the agents plugin:

- Fold the tracker only once per `--issue` run. `loadIssue` now returns the
  folded `cfg` alongside the issue, so the claim path reuses it instead of
  re-folding (which re-read every event file).
- Personas can set `claim: false` in frontmatter — read-only personas (e.g.
  `guide`) then inspect an issue without claiming it. Added `isFalsey()` for
  lenient frontmatter booleans (false/no/0/off).
- `mind agents list` now resolves each persona's effective backend and whether
  it's installed: the table flags `(not installed)` / `(unknown)` backends, and
  `--json` carries `backend`/`backendInstalled`/`backendKnown` per persona.
- `onPath` splits on `path.delimiter` instead of a hardcoded `:` (cross-platform).
- Corrected the stale backends header comment (codex prepends the persona; it
  does not use a config-file override).

Tests: isFalsey unit, readPersonas carries `claim`, a `claim: false` persona
doesn't claim, and `list --json` backend-health flags. 42/42 green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@huhn511 huhn511 changed the title agents: claim the issue on start so --issue next advances agents: fix --issue next loop + harden the plugin Jun 5, 2026
@huhn511
huhn511 merged commit 3e0d42a into main Jun 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant