Repository navigation
Description
Summary
In the merge-driver happy path — where the field-aware driver (pm merge install) has already union-merged an append-only field like notes — pm merge reconcile reports discarded_events, discarded_authors, and reverted_fields (and emits history_repair_discarded_authors:<author> / history_repair_reconcile_discards_events:N warnings) even though nothing is actually lost: the on-disk item keeps every author's content and attribution, and the history log keeps every author's event. The warning describes an internal replay operation, not a user-visible outcome, so it reads as cross-author data loss when there is none.
This is the complementary case to the (correctly closed) #603: that issue fixed under-reporting of genuine loss; this issue is over-reporting of loss that did not happen. In a multi-agent workflow the false alarm is expensive — an agent that sees discarded_authors:agent-b will follow the recovery_hint and burn context re-inspecting/re-applying a note that is already present and correctly attributed. project management = context management, so a misleading warning is a real cost.
Environment
@unbrained/pm-cli2026.7.22 (installed from npm)- Field-aware merge driver active (
pm merge install)
Reproduction
git init -q && git config user.email a@b.c && git config user.name t
pm init mrg
pm merge install # field-aware driver (unions notes, resolves scalars)
git add -A && git commit -qm init
ID=$(pm --json create issue "shared item" | jq -r '.id')
git add -A && git commit -qm seed
BASE=$(git branch --show-current)
git checkout -qb agent-a
pm --author agent-a notes "$ID" --add "note from agent A"
pm --author agent-a update "$ID" --priority 1
git add -A && git commit -qm a
git checkout -q "$BASE" && git checkout -qb agent-b
pm --author agent-b notes "$ID" --add "note from agent B"
pm --author agent-b update "$ID" --assignee agent-b
git add -A && git commit -qm b
git merge agent-a -m "merge a into b" # driver: 0 conflicts, union_fields:[notes], fields_from_theirs:[priority]
pm merge reconcile --dry-run # <-- see output belowpm merge reconcile output (dry-run and apply identical)
reconciliation:
reverted_field_count: 1
reverted_fields: [ "notes" ]
discarded_events:
- index: 4
author: "agent-b"
op: "note_add"
fields: [ "notes" ]
discarded_authors: [ "agent-b" ]
recovery_hint: "Reconciliation keeps the on-disk item and overwrites these
replayed mutations. To recover one, inspect it with
pm history <id> --diff --field <field>, then re-apply ..."
warnings:
- "history_repair_discarded_authors:agent-b"
- "history_repair_reconcile_discards_events:1"
Actual end state after pm merge reconcile (nothing was lost)
pm show "$ID" --depth full # notes = [ {A, author:agent-a}, {B, author:agent-b} ] ← both, correct authors
# priority: 1 (agent-a) assignee: agent-b (agent-b)
pm history --verify "$ID" # ok:true, current_matches_latest:true
pm validate # no *_hash_mismatch (only benign metadata warnings)The history log also still contains agent-b's note_add event (plus a new history_repair event) — it was not removed. So discarded_events:[agent-b note_add], discarded_authors:[agent-b], and reverted_fields:[notes] are all false for the union-merged field: content preserved, attribution preserved, history event preserved.
Expected
When the reconciled field is an append-only/union field whose on-disk value already contains the "discarded" author's contribution, reconcile should classify that discard as net-lossless and NOT emit a data-loss warning for it. Concretely:
- Distinguish net-lossy discards (the discarded event's value is absent from the final on-disk item — the pm history-repair cements cross-author data loss after a lossy merge; pm validate then reports fully green (no revert warning / replay check) #603 case, keep the loud warning) from net-lossless replayed-event discards (value still present — suppress or downgrade to info).
discarded_authors/history_repair_discarded_authorsshould list only authors whose content is actually gone from the item, so the signal stays trustworthy.- The
recovery_hintshould fire only for net-lossy discards.
Why it matters
The #603 fix (surfacing real loss) is correct and should stay. But over-firing it on the driver union path trains agents to distrust the warning or to waste a recovery loop on phantom loss — undermining the exact multi-agent "merge → reconcile → validate" workflow that GH-623 was built to make safe. A precise, outcome-based warning keeps pm merge reconcile trustworthy for autonomous multi-agent use.
Filed from fleet verification of 2026.7.22 (companion tracker item pm-cli-website-qbpf sibling); repro is fully self-contained above.
Activity
coderabbitai commentedon Jul 22, 2026
🔗 Related PRs
#44 - feat(history): audited history-repair re-anchor command; clear legacy drift so pm health is ok [closed]
#200 - Add validation self-repair and agent ergonomics primitives [closed]
#593 - SDK-first agent UX graph, ownership, and recovery contracts [merged]
#614 - SDK-first field-aware merge safety and storage integrity [merged]
#627 - feat(sdk): stable agent contracts, provenance, and merge reconciliation [merged]
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
unbraind commentedon Jul 23, 2026
pm tracker item:
pm-mmm9o5— Agent UX: pm merge reconcile over-reports discarded_authors/discarded_events on the driver union path (false data-loss alarm; complements #603) #646: classify merge reconciliation discards by net outcomeThis canonical item is linked to the GH-603 loss-detection and GH-623 reconcile lineage and is now part of the active SDK/CLI context-integrity bundle.
unbraind commentedon Jul 25, 2026
Shipped. Tracked as pm-mmm9o5 and closed: loss-aware reconciliation classification verified through unit, command, packed, and real two-branch Git acceptance. Closing here to keep the tracker and this issue in sync.
chore(pm): ecosystem planning review — grammar vocabulary, CI gate co…