Skip to content

Add shared-root dependency detection for downstream agent sync#3

Open
devansh-dwivedi-glean wants to merge 1 commit into
mainfrom
feat/shared-root-downstream-deps
Open

Add shared-root dependency detection for downstream agent sync#3
devansh-dwivedi-glean wants to merge 1 commit into
mainfrom
feat/shared-root-downstream-deps

Conversation

@devansh-dwivedi-glean
Copy link
Copy Markdown
Contributor

Description

From Glean Code Writer

Implements the shared-root change propagation feature. This enables automatic detection and re-sync of downstream agents when shared resources (skills, sub-agents, prompts, artifacts) change.

Key changes:

  • action.yml: Adds shared-root input (default .glean/common/) for declaring where shared reusable agent resources live
  • scripts/resolve-shared-deps.sh (new): Symlink-based dependency discovery and impact analysis engine that walks agent subtrees, resolves symlinks canonically, builds a dependency map, and computes affected agents from changed shared paths
  • scripts/detect-changes.sh: Extended to partition changed files into agent-root vs shared-root, call the resolver when shared files change, and union/deduplicate direct + indirect agent triggers
  • README.md: Documents shared-root usage, repo layout example, and dependency contract

Edge cases handled:

  • Broken symlinks: warn, don't count as dependency
  • Out-of-repo symlinks: rejected
  • Directory symlinks: descendant matching
  • Nested symlink chains: canonical resolution
  • Overlapping roots: rejected

New step outputs: shared_root_affected, shared_changed_files for downstream observability.

Testing

12-case integration test suite in tests/test-resolve-shared-deps.sh:

  • File symlink exact match
  • Directory symlink with nested file change
  • Multiple agents affected by one shared change
  • No dependents / empty input → empty output
  • Broken symlink warning (not counted as dependency)
  • Symlink escaping repo → rejected with exit 1
  • Overlapping roots → rejected with exit 1
  • Nested symlinks resolved through chain
  • Multiple shared changes affecting different agents
  • Symlinks outside shared_root ignored

All 12 tests pass.


🤖 Generated by Glean Code Writer
📝 Chat link - https://app.glean.com/chat/7bdf0a961c264c4d9ea4913a9c34eacd

Introduces a `shared-root` input (default `.glean/common/`) that enables
automatic detection and re-sync of downstream agents when shared resources
change. Agents declare dependencies on shared content via symlinks; when
files under shared-root change, the action resolves all symlink targets
to identify affected agents and unions them with directly changed agents
for a single combined sync run.

Key changes:
- action.yml: new `shared-root` input passed to detect-changes
- scripts/resolve-shared-deps.sh: symlink dependency discovery and impact
  analysis with canonical path resolution, broken-symlink warnings, and
  out-of-repo rejection
- scripts/detect-changes.sh: partitions changed files into agent-root vs
  shared-root, calls resolve-shared-deps, unions and deduplicates results
- tests/test-resolve-shared-deps.sh: 12-case integration test suite
- README.md: documents shared-root usage, repo layout, and dependency contract

Generated by Glean Code Writer
@devansh-dwivedi-glean devansh-dwivedi-glean added the glean-code-writer Modified by Glean Code Writer label May 30, 2026 — with glean-github-app-oauth
@devansh-dwivedi-glean devansh-dwivedi-glean marked this pull request as ready for review June 1, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

glean-code-writer Modified by Glean Code Writer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants