Skip to content

fix(batch): a shift worker's update of its own claim is not a Mind-writer conflict #681

Closed

Description

@Jammy2211

Overview

The shift Mind writer sets aside a worker's drop-section + append update of its own active.md claim as a conflict, because drop-section is a closing op applied after the append. Seen in shift 2026-11-18-pm2 (PyAutoGalaxy#726) as a NEEDS YOU event.

Plan

  • Pair a task's drop-section with its append of the same ## slug: an update applied drop-then-append as one unit, not a close.
  • Only for this shift's own claim (committed earlier this shift, or - session: names this slot's shift worker); anything else stays a conflict.
  • A lone drop-section stays closing; re-dispatch repeats stay skipped.
  • Tier + merge mode: effective level: supervised; merge mode: human /prm
Detailed implementation plan

Branch: feature/mind-writer-own-claim-update · worktree ~/Code/PyAutoLabs-wt/mind-writer-own-claim-update/

  1. agents/conductors/batch/_mind_writer.py commit_ledger (~line 1004–1015): before splitting closing ops, pair drop-section(path, slug) with append(path, text has ## slug) per task; paired drops leave closing and are ordered directly before their append.
  2. Ownership guard in _new_sections / the drop apply: main's section equals a prior committed append of this shift, or its session line is shift worker <slot> (…); else ConflictError.
  3. Tests in tests/test_orchestrator_mind_writer.py: (a) PR-open update commits; (b) foreign section → conflict; (c) lone drop still last + withheld; (d) re-dispatch repeat skipped. New ones fail on main.
  4. Note in agents/conductors/batch/AGENTS.md.
  5. Deploy: do not fast-forward the watcher checkout until shift 2026-11-18-pm2's late window closes (22:15Z).

Original Prompt

Click to expand

A shift worker's update of its own claim is not a Mind-writer conflict

Type: bug
Target: PyAutoBrain
Repos:

  • PyAutoBrain
    Difficulty: small
    Autonomy: supervised
    Priority: high
    Status: active
    Filed: 2026-11-18
    Issued: 2026-11-18
    Epic: autonomous-orchestrators
    Consequence: judge
    Witness: python -m pytest tests/test_orchestrator_mind_writer.py -q passes with new tests that fail on today's main: (a) a claim committed earlier this shift, then the same task's drop-section + append of that ## slug in one run, commits and replaces the section; (b) the same pair on a section another slot or a human wrote is set aside as a conflict; (c) a lone drop-section still applies last and is withheld when a sibling is set aside; (d) a re-dispatch's repeated claim is still skipped
    Lane: any
    Unattended: ready

Request (verbatim)

Human, 2026-11-18, in the cockpit for shift 2026-11-18-pm2, after a NEEDS YOU event: "Why does it need me" → told it was a writer bug → "Yes and then implement the fix for 2" → plan approved: "Approved".

Why

At 20:27Z the shift worker for stellar_m_l_gradient_profiles_sersicgradient_piv opened PyAutoGalaxy#726 and updated its own active.md claim the standard way: drop-section active.md <slug> then append the new section (status library-shipped, awaiting-merge, library-pr:, workspace-pr:, the extra autolens_workspace_test repo). The Mind writer (agents/conductors/batch/_mind_writer.py) treats every drop-section as a closing op (_closing), applied after the task's other ops, so the append ran first against the still-present section; _new_sections counts a duplicate section as the shift's own only for a re-dispatched task (own_tasks), so it raised "already in active.md, not this shift's own claim — conflict", set the append aside and withheld the drop with it. The watcher posted NEEDS YOU; the claim was repaired by hand (Mind d5fb06628). Every worker that updates its claim at PR-open hits this.

Fix (approved plan)

  • In commit_ledger, pair a task's drop-section(path, slug) with an append on the same path whose text holds ## slug: the pair is an update, not a close — the drop leaves the closing set and applies immediately before its append, as one unit.
  • Ownership guard for the pair: main's section must be one this shift committed earlier (ctx["prior"]) or its - session: must name shift worker <this slot> (…); otherwise ConflictError as today.
  • A lone drop-section stays closing; re-dispatch repeats stay skipped.
  • Note in agents/conductors/batch/AGENTS.md (the Mind writer paragraph).
  • Do not pull the merged fix into the watcher's checkout until shift 2026-11-18-pm2's late window closes (22:15Z).

Activity

  1. Jammy2211 commented on Nov 18, 2026

    @Jammy2211
    ContributorAuthor

    Shipped: #682 merged by human /prm. A task's drop-section + append of its own ## slug is now one update unit behind an own-section guard, not a conflict. Deploy note: the watcher's Brain checkout is fast-forwarded only after shift 2026-11-18-pm2's late window closes (22:15Z).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions