Skip to content

fix: fail agent rule sync on missing imports - #103

Open
CBOSSX wants to merge 2 commits into
JCodesMore:masterfrom
CBOSSX:bugfix/fail-on-missing-agent-import-20260812T062859Z
Open

fix: fail agent rule sync on missing imports#103
CBOSSX wants to merge 2 commits into
JCodesMore:masterfrom
CBOSSX:bugfix/fail-on-missing-agent-import-20260812T062859Z

Conversation

@CBOSSX

@CBOSSX CBOSSX commented Aug 12, 2026

Copy link
Copy Markdown

Summary

  • Fail scripts/sync-agent-rules.sh when an AGENTS.md @file import does not exist, instead of silently generating incomplete agent instructions.
  • Add an isolated regression fixture that requires the command to exit nonzero and name the missing path.

The root cause was that resolve_imports emitted an HTML comment for a missing import and continued, so both the command substitution and the overall sync command returned success. That also allowed the generated-file CI check to accept the incomplete output as synchronized.

Related Issue

No existing issue; exact issue/PR searches found no implementation of this missing-import failure case.

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactoring
  • Breaking change

Regression Evidence

  • Before: bash tests/sync-agent-rules.test.sh exited 1 because the unmodified script incorrectly returned success.
  • After: bash tests/sync-agent-rules.test.sh exited 0 and confirmed missing imports fail closed.

Verification

  • bash tests/sync-agent-rules.test.sh
  • bash scripts/sync-agent-rules.sh
  • bash -n scripts/sync-agent-rules.sh tests/sync-agent-rules.test.sh
  • npm run check

Checklist

  • npm run check passes (lint + typecheck + build)

@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown

Greptile Summary

The PR makes agent-rule synchronization fail when an imported file is missing and adds an isolated regression test. It also exposes the test through package scripts, but the existing CI workflow still bypasses that test.

  • Missing imports now produce an error and a nonzero exit.
  • A temporary fixture verifies that the missing path is reported.
  • The package-level check command now includes the regression test.

Confidence Score: 4/5

The PR is not yet safe to merge because its regression test remains bypassed by the CI workflow.

The new package scripts run the missing-import regression test locally, but CI continues to invoke lint, typecheck, and build separately, so future regressions can pass the standard automated gate.

Files Needing Attention: package.json and .github/workflows/ci.yml

Important Files Changed

Filename Overview
scripts/sync-agent-rules.sh Missing AGENTS.md imports now terminate synchronization with a diagnostic instead of producing incomplete instructions.
tests/sync-agent-rules.test.sh The isolated fixture exercises the fail-closed behavior, but the previously reported CI automation gap remains outstanding.
package.json The test is wired into npm test and npm run check, although CI does not invoke either command.

Reviews (2): Last reviewed commit: "test: run agent sync regression in check..." | Re-trigger Greptile

Comment thread tests/sync-agent-rules.test.sh
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