Skip to content

feat: add context and implement automated subtree synchronization wor… - #14

Open
kpj2006 wants to merge 5 commits into
AOSSIE-Org:mainfrom
kpj2006:skills
Open

feat: add context and implement automated subtree synchronization wor…#14
kpj2006 wants to merge 5 commits into
AOSSIE-Org:mainfrom
kpj2006:skills

Conversation

@kpj2006

@kpj2006 kpj2006 commented Jul 25, 2026

Copy link
Copy Markdown
Member

…kflow

Addressed Issues:

Fixes #(issue number)

Screenshots/Recordings:

Additional Notes:

Checklist

  • My code follows the project's code style and conventions
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there
  • I have read the Contributing Guidelines

⚠️ AI Notice - Important!

We encourage contributors to use AI tools responsibly when creating Pull Requests. While AI can be a valuable aid, it is essential to ensure that your contributions meet the task requirements, build successfully, include relevant tests, and pass all linters. Submissions that do not meet these standards may be closed without warning to maintain the quality and integrity of the project. Please take the time to understand the changes you are proposing and their impact.

Summary by CodeRabbit

  • New Features

    • Added automated synchronization of repository context files.
    • Added full-repository context loading for more complete project information.
    • Added repository metadata configuration for supported projects.
  • Chores

    • Added daily scheduled and manually triggered updates.
    • Improved handling of missing, large, or unreadable context files.
    • Removed reliance on a single local context document.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@kpj2006, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 36ba3f34-fd7b-4550-a82e-05df72e63eb3

📥 Commits

Reviewing files that changed from the base of the PR and between 26d9607 and a4e0eab.

📒 Files selected for processing (2)
  • context.py
  • scripts/update_subtrees.py

Walkthrough

Adds scheduled and manual repository context synchronization, a Markdown context loader, and integration that supplies full target-repository context to the main workflow instead of a local context.md.

Changes

Repository context synchronization

