feat(results): no-force-push results sync (auto-merge loop)#1506
Merged
Conversation
… loop Phase 0 (av-raf.1): register a tiny dependency-free `agentv-json` 3-way JSON merge driver and mirror union/agentv-json merge attributes into the AgentV-owned results checkout (committed `.gitattributes` for portability plus repo-local `info/attributes` so local merges always apply the drivers). Append-only run indexes union-merge; editable tag/feedback overlays set/field-union, and a genuine scalar conflict falls through to a human merge. Phase 1 (av-raf.2): rewrite resolveResultBranchPushConflict as a bounded fetch -> merge -> push loop. Fast-forward when possible, otherwise commit a real 3-way merge (working-tree merge on a checked-out branch, merge-tree+update-ref on a detached storage branch) and fast-forward the canonical branch onto it; retry benign push races. A genuine conflict aborts the merge and returns a distinct `needs_human_merge` blocked outcome. Never force-pushes and never creates a backup ref. `push_conflict_policy: backup_and_force_push` is deprecated: it is kept for config back-compat but now auto-merges (no force) and warns once. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the force-push/backup-conflict tests with auto-merge coverage over temp local git remotes: disjoint diverged pushes produce a real merge commit and FF the remote (no force, no backup ref); concurrent run-index appends union-merge; overlay tag additions from both sides merge via the agentv-json driver; a genuine overlay scalar conflict returns needs_human_merge with the remote unchanged; a benign push race (remote advanced between fetch and push) retries and succeeds. Assert the previous remote tip stays an ancestor and no agentv/backups ref is ever created. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the needs_human_merge sync state to the dashboard status types and view, and stop recommending backup_and_force_push in push-conflict next actions now that results sync auto-merges and never force-pushes. The needs_human_merge view points users to a GitHub pull request instead. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Deploying agentv with
|
| Latest commit: |
d904ca2
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a39b2d8d.agentv.pages.dev |
| Branch Preview URL: | https://feat-av-raf-no-force-push-re.agentv.pages.dev |
…currency guard The agentv-json driver carried tag_revision forward as max() of the two sides' hashes. Because tag_revision is a content-derived optimistic- concurrency token, a stale client holding the surviving hash could pass assertExpectedTagRevision and silently overwrite the merged tag union. Drop tag_revision during a real merge so the reader recomputes a token matching the merged content; updated_at (display-only) still regenerates. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Phase 0 + Phase 1 of the conflict-free results sync design
(docs/plans/2026-06-24-001-feat-conflict-free-results-sync-plan.md),
making results-branch sync never force-push. The
backup_and_force_pushescape hatch is replaced by an artifact-aware auto-merge push loop.
Beads: av-raf.1 (Phase 0), av-raf.2 (Phase 1).
Phase 0 — artifact-aware merge drivers (av-raf.1)
agentv-json3-way JSON merge driver(set/field union; tag add/remove are commutative; regenerable bookkeeping
scalars take max; a genuine scalar conflict exits non-zero).
config (never global) and materializes the script under the checkout's git dir.
.gitattributes(
index.jsonl merge=union,metadata/runs/**/*.json merge=agentv-json) forportability and mirrors them into repo-local
info/attributesso localmerges apply the drivers even on branches predating
.gitattributesand in thedetached
merge-treepath.Phase 1 — fetch → merge → push loop, no force (av-raf.2)
resolveResultBranchPushConflict()as a bounded optimistic loop:fast-forward when possible; otherwise commit a real 3-way merge (working-tree
git mergeon a checked-out branch,merge-tree+update-refon a detachedstorage branch) and FF the canonical branch onto it; retry benign push races.
needs_human_mergeblocked outcome whose
block_reasonnever tells users to enable force push.The temp-branch + PR resolution flow is Phase 2 (av-raf.3) — out of scope.
backup_and_force_pushhandling — DEPRECATED (not removed)It is referenced by shipped surfaces (CLI
remote.ts, dashboard,projects.ts,config loader/validator), so per product-boundary §6 it is deprecated rather
than hard-removed: the config key still validates for back-compat, but it now
auto-merges (no force) and emits a one-time deprecation notice. The dashboard
no longer recommends opting into it.
Verification (red → green)
bun run verify(build + typecheck + lint + test): green.packages/core/test/evaluation/results-repo.test.ts— 58 pass / 0 fail.(real merge commit) + push; append-only index union; overlay tag union via
agentv-json; genuine overlay scalar conflict →needs_human_merge(remoteunchanged); benign push race retry; assertions that no
agentv/backups/*ref iscreated and the previous remote tip stays an ancestor (no rewrite).
Deferred scope
needs_human_merge.