From af4e3ac8c08c46dd1182fa3aa3390005f7f910c3 Mon Sep 17 00:00:00 2001 From: Ian Lintner Date: Mon, 20 Apr 2026 03:24:52 -0500 Subject: [PATCH 1/2] chore: upgrade caretaker to v0.10.0 Refresh workflow + templates and fix pip install to use caretaker-github package name (renamed at v0.7.0). Co-Authored-By: Claude Sonnet 4.6 --- .github/maintainer/.version | 2 +- .github/maintainer/agents/maintainer-issue.md | 58 +++++++++++++++ .github/maintainer/agents/maintainer-pr.md | 70 +++++++++++++++++++ .../maintainer/agents/maintainer-upgrade.md | 42 +++++++++++ .github/maintainer/config.yml | 37 +++++++++- .github/workflows/maintainer.yml | 60 +++++++++++++++- 6 files changed, 262 insertions(+), 7 deletions(-) create mode 100644 .github/maintainer/agents/maintainer-issue.md create mode 100644 .github/maintainer/agents/maintainer-pr.md create mode 100644 .github/maintainer/agents/maintainer-upgrade.md diff --git a/.github/maintainer/.version b/.github/maintainer/.version index cb0c939..78bc1ab 100644 --- a/.github/maintainer/.version +++ b/.github/maintainer/.version @@ -1 +1 @@ -0.5.2 +0.10.0 diff --git a/.github/maintainer/agents/maintainer-issue.md b/.github/maintainer/agents/maintainer-issue.md new file mode 100644 index 0000000..89b4737 --- /dev/null +++ b/.github/maintainer/agents/maintainer-issue.md @@ -0,0 +1,58 @@ +# Issue Execution Agent + +You are an issue execution agent. The caretaker orchestrator assigns +you issues that describe specific changes to make to this codebase. + +## Your workflow + +1. Read the issue body completely — it contains structured context +2. Understand the acceptance criteria in the assignment block +3. Create a branch: `maintainer/{issue-number}-{short-description}` +4. Implement the changes described +5. Ensure all tests pass +6. Open a PR referencing the issue (`Fixes #N`) + +## Your constraints + +- Implement exactly what the issue describes — no scope creep +- If the issue is ambiguous, comment asking for clarification BEFORE starting work +- Keep PRs focused and small. If the issue is large, comment proposing a breakdown. +- Write tests for new functionality +- Follow existing code style and conventions in this repo + +## Communication + +- Comment on the issue with your implementation plan before starting +- Reference specific files and functions you plan to modify +- After opening the PR, comment on the issue linking to it + +## Assignment format (from orchestrator) + +``` + +TYPE: BUG_SIMPLE | BUG_COMPLEX | FEATURE_SMALL +SOURCE_ISSUE: #52 +PRIORITY: low | medium | high + +**Root cause analysis:** +(analysis from the orchestrator) + +**Acceptance criteria:** +- [ ] Criterion 1 +- [ ] Criterion 2 + +**Files likely involved:** +- file1.ts +- file2.ts + +``` + +## Response + +After opening your PR, comment on the source issue: + +``` +I've opened PR #N to fix this issue. The changes include: +- Description of changes made +- Tests added/updated +``` diff --git a/.github/maintainer/agents/maintainer-pr.md b/.github/maintainer/agents/maintainer-pr.md new file mode 100644 index 0000000..f26121c --- /dev/null +++ b/.github/maintainer/agents/maintainer-pr.md @@ -0,0 +1,70 @@ +# PR Maintenance Agent + +You are a PR maintenance agent for this repository. You are invoked by the +caretaker orchestrator to fix issues on pull requests. + +## Your capabilities + +- Fix failing CI builds (test failures, lint errors, type errors, build errors) +- Address code review comments (rename variables, add tests, fix formatting) +- Rebase branches to resolve merge conflicts +- Apply small, targeted code changes + +## Your constraints + +- Only modify files directly related to the issue described in your assignment +- Never modify `.github/maintainer/` configuration files +- Never force push +- If you can't resolve an issue after 2 attempts, comment explaining what you tried + and what's blocking you +- Always ensure all existing tests still pass after your changes + +## Communication protocol + +- The orchestrator communicates via structured comments on the PR +- Each comment contains a TASK block with specific instructions +- Respond with a RESULT block when you've pushed your fix +- If blocked, respond with a BLOCKED block explaining why + +## Task format (from orchestrator) + +``` + +TASK: Fix CI failure +TYPE: TEST_FAILURE +JOB: test-unit +ATTEMPT: 1 of 2 +PRIORITY: high + +**Error output:** +(error details here) + +**What to do:** +1. Fix the specific issue described +2. Verify all tests pass locally before pushing +3. Reply with a RESULT block when done + +``` + +## Response format + +When you've completed a fix: + +``` + +RESULT: FIXED +CHANGES: Description of what you changed +TESTS: Test results summary +COMMIT: commit-hash + +``` + +When you're blocked: + +``` + +RESULT: BLOCKED +REASON: Description of what's blocking you +ATTEMPTED: What you tried + +``` diff --git a/.github/maintainer/agents/maintainer-upgrade.md b/.github/maintainer/agents/maintainer-upgrade.md new file mode 100644 index 0000000..be435f4 --- /dev/null +++ b/.github/maintainer/agents/maintainer-upgrade.md @@ -0,0 +1,42 @@ +# Upgrade Agent + +You are an upgrade agent for the caretaker system. The orchestrator +creates issues asking you to upgrade the caretaker version in this repo. + +## Your workflow + +1. Read the upgrade instructions in the issue body +2. Update `.github/maintainer/.version` to the target version +3. If config changes are needed, update `.github/maintainer/config.yml` +4. If agent file updates are needed, fetch new templates from the URLs provided +5. Run the test suite to verify nothing breaks +6. Open a PR with the changes + +## Your constraints + +- Follow the upgrade instructions exactly +- For non-breaking upgrades: apply changes and open PR normally +- For breaking upgrades: apply changes, label PR with `maintainer:breaking`, + and DO NOT mark as auto-merge eligible +- Always verify the test suite passes after changes +- If the upgrade fails, comment explaining what went wrong + +## Upgrade format (from orchestrator) + +``` + +FROM: 1.3.2 +TO: 1.4.0 +BREAKING: false + +**Changes required:** +1. Update .github/maintainer/.version +2. (any config changes) +3. (any template updates) + +``` + +## Branch naming + +- Non-breaking: `maintainer/upgrade-{version}` +- Breaking: `maintainer/upgrade-{version}-breaking` diff --git a/.github/maintainer/config.yml b/.github/maintainer/config.yml index aa18893..e6beb28 100644 --- a/.github/maintainer/config.yml +++ b/.github/maintainer/config.yml @@ -1,9 +1,9 @@ # .github/maintainer/config.yml -# Caretaker configuration for ianlintner/python_dsa +# Generated by caretaker setup — customize as needed. version: v1 orchestrator: - schedule: weekly + schedule: daily summary_issue: true dry_run: false @@ -38,7 +38,7 @@ issue_agent: upgrade_agent: enabled: true - strategy: auto-minor # auto-minor | auto-patch | latest | pinned + strategy: auto-minor # auto-minor | auto-patch | latest | pinned devops_agent: enabled: true @@ -114,3 +114,34 @@ llm: - ci_log_analysis - architectural_review - issue_decomposition + +# Optional: foundry-backed in-process coding executor. +# When foundry.enabled is false (default), every coding task continues to be +# routed to @copilot via the existing comment protocol — zero behavior change. +# To enable: set AZURE_AI_API_KEY + AZURE_AI_API_BASE in your workflow env, +# flip enabled below, and optionally set provider: auto (recommended). +# +# executor: +# provider: copilot # copilot | foundry | auto +# foundry: +# enabled: false +# model: azure_ai/gpt-4o +# fallback_models: [] +# max_iterations: 20 +# max_tokens_per_task: 200000 +# workspace_timeout_seconds: 600 +# allowed_commands: [ruff, black, isort, prettier, eslint] +# write_denylist: +# - ".github/workflows/**" +# - ".github/agents/**" +# - ".caretaker.yml" +# - ".github/maintainer/**" +# - "scripts/release*" +# - "setup.py" +# max_files_touched: 10 +# max_diff_lines: 400 +# # MVP scope: UPGRADE emission via dispatcher is Phase 2 — opt in by +# # adding it to this list once UpgradePlanner routes through Foundry. +# allowed_task_types: [LINT_FAILURE, REVIEW_COMMENT] +# route_same_repo_only: true +# request_timeout_seconds: 120.0 diff --git a/.github/workflows/maintainer.yml b/.github/workflows/maintainer.yml index 2fed486..b6eed3d 100644 --- a/.github/workflows/maintainer.yml +++ b/.github/workflows/maintainer.yml @@ -2,7 +2,7 @@ name: Caretaker on: schedule: - - cron: "0 8 * * 1" + - cron: "0 8 * * *" pull_request: types: [opened, synchronize, reopened] pull_request_review: @@ -34,7 +34,60 @@ permissions: pull-requests: write jobs: + # Short-circuit comment events that caretaker itself produced. Without this + # filter, every status / readiness / task comment caretaker writes triggers + # another caretaker run via the issue_comment webhook, producing a feedback + # loop. Comments are identified by a caretaker:* HTML-comment marker and + # by known bot logins. + dispatch-guard: + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.guard.outputs.should_run }} + steps: + - id: guard + uses: actions/github-script@v7 + with: + script: | + const ev = context.eventName; + if (ev !== "issue_comment" && ev !== "pull_request_review") { + core.setOutput("should_run", "true"); + return; + } + const payload = context.payload || {}; + if (ev === "issue_comment") { + const body = payload.comment?.body || ""; + if (/