Skip to content

refactor(copilot): remove duplicate example implementation - #3879

Open
Carlos Hernandez (carloshvp) wants to merge 1 commit into
microsoft:mainfrom
carloshvp:cleanup-copilot-example
Open

refactor(copilot): remove duplicate example implementation#3879
Carlos Hernandez (carloshvp) wants to merge 1 commit into
microsoft:mainfrom
carloshvp:cleanup-copilot-example

Conversation

@carloshvp

@carloshvp Carlos Hernandez (carloshvp) commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Related Issue

None.

Problem & Solution

Problem: examples/copilot-cli-agt carried a second copy of the Copilot extension runtime,
four policy files, two installer wrappers, and nine policy tests. Its installer wrappers already
delegated to agent-governance-copilot-cli, while the package copy continued receiving fixes.
Maintaining both trees left 3,252 lines of runtime and support assets with two owners.

Solution: Keep the scenario prompts, proof corpus, expected outcomes, and tutorial in the
example. Remove its duplicate executable assets and point all setup, profile, source, and test
instructions to agent-governance-copilot-cli. The package README now retains the original design
attribution.

Impact on Your Work

The current source snapshot is 3,493 lines smaller: 85 additions and 3,578 deletions. Published
package contents and runtime behavior do not change. Contributors now test and edit the same
extension and policy files that users install.

Timeline

None.

Alternatives Considered

  • Keep both copies and add more equality tests. This would detect only some drift and retain the
    duplicate runtime and maintenance cost.
  • Link the example files to the package with filesystem symlinks. That would make Windows checkouts
    and npm packaging less predictable.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that causes existing functionality to change)
  • Documentation update
  • Maintenance (dependency updates, CI/CD, refactoring)
  • Security fix

Package(s) Affected

Core & runtime:

  • agent-governance-toolkit-core
  • agent-primitives
  • agent-os
  • agent-mesh
  • agent-runtime
  • agent-sre
  • agent-compliance

Governance & security:

  • agent-mcp-governance
  • agent-rag-governance
  • agent-sandbox
  • agent-discovery
  • agt-policies
  • policy-engine

Platform & tooling:

  • agent-hypervisor
  • agent-lightning
  • agent-marketplace
  • agent-governance-toolkit-cli
  • agent-governance-toolkit-integrations
  • agent-governance-toolkit-protocols
  • agentmesh-integrations (framework integrations)

CLI plugins:

  • agent-governance CLI plugins (copilot-cli / claude-code / opencode / antigravity-cli)

Shared / other:

  • schemas
  • action (GitHub Action)
  • examples
  • docs / root

Testing

Unit Testing

  • npm --prefix agent-governance-copilot-cli test (18 passed)
  • python3 -m pytest scripts/tests/test_docs_check_links.py scripts/tests/test_docs_check_frontmatter.py -q (51 passed)

The removed nine-test example suite covered the same policy helpers. The retained package suite
also covers installer lifecycle, policy profiles, prompt-defense grading, and metadata URL guards.

One removed test, example policy stays aligned with the hardened packaged baseline, was solely a drift guard between the two copies; it becomes obsolete once the duplicate copy is removed.

Manual Testing

  • npm --prefix agent-governance-copilot-cli run check
  • npm --prefix agent-governance-copilot-cli pack --dry-run --json
  • python3 scripts/docs/check_links.py --root .
  • python3 scripts/docs/check_frontmatter.py --root . --strict
  • changed-line cspell with the repository configuration
  • markdown-link-check on every changed Markdown file
  • JSON parse check for the retained proof corpus
  • git diff --check

Checklist

  • I have linked a related issue above, or completed "Problem & Solution", "Impact on Your Work", and "Alternatives Considered"
  • My code follows the project style guidelines (no Python source changed)
  • I have added tests that prove my fix/feature works (no behavior added)
  • All new and existing relevant tests pass
  • I have updated documentation as needed
  • I have signed the Microsoft CLA

