Skip to content

feat(agents): stop agents leaking internal information into published docs#12204

Merged
mergify[bot] merged 1 commit into
mainfrom
devs/jd/jd/llm-no-internal-leak/stop-agents-leaking-internal-info-published-docs--56a581e7
Jul 27, 2026
Merged

feat(agents): stop agents leaking internal information into published docs#12204
mergify[bot] merged 1 commit into
mainfrom
devs/jd/jd/llm-no-internal-leak/stop-agents-leaking-internal-info-published-docs--56a581e7

Conversation

@jd

@jd jd commented Jul 26, 2026

Copy link
Copy Markdown
Member

Docs are usually written from internal material: a support case, a private
PR, an engine source file, a Linear ticket. That material travels with the
draft, and nothing in the repo told an agent to leave it behind. A recent
billing page was written from a support ticket whose context carried a
helpdesk ticket ID, a thread ID, a customer org name, and a private
shadow-office source path. None of that belongs on docs.mergify.com, and a
leaked identifier cannot be unpublished.

This follows the repo's existing agent-guidance structure rather than adding
a parallel document:

  • AGENTS.md gains Critical Rule 8 plus a "Never Publish Internal
    Information" section listing concretely what must never ship (ticket and
    thread IDs, customer/org/account identifiers, private repo and source
    paths, internal trackers and admin URLs, credentials, internal framing),
    and how to fix a leak: state the behavior, drop the provenance.

  • proofread-leaks joins the proofread pipeline as a 5th subagent,
    written to match the existing proofread-* skills. It is the one
    proofreader that never skips: the pipeline's 10-line threshold and its
    "code blocks only" / "frontmatter only" exemptions are exactly where a
    one-line ticket ID hides, so those exemptions no longer apply to it.

  • pnpm check:internal-leaks (scripts/check-internal-leaks.mjs, plus a
    CI job) is the deterministic backstop, modelled on
    validate-config-examples: fixed patterns for ticket/thread IDs, private
    repo and source paths, and internal trackers and hostnames, with a
    per-line internal-leaks: allow <rule> escape hatch.

  • docs-from-code, docs-gap-analysis, and document-a-feature each
    gain a pointer, since those are the skills that pull internal material in.

Every rule is narrow enough to leave today's docs clean (146 files scanned,
0 findings) and to ignore the placeholders the docs already use, so ghp_*,
<your-token>, Mergifyio/mergify, and app.datadoghq.com do not fire.

Credentials stay in the policy and in proofread-leaks' checklist, but the
deterministic scan does not look for them: secret detection is not this
script's job to reinvent.

Judgment call worth a look: the ask was for instructions, and the CI scanner
goes beyond that. I added it because the skill-level check only fires when
an agent runs the pipeline, which leaves human edits and skipped passes
uncovered, and because this is the one class of mistake that is unfixable
after the fact. Happy to drop the script and keep the instructions if you
would rather not carry the CI surface.

The scanner cannot catch customer names, copied examples, or internal
framing. That half stays with proofread-leaks, and the docs say so in both
places so a green CI run is not mistaken for a clean bill of health.

Copilot AI review requested due to automatic review settings July 26, 2026 08:01
@mergify
mergify Bot had a problem deploying to Mergify Merge Protections July 26, 2026 08:01 Failure
@mergify

mergify Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 6 merge protections satisfied — ready to merge.

Show 6 satisfied protections

🟢 🤖 Continuous Integration

  • all of:
    • check-success = build
    • check-success = lint
    • check-success = test
    • any of:
      • check-success = test-broken-links
      • label = ignore-broken-links
    • any of:
      • check-success=Cloudflare Pages
      • -head-repo-full-name~=^Mergifyio/

🟢 👀 Review Requirements

  • any of:
    • #approved-reviews-by >= 2
    • author = dependabot[bot]
    • author = mergify-ci-bot

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|internal|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?!?:

🟢 🔎 Reviews

  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

  • body ~= (?ms:.{48,})

🟢 🚦 Auto-queue

When all merge protections are satisfied, this pull request will be queued automatically.

@mergify
mergify Bot requested a review from a team July 26, 2026 08:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds guardrails to prevent agents (and humans) from leaking internal identifiers into published docs by combining: (1) explicit repository guidance, (2) an always-on leak-focused proofreader skill, and (3) a deterministic CI/CLI scanner for mechanical leak patterns.

Changes:

  • Add a Node-based scanner (pnpm check:internal-leaks) with unit tests to detect common internal identifiers (tickets/threads, private paths, internal trackers/hosts, credential-shaped strings) plus an allow-directive escape hatch.
  • Wire the scanner into CI as a dedicated internal-leaks job and document the policy + enforcement workflow in AGENTS.md.
  • Introduce a new proofread-leaks skill and reference it from doc-authoring / code-grounded doc skills to keep internal provenance out of published pages.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scripts/check-internal-leaks.mjs Implements the deterministic internal-leak scanner and CLI output.
