Repository navigation
fix: restore AGENTS.md from the PR base branch - #1703
WeAreResilience wants to merge 4 commits into
Conversation
Documented @AGENTS.md imports resolve against the working tree, so restoring CLAUDE.md alone still loaded PR-head instructions. Co-authored-by: Cursor <cursoragent@cursor.com>
tarunag10
left a comment
There was a problem hiding this comment.
The root-file fix and tests cover the documented @AGENTS.md pattern cleanly. One residual trust-boundary case is worth making explicit before merge: a restored base CLAUDE.md can import a nested path such as @docs/AGENTS.md, and that path still resolves from the PR-head checkout because SENSITIVE_PATHS only snapshots the two root filenames. If the intended scope is the documented root convention, I suggest adding a comment/test that records this limitation; if the intended invariant is “restored instructions cannot import PR-controlled content,” the robust fix is to resolve and restore the base @-import closure rather than enumerate filenames. I would avoid a broad **/AGENTS.md glob unless restore-config can preserve directory semantics and snapshot every matched path safely.
A restored CLAUDE.md can still load PR-head files through @docs/AGENTS.md. Walk the base import closure instead of globbing **/AGENTS.md. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Agreed — the right invariant is that restored instructions cannot import PR-controlled content. This follow-up walks the base The |
|
Friendly ping: the base @-import closure follow-up is ready for review whenever a maintainer has a moment. Happy to adjust scope if you'd prefer the narrower root-file fix. |
Summary
restoreConfigFromBasealready replacesCLAUDE.mdfrom the PR base. The documented@AGENTS.mdimport still resolved against the working tree, so a PR that rewroteAGENTS.mdcould inject instructions after that restore.This adds
AGENTS.mdandAGENTS.local.mdtoSENSITIVE_PATHS. The PR-head copies are snapshotted into.claude-pr/for review agents, then replaced from base (or deleted if they only exist on the head).Fixes #1696
Test plan
bun test test/restore-config.test.ts(20 pass, run three times)bun run typecheckAGENTS.mdrestore tests still passFrom RESILIENCE Agentic Solutions.
Made with Cursor