Attribution & Prior Art

  • This contribution does not contain code copied or derived from other projects without attribution
  • External projects that inspired the existing integration remain credited in package documentation
  • Related projects are listed below

Prior art / related projects:

AI Assistance

  • I can explain every meaningful change in this PR: what it does, why, and what tradeoffs were considered
  • I have run tests and verification appropriate for this change
  • No part of this PR was autonomously submitted by an AI agent without my review
  • I have not used AI to generate review comments on others' PRs

Codex audited the duplicate trees, prepared this cleanup at Carlos Hernandez's request, and ran the
validation listed above. Maintainer review is still required.

IP, Patents, and Licensing

  • This contribution does not implement patent-pending or patent-encumbered techniques
  • This contribution does not require an NDA or licensing agreement to understand or use
  • Any AI tools used have terms compatible with the MIT License

Signed-off-by: Carlos Hernandez <carloshvp@gmail.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Sep 3, 2026
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

PR Review Summary

Check Status Details
🔍 Code Review ⚠️ Missing No current-run comment
🛡️ Security Scan ⚠️ Missing No current-run comment
🔄 Breaking Changes ⚠️ Missing No current-run comment
📝 Docs Sync ⚠️ Missing No current-run comment
🧪 Test Coverage ⚠️ Missing No current-run comment

Verdict: ⚠️ AI review incomplete; ready for human review

AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims.

@github-actions github-actions Bot added the size/XL Extra large PR (500+ lines) label Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Deleting 3,578 lines deserves proof that nothing goes with them, so I checked rather than took the
dedup claim on trust. It holds, with one conflict to sequence around.

The two policy.mjs copies really are the same implementation, and the package one is ahead.

examples/copilot-cli-agt/.github/extensions/agt-global-policy/lib/policy.mjs   1272 lines
agent-governance-copilot-cli/assets/extensions/agt-global-policy/lib/policy.mjs 1342 lines
diff between them: 104 changed lines

I pulled every line that exists only in the example copy, stripped brace-only lines, and got 16
distinct lines. Every symbol in them appears in the package copy at the same occurrence count:
summarizeText 3/3, safeJsonStringify 2/2, buildContextEntry 4/4, DEFAULT_TOOL_EFFECT 2/2,
outputText 4/4. So the divergence is ordering and formatting, not behaviour, and the package copy
is a strict superset. Your framing that "the package copy continued receiving fixes" is right.

Test coverage survives. The deleted examples/copilot-cli-agt/test/policy-engine.test.mjs has 9
tests against the package's 12. Two names appear only in the example:

  • evaluateDirectResourceAccess denies secret reads and reviews persistence writesnot lost.
    The package has evaluateDirectResourceAccess denies secret reads, allows env templates, reviews persistence writes, and blocks metadata URLs, which is a superset with 10 references to the same
    function.
  • example policy stays aligned with the hardened packaged baseline — genuinely goes away, and that
    is correct. It is a drift guard between the two copies, and after this PR there is only one copy
    for it to guard. Worth a sentence in the PR body saying so explicitly, since "deleted a test that
    checks the thing this PR is about" reads badly in a changelog without the explanation.

One conflict to sequence. #3871 (the v5.0.1 security patch tree) modifies two files this PR
deletes:

examples/copilot-cli-agt/package.json
examples/copilot-cli-agt/.github/extensions/agt-global-policy/package.json

That is a delete-versus-modify conflict, and it will not resolve itself. #3871 is deliberately cut at
tag v5.0.0 and is not meant to be rebased onto main, so the two need a decision rather than a
merge order: either this waits until #3871 has shipped, or #3871's version-sync step drops those two
manifests on the grounds that they are about to stop existing.

Non-blocking. Keeping the scenario prompts, proof corpus, expected outcomes and tutorial while
removing the executable duplicate is the right line to draw. An example that carries a second runtime
is a second thing to keep correct, and the README/docs/tutorial edits pointing setup at the packaged
extension are what make the deletion safe rather than merely tidy.

Nothing blocking from me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/XL Extra large PR (500+ lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants