fix(sync): additive lib/ sync to preserve downstream-only files#14
Merged
Conversation
Sync workflow was `rm -rf target/lib/ && cp -r source/lib/` which mirrored agent-core onto consumer repos, silently deleting any file that existed only downstream. On 2026-04-26 the v0.4.1 sync wiped ~300 LOC of lib/repo-intel/queries.js from agentsys plus 152 lines of lib/state/workflow-state.js task-management code. Switch to rsync without --delete so the sync becomes additive. Each consumer repo keeps sovereignty over files agent-core doesn't ship. Security note: the original audit finding that flagged the rm+cp (an agent-core PR could add lib/postinstall.js that lands in every consumer) still applies. A follow-up should move from additive sync to an explicit allowlist of files/subdirs agent-core is permitted to write into downstream repos. Until then, human review on agent-core PRs remains the only gate, same as before this change.
|
Note Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported. |
This was referenced Apr 26, 2026
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.
Why
The 2026-04-26 v0.4.1 sync wiped downstream-only files from agentsys:
lib/repo-intel/queries.js(300 lines) — does not exist in agent-corelib/state/workflow-state.jslost 152 lines of task-management code (agent-core has a simpler 587-line version, agentsys has a stricter 709-line version withupdateTasks/readTasks/claimTask/releaseTask/defaultTasksSchema/normalizeTasksData)Root cause: the sync step was `rm -rf target/lib/ && cp -r source/lib/` — a mirror operation that deletes anything not present upstream. PR #348 in agentsys currently fails CI because of this wipe.
What
Switch the sync step from mirror to additive via `rsync -a` without `--delete`. agent-core's files still overwrite downstream copies of the same path, but downstream-only files are preserved.
Known limitation
This does NOT resolve the broader supply-chain concern from the 2026-04-26 security audit (HIGH finding: "any file a committer adds under lib/ replicates everywhere"). The additive change only reduces destructive side effects. A follow-up should switch to an explicit allowlist of paths/directories agent-core is authorized to write into consumer repos. Tracking separately.
Test plan
Note
Medium Risk
Changes the GitHub Actions sync workflow to stop deleting downstream-only files in consumer repos; risk is moderate because it affects automated propagation across many repositories and could leave stale upstream-removed files behind.
Overview
Switches the
sync.ymlworkflow’slib/propagation from a destructive mirror (rm -rf && cp -r) to an additiversync -acopy that preserves downstream-only files.Adds inline documentation explaining the prior regression and ensures
target/libexists before syncing.Reviewed by Cursor Bugbot for commit eeac7d0. Configure here.