Layer / File(s) Summary
Synchronize repository context
.github/workflows/sync-subtrees.yml, repo_metadata.py, scripts/update_subtrees.py
The script downloads configured GitHub context files into repos/<repo_name>/. The workflow runs the script on a schedule or manually, then commits and pushes changes under repos/**.
Load full repository context
context.py
The loader resolves repository directories and aggregates Markdown files recursively. It skips hidden paths except .agent, enforces file and total character limits, and logs loading results.
Use synchronized context in main workflow
main.py
The workflow instructions now require context synchronization. main() derives the repository name from REPO and loads context with load_full_repo_context.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant update_subtrees.py
  participant GitHubRawFiles
  participant reposDirectory
  participant main.py
  GitHubActions->>update_subtrees.py: run scheduled or manual synchronization
  update_subtrees.py->>GitHubRawFiles: fetch configured context files
  GitHubRawFiles-->>update_subtrees.py: return file contents
  update_subtrees.py->>reposDirectory: write repository context
  GitHubActions->>reposDirectory: commit and push repos/** changes
  main.py->>reposDirectory: load Markdown context for REPO
  reposDirectory-->>main.py: return aggregated repository context
Loading

Poem

A rabbit syncs files with care,
Then loads Markdown from everywhere.
Context limits keep the bundle light,
While scheduled jobs run day and night.
Hop, commit, and guide the review right.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: adding repository context and implementing automated subtree synchronization.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added no-issue-linked PR is not linked to any issue backend Changes to backend code ci-cd CI/CD pipeline changes configuration Configuration file changes documentation Changes to documentation files github-actions GitHub Actions workflow changes python Python code changes size/L Large PR (201-500 lines changed) repeat-contributor PR from an external contributor who already had PRs merged needs-review labels Jul 25, 2026
@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor
Messages
📖

⚠️ PR Template Check

These are non-blocking, but please fix:

  • Please replace the placeholder Fixes #(issue number) with the actual issue number (e.g. Fixes #42).

  • Some required checklist items are not completed:

  • My PR addresses a single issue

  • My code follows the project's code style

  • My changes generate no new warnings or errors

Generated by 🚫 dangerJS against a4e0eab

@kpj2006

kpj2006 commented Jul 25, 2026

Copy link
Copy Markdown
Member Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/sync-subtrees.yml:
- Around line 3-7: Add a fixed concurrency configuration to the workflow’s
top-level trigger settings so scheduled and workflow_dispatch runs share one
concurrency group. Set cancel-in-progress to false, ensuring overlapping
synchronization runs wait rather than canceling or executing concurrently.
- Around line 9-14: Harden the sync-context job by declaring only contents:
write permissions, configuring actions/checkout@v4 with persisted credentials
disabled, and updating the workflow’s commit/push step to use explicit
authentication so repository changes can still be pushed.
- Line 14: Update the scheduled write workflow to pin all executable
dependencies: replace mutable GitHub Action tags, including actions/checkout and
the other actions used by the workflow, with immutable commit SHAs, and install
httpx through a pinned, hash-checked constraints or lock file rather than an
unpinned package specification. Keep the existing workflow behavior unchanged.

In `@context.py`:
- Around line 31-43: Bound Markdown loading in the recursive scan around
repo_dir.rglob and the file-reading block by enforcing explicit per-file and/or
total context limits before appending to context_parts. Truncate oversized
content and report the truncation, or restrict loading to a curated allowlist,
while preserving hidden-directory filtering and the loaded_files accounting.

In `@repo_metadata.py`:
- Around line 11-13: Align the repository metadata key with the canonical
directory name derived by main.py: update the Template-Repo-Main entry in
repo_metadata.py to use Template-Repo, or apply a shared canonical-name mapping
consistently in the sync job and main.py loader so both read and write
repos/Template-Repo/.

In `@scripts/update_subtrees.py`:
- Around line 65-84: Make repository context synchronization transactional in
scripts/update_subtrees.py around the KNOWN_CONTEXT_FILES download loop: stage
downloads in a temporary location, validate that every expected file succeeds,
remove stale destination content, atomically publish the complete set, and fail
on unexpected sync errors. In context.py lines 23-26, report missing repository
context as an error rather than returning header-only content; in lines 38-45,
propagate file read failures or return an explicit incomplete-context status so
main.py cannot analyze incomplete context.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 17b911ba-57fb-4657-8bb3-0b3621da70a5

📥 Commits

Reviewing files that changed from the base of the PR and between 232a671 and b9aa240.

📒 Files selected for processing (6)
  • .github/workflows/sync-subtrees.yml
  • context.md
  • context.py
  • main.py
  • repo_metadata.py
  • scripts/update_subtrees.py
💤 Files with no reviewable changes (1)
  • context.md

Comment thread .github/workflows/sync-subtrees.yml
Comment thread .github/workflows/sync-subtrees.yml Outdated
Comment thread .github/workflows/sync-subtrees.yml Outdated
Comment thread context.py Outdated
Comment thread repo_metadata.py Outdated
Comment thread scripts/update_subtrees.py Outdated
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ This PR has merge conflicts.

Please resolve the merge conflicts before review.

Your PR will only be reviewed by a maintainer after all conflicts have been resolved.

📺 Watch this video to understand why conflicts occur and how to resolve them:
https://www.youtube.com/watch?v=Sqsz1-o7nXk

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/sync-subtrees.yml:
- Around line 36-38: Update update_subtrees.py so synchronization is
authoritative: when a source file is confirmed absent, remove its corresponding
file under repos/**, or stage each repository download and atomically replace
the existing repository directory only after the complete download succeeds.
Preserve existing files when synchronization fails or responses are not
confirmed absent, and ensure the workflow’s Run subtree context sync script uses
the corrected behavior.

In `@context.py`:
- Around line 65-68: Update the section assembly around context_parts.append and
total_chars so MAX_TOTAL_CHARS accounts for the complete rendered section: the
path header, content, newline separators, and optional truncation suffix.
Compute the section’s full length before appending it, then add that length to
total_chars while preserving loaded_files behavior.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: bd886137-75f7-4ea6-ba46-a4b6096a2e05

📥 Commits

Reviewing files that changed from the base of the PR and between b9aa240 and 26d9607.

📒 Files selected for processing (4)
  • .github/workflows/sync-subtrees.yml
  • context.py
  • main.py
  • repo_metadata.py

Comment thread .github/workflows/sync-subtrees.yml
Comment thread context.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Changes to backend code ci-cd CI/CD pipeline changes configuration Configuration file changes documentation Changes to documentation files github-actions GitHub Actions workflow changes needs-review no-issue-linked PR is not linked to any issue python Python code changes repeat-contributor PR from an external contributor who already had PRs merged size/L Large PR (201-500 lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant