fix: skip non-owned root files in generate --check for shared AGENTS.md - #1978
Merged
Merged
Conversation
When multiple targets share the root AGENTS.md file (e.g., codexcli and antigravity-ide), generate --check for a single target would fail because the target's expected AGENTS.md content differs from the on-disk content written by the last target in config order (different TOON reference paths). Fix: compute root file ownership from the config file's full target list (before --targets CLI override). In check mode, skip root files the target doesn't own, so only the owning target's root file is checked. Non-root files (e.g., .codex/memories/*.md) are always checked regardless. - Add Config.getConfigFileTargets() returning config file targets before CLI --targets override - Add computeRootFileOwnership helper in generate.ts - Skip non-owned root files in processFeatureGeneration (write check only; orphan detection still sees the full tool file list) - Add e2e test: check codexcli passes when antigravity-ide owns AGENTS.md Closes #1894
Owner
|
@dyoshikawa-claw Thank you! |
This was referenced Jun 22, 2026
dyoshikawa
added a commit
that referenced
this pull request
Jun 23, 2026
…irrored roots (#2008) * fix(generate): correct root-file ownership for wildcard configs and mirrored roots Follow-up fixes for the #1978 root-file ownership work (#1981): - #1 (mid): `extractConfigFileTargets` collapsed the wildcard array form `targets: ["*"]` to an empty list, so `getConfigFileTargets()` did not fall back and ownership was computed against no targets — reproducing #1894 for the very common `["*"]` config. Expand `*` to the full non-legacy target set (mirroring `Config.getTargets()`). Note the fallback to `getTargets()` is intentionally NOT used because it is CLI `-t` filtered, whereas ownership needs the full config-file target list. - #2 (mid): `computeRootFileOwnership` derived owned roots solely from `getSettablePaths().root`, missing rovodev's generation-time mirror to project-root ./AGENTS.md (mirrorsRootToAgentsMd) and any target's alternativeRoots. Register both so mirrored/aliased root files are attributed to the right target instead of inverting ownership. - #3/#4 (low): document the single-decision-across-output-roots assumption and the load-bearing last-target-in-config-order-wins semantics at the call site. - #5 (low): add a config-resolver regression test for `["*"]` expansion (incl. CLI -t independence) and an E2E test asserting a non-owning target passes check when rovodev owns the mirrored ./AGENTS.md. Closes #1981 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * refactor(config): extract shared expandWildcardTargets helper (review follow-up) Address PR review findings on #2008: - Dedupe the wildcard (`*`) -> non-legacy-target expansion into a single exported `expandWildcardTargets()` helper used by both `Config.getTargets()` and `extractConfigFileTargets()`, removing the drift risk (and the redundant `validTargets.has` check). - Reword the `alternativeRoots` ownership comment (they are fallback/secondary root locations, not generation-emitted) and note the rovodev mirror overlaps its alt root today. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: dyoshikawa <yoshikawa.daio@classmethod.jp> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
rudironsoni
pushed a commit
to rudironsoni/rulesync
that referenced
this pull request
Jun 23, 2026
PR dyoshikawa#1979 changed codexcli to fold non-root rules into the root AGENTS.md and stopped writing the inert .codex/memories/ tree, but the e2e-rules case added in dyoshikawa#1978 ('should pass check for a non-owning target when another target owns AGENTS.md') still asserted .codex/memories/detail.md existed. The mismatch left main's E2E suite red. Update the assertions to the current behavior: the non-root 'Detail Rule' body is emitted by the owning target (antigravity-ide) under .agents/rules/, and codexcli no longer creates .codex/memories/. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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
When multiple targets share the root
AGENTS.mdfile (e.g.,codexcliandantigravity-ide),rulesync generate --checkfor a single target would fail because the target's expectedAGENTS.mdcontent differs from the on-disk content written by the last target in config order (different TOON reference paths like@.codex/memories/*vs@.agents/rules/*).Fix
Compute root file ownership from the config file's full target list (before
--targetsCLI override). In check mode, skip root files the target doesn't own, so only the owning target's root file is checked. Non-root files (e.g.,.codex/memories/*.md) are always checked regardless.Changes
Config.getConfigFileTargets()returning config file targets before CLI--targetsoverridecomputeRootFileOwnershiphelper ingenerate.tsthat maps root file paths to their owner (last target in config order)processFeatureGeneration(write check only; orphan detection still sees the full tool file list so shared root files are not treated as orphans)AGENTS.mdCloses #1894