scripts/check-internal-leaks.test.mjs Adds Vitest coverage for rules, allow-directives, and a repo docs-tree sanity scan.
package.json Adds check:internal-leaks script entry.
.github/workflows/ci.yaml Adds CI job to run the leak scanner on docs.
AGENTS.md Documents the “Never publish internal information” rule and enforcement steps.
.claude/skills/proofread-leaks/SKILL.md Adds the always-on leak-focused proofreading subagent guidance.
.claude/skills/document-a-feature/SKILL.md Requires leak checking in the documentation workflow and points to AGENTS.md.
.claude/skills/docs-gap-analysis/SKILL.md Clarifies that internal IDs/paths must not flow from gap reports into published docs.
.claude/skills/docs-from-code/SKILL.md Adds explicit guardrail to avoid citing private clone identifiers/paths in docs output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/check-internal-leaks.mjs Outdated
… docs

Docs are usually written *from* internal material: a support case, a private
PR, an engine source file, a Linear ticket. That material travels with the
draft, and nothing in the repo told an agent to leave it behind. A recent
billing page was written from a support ticket whose context carried a
helpdesk ticket ID, a thread ID, a customer org name, and a private
shadow-office source path. None of that belongs on docs.mergify.com, and a
leaked identifier cannot be unpublished.

This follows the repo's existing agent-guidance structure rather than adding
a parallel document:

- **AGENTS.md** gains Critical Rule 8 plus a "Never Publish Internal
  Information" section listing concretely what must never ship (ticket and
  thread IDs, customer/org/account identifiers, private repo and source
  paths, internal trackers and admin URLs, credentials, internal framing),
  and how to fix a leak: state the behavior, drop the provenance.

- **`proofread-leaks`** joins the proofread pipeline as a 5th subagent,
  written to match the existing proofread-* skills. It is the one
  proofreader that never skips: the pipeline's 10-line threshold and its
  "code blocks only" / "frontmatter only" exemptions are exactly where a
  one-line ticket ID hides, so those exemptions no longer apply to it.

- **`pnpm check:internal-leaks`** (`scripts/check-internal-leaks.mjs`, plus a
  CI job) is the deterministic backstop, modelled on
  validate-config-examples: fixed patterns for ticket/thread IDs, private
  repo and source paths, and internal trackers and hostnames, with a
  per-line `internal-leaks: allow <rule>` escape hatch.

- **docs-from-code**, **docs-gap-analysis**, and **document-a-feature** each
  gain a pointer, since those are the skills that pull internal material in.

Every rule is narrow enough to leave today's docs clean (146 files scanned,
0 findings) and to ignore the placeholders the docs already use, so `ghp_*`,
`<your-token>`, `Mergifyio/mergify`, and `app.datadoghq.com` do not fire.

Credentials stay in the policy and in proofread-leaks' checklist, but the
deterministic scan does not look for them: secret detection is not this
script's job to reinvent.

Judgment call worth a look: the ask was for instructions, and the CI scanner
goes beyond that. I added it because the skill-level check only fires when
an agent runs the pipeline, which leaves human edits and skipped passes
uncovered, and because this is the one class of mistake that is unfixable
after the fact. Happy to drop the script and keep the instructions if you
would rather not carry the CI surface.

The scanner cannot catch customer names, copied examples, or internal
framing. That half stays with proofread-leaks, and the docs say so in both
places so a green CI run is not mistaken for a clean bill of health.

Change-Id: I56a581e7825816dbdc7e7f9be082f39d799cd72f
@jd

jd commented Jul 26, 2026

Copy link
Copy Markdown
Member Author

Revision history

# Type Changes Reason Date
1 initial 16507cd 2026-07-26 11:22 UTC
2 content 16507cd → 519cdbc review (jd): drop the credential rule from the deterministic scanner — secret detection is not this script's job. Rule, its test, and the AGENTS.md enforcement wording removed; credentials stay in th… 2026-07-26 11:22 UTC

@jd
jd force-pushed the devs/jd/jd/llm-no-internal-leak/stop-agents-leaking-internal-info-published-docs--56a581e7 branch from 16507cd to 519cdbc Compare July 26, 2026 11:22
@mergify
mergify Bot deployed to Mergify Merge Protections July 26, 2026 11:23 Active
@jd
jd marked this pull request as ready for review July 26, 2026 13:42
@mergify
mergify Bot requested a review from a team July 27, 2026 07:31
@mergify

mergify Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 2 minutes 19 seconds in the queue, including 1 minute 46 seconds running CI.

Required conditions to merge

@mergify mergify Bot added the queued label Jul 27, 2026
@mergify
mergify Bot merged commit c529544 into main Jul 27, 2026
10 of 17 checks passed
@mergify
mergify Bot deleted the devs/jd/jd/llm-no-internal-leak/stop-agents-leaking-internal-info-published-docs--56a581e7 branch July 27, 2026 07:36
@mergify mergify Bot removed the queued label Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants