Skip to content

fix(pr-assistant): block other agents' instruction files in automated fixes - #294

Merged
juninmd merged 1 commit into
masterfrom
claude/forbid-more-agent-instructions
Nov 22, 2026
Merged

juninmd merged 1 commit into
masterfrom
claude/forbid-more-agent-instructions

Conversation

@juninmd

@juninmd juninmd commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Requested by Antonio · project thread

Summary

Por quê: o #284 impediu que o auto-fix commitasse AGENTS.md/CLAUDE.md depois do incidente radar-ofertas#23 (fix trocou o AGENTS.md público por instruções privadas). Mas isForbiddenPath só compara o nome do arquivo com uma lista curta, então outros arquivos de instrução de agente, com a mesma natureza de política do dono, continuavam liberados: AGENT.md (Amp), .windsurfrules, .clinerules (arquivo ou pasta), e as regras baseadas em pasta .cursor/rules/*.mdc e .github/instructions/*.instructions.md (Copilot), que o teste por nome de arquivo nunca pega.

O que mudou:

  • ts/src/agents/pr_assistant/forbidden-paths.ts: adiciona agent.md, .windsurfrules, .clinerules à lista por nome e uma regra por pasta (.cursor/rules/, .github/instructions/, .clinerules/) em qualquer nível, sem diferenciar maiúsculas.
  • ts/tests/forbidden-paths.test.ts: casos positivos para cada um e negativos para vizinhos que continuam liberados (.cursor/mcp.json, .github/workflows/ci.yml, docs/instructions/setup.md, src/rules/a.ts).

Quality Checklist

  • User-facing behavior is described clearly.
  • Security impact was considered, including secrets, auth, and data exposure. (endurece a fronteira do que um fix automático pode commitar)
  • Performance impact was considered for startup, runtime, bundle size, or query cost. (desprezível)
  • Logs, errors, and operational visibility are useful enough to debug failures. (o motivo de rejeição já lista o caminho)
  • UI changes were checked for keyboard access, responsive layout, and readable states. (N/A)
  • Tests, smoke checks, or manual verification are listed below.

Verification

Como foi verificado

Antes da correção:

$ cd ts && bun test tests/forbidden-paths.test.ts
(fail) isForbiddenPath flags other agents' instruction files and folders
 8 pass
 1 fail

Depois:

$ bun test tests/forbidden-paths.test.ts
 9 pass
 0 fail
$ bun test
 293 pass
 0 fail
Ran 293 tests across 40 files.
$ bun run typecheck
$ tsc --noEmit   (sem erros)

Generated by Claude Code

… fixes

#284 stopped automated fixes from committing AGENTS.md/CLAUDE.md after
radar-ofertas#23, but the basename list missed AGENT.md, .windsurfrules,
.clinerules and the folder-based rule files (.cursor/rules/,
.github/instructions/, .clinerules/). These carry the same owner policy
and must not be rewritten by a bot fix either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cn6JQLtmA8NV75CtdV373W
@juninmd juninmd self-assigned this Nov 22, 2026
@juninmd
juninmd merged commit f262a0f into master Nov 22, 2026
3 checks passed
@juninmd
juninmd deleted the claude/forbid-more-agent-instructions branch November 22, 2026 05:14
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.

2 participants