Skip to content

fix: shift ledger edit op; hold completion on a set-aside (M3.6d) - #663

Merged
Jammy2211 merged 3 commits into
mainfrom
feature/shift-ledger-edit-op
Nov 17, 2026
Merged

Jammy2211 merged 3 commits into
mainfrom
feature/shift-ledger-edit-op

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Summary

M3.6d of the autonomous-orchestrators epic (PyAutoBrain#660). In shift 2026-11-16-pm a worker's op: write edits to existing Mind drafts were set aside while its complete/ record committed, so Mind recorded the task shipped with the drafts unchanged (PyAutoMind#579). Five workers also hit table-append failing on autonomy_log.md.

  • write stays create-only; a new edit op replaces an expected old text that must appear exactly once, so a concurrent change is never clobbered.
  • Worker ops carry --task. A task's closing ops (complete/ record, drop-section, retire) apply as one group last: if a sibling op is set aside for a human the group is withheld and rolled back in either order; if a sibling is held for retry the group waits pending beside it.
  • shift_ledger refuses at queue time a write to a path on Mind origin/main, an edit whose base is missing or ambiguous, and a table-append with no heading (it reads origin/main, no fetch, and replays only pending ops). table-append now works from the CLI.
  • A mechanical set-aside (already true on main) is a digest note: line, not NEEDS YOU; human set-asides give one NEEDS YOU per task, saying "held" only when a record was withheld and "already on main" when it had landed earlier.

API Changes

CLI: shift_ledger gains --task (required for shift workers), edit <path> --old/--new[-file], and a working table-append <path> "<## heading>" --text "<row>"; a missing --mind is a one-line error (exit 2). Mind writer: new op edit, MechanicalError, queue_refusals(); set-aside entries gain task and needs.
See full details below.

Test Plan

  • Witness, new tests fail on origin/main and pass here (tests/test_orchestrator_mind_writer.py, 7 at first build + 9 review-round cases): queue-time refusal of a write; edit applies on a matching base, set aside on a moved one; held completion record (incl. across commit_ledger calls, both orders, held sibling, record-then-edit); table-append reaches the first autonomy_log table; mechanical set-aside is a digest line; one NEEDS YOU per task
  • Full suite: 2217 passed, 1 skipped; 1 failure test_grouped_organ_consumers is environmental (fails on origin/main under activate.sh)
  • Independent review (Fable 5.2, author Opus 5.5): FINDINGS → fixed → CLEAN
  • _orchestrator.py untouched
Full API Changes (for automation & release notes)

Added

  • op edit (path, old, new, optional task); _mind_writer.MechanicalError, queue_refusals(mind, op, ledger_dir)
  • shift_ledger --task, shift_ledger edit, shift_ledger table-append <path> <heading> --text <row> [--unique]

Changed Behaviour

  • commit_ledger: a task's closing ops land together or not at all; set-aside entries carry task, needs (mechanical|human); new kind withheld
  • write of identical text and remove of a missing path are mechanical set-asides
  • _events._impaired: one NEEDS YOU per task; mechanical entries raise none

Mind half: the PyAutoMind PR on the same branch adds ## Calibration runs above the first autonomy_log.md table; merge it first.
Refs PyAutoBrain#660. Tier glance, merged by the human's /prm this time (human instruction 2026-11-17).

Heart RED override (development only)

🤖 Generated with Claude Code

Jammy2211 and others added 2 commits November 17, 2026 13:42
Shift 2026-11-16-pm: a worker's `write` edits to existing Mind drafts were
set aside while its complete/ record committed, so Mind recorded the task
shipped with the drafts unchanged; five workers' calibration rows could not
be queued (table-append never set its heading or row).

- _mind_writer: `edit` op (expected old text exactly once; MechanicalError
  when already applied); write of identical text and remove of a missing
  file are mechanical; ops carry `task`; closing ops (complete/ write,
  drop-section, active/ remove, queue/question retire) apply last and are
  `withheld` when a sibling op was set aside for a human, this run or
  earlier; queue_refusals checks write/edit/table-append against Mind
  origin/main and the queued ops (no fetch; fails open); a tagged
  table-append is not critical.
- shift_ledger: --task (required for a shift worker), edit
  --old/--new(-file), table-append heading/row/--unique, Mind lookup
  --mind → $PYAUTO_MIND → sibling checkout; refused ops are not queued.
- _events: mechanical set-asides are no NEEDS YOU; human ones are one
  event per task. _digest: withheld and mechanical wording.
- Templates and docs: --task, write creates/edit changes, edits first and
  the complete record last, the `## Calibration runs` table-append.

Refs #660

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… siblings

Review of the M3.6d branch:
- an edit to empty text no longer reads an absent base as already applied;
- a task's closing ops apply as one group: a part-way failure rolls the
  group back and withholds the rest, so the record never lands alone;
- an op on a path the group creates (edit of the complete/ record) is part
  of the group and keeps its order;
- while a sibling op is held, the group stays pending beside it;
- queue-time checks replay only pending ops over origin/main;
- the NEEDS YOU line says "held" only when a record was withheld, and
  "already on main" when the task's record landed earlier (digest too);
- shift_ledger names a missing Mind checkout instead of a traceback;
- batch AGENTS.md states the two limits (earlier record, sticky block).

Refs #660

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI checks out Mind main, which gains `## Calibration runs` only when
PyAutoMind#581 merges. The fixture-log witness stays unconditional; the
check against the sibling Mind log is its own test and skips while that
log lacks the heading.

Refs #660

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit 419c15c into main Nov 17, 2026
2 checks passed
@Jammy2211
Jammy2211 deleted the feature/shift-ledger-edit-op branch November 17, 2026 15:19
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