Skip to content

[DEV-86] Enable automatic conflict sync/resolution across all open PRs in the repo via configuration - #67

Open
danii1 wants to merge 4 commits into
mainfrom
feature/dev-86-attempt-5
Open

[DEV-86] Enable automatic conflict sync/resolution across all open PRs in the repo via configuration#67
danii1 wants to merge 4 commits into
mainfrom
feature/dev-86-attempt-5

Conversation

@danii1

@danii1 danii1 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Task: DEV-86

Summary: Enable automatic conflict sync/resolution across all open PRs in the repo via configuration

Implementation Details

I'll start by exploring the repository structure and checking the existing state of the work mentioned in the comments.
The current branch is feature/dev-86-attempt-5. Let me check the state of this branch and previous attempts.
Previous attempt-4 has partial work. Let me examine it.
I have a good understanding of the codebase now. Let me examine the rest of the attempt-4 diff to decide what to reuse.
The attempt-4 branch mixes DEV-86 work with unrelated license-check changes. Notably, DEV-87 (already merged to main) removed a requireTeamAutomation gate. Let me verify main's current state.
Main has already removed the requireTeamAutomation gate via DEV-87, so attempt-4's license-check changes are stale and must be excluded. Let me see the remainder of the attempt-4 acquirer diff and the test changes.
Attempt-4 contains solid DEV-86 work mixed with stale team-tier licensing changes that conflict with merged DEV-87 (which removed that gate). My plan: apply only the DEV-86-relevant parts onto this fresh branch.
ConditionalResult lives in the acquirer file itself. Now let me check if files drifted between attempt-4's base and current main.
DEV-87 didn't touch the acquirer files. Now applying the clean DEV-86 pieces:
All hunks are DEV-86-specific. Checking out the acquirer, its tests, and docs from attempt-4:
Now wiring index.ts. Let me read the relevant sections on the current branch:
Now the worker --help env var docs:
Now wiring workspace-worker.ts (fleet mode):
Now verifying my branch matches attempt-4 on all DEV-86 files, differing only where DEV-87 landed:
Only the intentionally-excluded stale license changes differ. Now running verification — typecheck first, then tests:
894 pass, 1 fail. Let me identify the failure:
This failure is in automation-acquirer.test.ts — unrelated to my change. Let me check if it's pre-existing on main:
Confirmed pre-existing on main — unrelated to this change. Now running the acquirer test suite specifically:
All 33 acquirer tests pass (including the new sync-all-PRs suite). Running lint + format:
All checks green. Let me check whether feature branches typically update the CHANGELOG:
DEV-87 added a CHANGELOG entry, so I'll add one for DEV-86 under [Unreleased]:
Final review of the complete acquirer implementation:
Docs frontmatter is current. Final full test run:
DEV-86 is implemented on feature/dev-86-attempt-5 (uncommitted, per repo convention).

What was done

Recovered the partial work from the interrupted attempt (feature/dev-86-attempt-4), discarding its stale team-tier licensing changes (superseded by merged DEV-87) and rebuilding cleanly on current main.

Feature: WORKER_BASE_SYNC_ALL_PRS env var (default: off — existing behavior unchanged)

  • Core logicpackages/code/src/lib/review-polling-acquirer.ts: new sweepRepoOpenPrs() discovery + pollForeignPr() base-sync-only polling; foreign PRs reuse the existing durable-event pipeline (maybeSyncBase) with an (external PR) audit marker. Closed/merged PRs drop from the open list, drafts excluded at both discovery and per-PR polling, fork PRs terminally skipped, rate limits handled via ETag conditional requests with a page-size-cap warning.
  • Wiringsrc/index.ts:843 (single-repo) and workspace-worker.ts:503 (fleet mode): listOpenPullRequests GitHub adapter + syncAllOpenPrs: process.env.WORKER_BASE_SYNC_ALL_PRS === "true".
  • Auditability — watch/unwatch log lines (👀 watching …, 👋 left the open-PR list), (external PR) sync markers, resolver outcome comments on the PR, and conflict_resolution runs in the dashboard RunStore.
  • Docs — new section in docs/code/worker.md (env var, default, trust boundaries), worker --help env listing, CHANGELOG entry.

Verification

  • Typecheck ✅ · Lint ✅ · Format ✅
  • Tests: 894 pass / 1 fail — the failure (automation-acquirer.test.ts) reproduces on clean main, pre-existing and unrelated
  • All 33 acquirer tests pass, including 11 new ones covering: default-off no-op, foreign sync without feedback addressing, ETag/304 list reuse, restart hydration, own-PR dedupe, draft exclusion, closed-PR removal, fork skip, missing-list degradation, and run recording

This PR was automatically created by @devintern/code

…ross all open PRs in the repo via configuration
danii1 and others added 2 commits August 26, 2026 14:51
…AGENT_SANDBOX

- Only sync foreign PRs authored by the repo's own team (author_association
  OWNER/MEMBER/COLLABORATOR/MAINTAIN), checked at discovery and re-checked
  against the fresh per-PR payload before every run
- Rename WORKER_BASE_SYNC_ALL_PRS to WORKER_BASE_SYNC_TEAM_PRS to reflect scope
- Fleet mode: per-repo sync_team_prs opt-in in workspace.toml instead of one
  global env var; single-repo mode keeps the env var for its own checkout
- Refuse to start when AGENT_SANDBOX is unset/none: team-PR conflict resolution
  hands teammate-authored code to the coding agent, which must be sandboxed
- Tests: author-gate discovery/per-PR cases, sandbox guard, TOML validation;
  docs, CHANGELOG, worker --help, and workspace init scaffold updated
# Conflicts:
#	packages/code/CHANGELOG.md
#	packages/code/src/index.ts
#	packages/code/src/lib/workspace/config.ts
@danii1

danii1 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

🔀 This branch had merge conflicts with main; devintern resolved them and pushed the merge. Please double-check the resolution.

# Conflicts:
#	packages/code/CHANGELOG.md
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