Skip to content

fix(sync): additive lib/ sync to preserve downstream-only files#14

Merged
avifenesh merged 1 commit into
mainfrom
fix/restore-synced-files
Apr 26, 2026
Merged

fix(sync): additive lib/ sync to preserve downstream-only files#14
avifenesh merged 1 commit into
mainfrom
fix/restore-synced-files

Conversation

@avifenesh

@avifenesh avifenesh commented Apr 26, 2026

Copy link
Copy Markdown
Contributor

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-core
  • lib/state/workflow-state.js lost 152 lines of task-management code (agent-core has a simpler 587-line version, agentsys has a stricter 709-line version with updateTasks/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

  • Re-run sync workflow manually (or let next lib/ commit trigger it)
  • Verify agentsys `lib/repo-intel/queries.js` survives
  • Verify agentsys `lib/state/workflow-state.js` retains `updateTasks`/`readTasks`/etc.
  • agentsys PR #348 CI turns green once the fresh sync PR supersedes it

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.yml workflow’s lib/ propagation from a destructive mirror (rm -rf && cp -r) to an additive rsync -a copy that preserves downstream-only files.

Adds inline documentation explaining the prior regression and ensures target/lib exists before syncing.

Reviewed by Cursor Bugbot for commit eeac7d0. Configure here.

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.
@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

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