feat(ci): add daily GitHub Action to update claude-agent-sdk#36
feat(ci): add daily GitHub Action to update claude-agent-sdk#36jeremyeder wants to merge 5 commits intomainfrom
Conversation
Adds a scheduled workflow that runs daily at 8 AM UTC to check PyPI for the latest claude-agent-sdk version and opens a PR if a newer version is available. https://claude.ai/code/session_01AF1ro2VAMS7WSb7QayTetZ
- Replace pip index with PyPI JSON API (curl+jq) — removes setup-python step - Add version format validation to reject unexpected PyPI responses - Use sort -V for proper semver comparison — prevents downgrade PRs - Escape dots in sed regex to avoid wildcard matches - Merge update and validate steps into one - Build PR body in a variable instead of inline heredoc - Add failure case to step summary - Use POSIX = instead of bash == in test expressions https://claude.ai/code/session_01AF1ro2VAMS7WSb7QayTetZ
|
I did this from my phone using the Claude App. |
This comment has been minimized.
This comment has been minimized.
- Pin actions/checkout to commit SHA (de0fac2e, v6.0.2) for supply chain security
- Move all ${{ steps.*.outputs.* }} into env: blocks to prevent expression injection
- Add concurrency group to prevent parallel workflow races
- Add timeout-minutes: 15 to the job
- Add --max-time 30 to curl for PyPI requests
- Replace silent 2>/dev/null || true with diagnostic echo on branch delete
- Remove --label "dependencies" flag (label may not exist in repo)
https://claude.ai/code/session_01AF1ro2VAMS7WSb7QayTetZ
Claude Code ReviewSummaryAdds a scheduled daily workflow that polls PyPI for claude-agent-sdk updates and opens an automated PR when a newer version is available. The implementation has been well-hardened across three commits (SHA-pinned action, expression injection mitigations, concurrency guard, timeout, curl timeout, --label fix). One functional gap remains before this is fully production-safe. Note: The previous automated review (now marked outdated) identified --label dependencies as Critical - this was correctly resolved in f526522. The review below reflects the current state of the PR. Issues by SeverityBlocker IssuesNone. Critical IssuesNone. Major Issues1. uv.lock is not updated alongside pyproject.toml components/runners/claude-code-runner/uv.lock exists and explicitly pins the dependency. The workflow only stages pyproject.toml (line 137). Every automated PR will leave uv.lock pointing to the old minimum version. CLAUDE.md specifies uv as the preferred package manager, and a committed lockfile implies reproducible installs. While runner-tests.yml currently uses pip install -e . (ignores the lock), tightening CI to uv sync --frozen would cause all future automated PRs to immediately fail their own test plan. Suggested fix: add a uv lock step before the commit and include uv.lock in git add. Minor Issues2. PR body markdown will not render correctly The multi-line PR_BODY variable is assigned inside an indented shell block (lines 146-161). All subsequent lines carry ~10 leading spaces from the shell indentation. CommonMark treats 4+ leading spaces as a preformatted code block, so headings and bullet points will render as raw text/code rather than formatted markdown in the generated PRs. 3. Stale-PR summary omits version and PR number When pr_exists=true the step summary (line 183) only says an open PR exists for the branch. Adding the existing PR URL and the version it targets would save an operator the manual lookup. 4. Version extraction regex is slightly permissive Line 54 uses [0-9][0-9.]* in sed, which can match strings ending in a dot or with consecutive dots. Risk is minimal since pyproject.toml is a controlled file, but mirroring the strict regex already used for LATEST would make both validations consistent. 5. sort -V tie-break behavior is non-obvious When CURRENT == LATEST, sort -V emits two identical lines and tail -1 returns one; the equality check is true, correctly reporting already-up-to-date. This is correct but a short comment would help future readers understand the equal-version edge case. Positive Highlights
Recommendations
🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs ambient-code#359, ambient-code#360) - not just generic code review guidelines. |
- Add uv lock regeneration step after pyproject.toml update to keep uv.lock in sync and prevent broken local dev environments - Include uv.lock in the auto-generated commit - Document GITHUB_TOKEN CI triggering limitation in auto-generated PR body (PRs created by GITHUB_TOKEN don't trigger pull_request workflows) - Add defensive default (|| 'false') for PR_EXISTS env in Summary step when existing_pr step is skipped - Fix PR body formatting via heredoc to avoid indentation artifacts https://claude.ai/code/session_01AF1ro2VAMS7WSb7QayTetZ
Claude Code ReviewSummaryThis PR adds a scheduled daily workflow to poll PyPI for Issues by Severity🚫 Blocker IssuesNone. 🔴 Critical IssuesNone. 🟡 Major IssuesNone. The previously flagged 🔵 Minor Issues1. - name: Regenerate uv.lock
run: |
pip install uv # no version pinAn unpinned
2. NEWEST=$(printf '%s\n%s' "$CURRENT" "$LATEST" | sort -V | tail -1)
if [ "$NEWEST" = "$CURRENT" ]; thenWhen 3. sed version extraction regex is slightly permissive sed 's/.*>=\([0-9][0-9.]*\).*/\1/'
4. Stale-PR summary branch message could be richer echo "An open PR for branch \`auto/update-claude-agent-sdk\` already exists." >> "$GITHUB_STEP_SUMMARY"Adding the existing PR URL (from 5. No post-lock verification After Positive Highlights
Recommendations
Overall this is well-crafted automation. The security hardening (SHA pin, injection prevention, concurrency) is thorough, the logic is sound, and the two substantive issues from prior reviews have been addressed. The remaining items are all minor polish — the workflow is functionally correct as-is. 🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs ambient-code#359, ambient-code#360) - not just generic code review guidelines. |
Replace `pip install uv` with `astral-sh/setup-uv` (SHA-pinned v7.3.0) which provides built-in caching keyed on uv.lock. This avoids re-downloading uv and re-resolving the dependency graph on each run. https://claude.ai/code/session_01AF1ro2VAMS7WSb7QayTetZ
Claude Code ReviewSummaryThis PR adds a daily GitHub Actions workflow that polls PyPI for the latest Issues by Severity🚫 Blocker IssuesNone. 🔴 Critical IssuesNone. 🟡 Major Issues1. Unverified action version comments The entire value of SHA-pinning is the tamper-evident audit trail. If the version comment is wrong, reviewers cannot verify the pin without running A mismatch between comment and SHA undermines the supply chain hygiene rationale for pinning. 2. LATEST=$(curl -sf --max-time 30 https://pypi.org/pypi/claude-agent-sdk/json | jq -r '.info.version')The LATEST=$(curl -f --max-time 30 https://pypi.org/pypi/claude-agent-sdk/json | jq -r '.info.version')🔵 Minor Issues3. The sed substitution only matches 4. No retry on transient PyPI failures A single attempt means a transient PyPI blip silently skips the day's check. The next scheduled run serves as implicit retry — acceptable — but a comment explaining this intentional design prevents it from looking like an oversight. 5. Maintainers can trigger manually but cannot specify a target version. An optional workflow_dispatch:
inputs:
version:
description: 'Force specific version (leave blank to use latest from PyPI)'
required: falsePositive Highlights
Recommendations
Review performed by Claude Code against project standards in CLAUDE.md and 🔍 View AI decision process (logs available for 90 days) 📋 View memory system files loaded (click to expand)What Amber Loaded for Code ReviewAmber automatically loaded these repository standards from the memory system:
Impact: This review used your repository's specific code quality standards, security patterns, and best practices from the memory system (PRs ambient-code#359, ambient-code#360) - not just generic code review guidelines. |
|
This is ready to go. It opens a PR to bump the sdk if we are behind. Alternative: let sdk version float and not intervene, let it break if its going to. I actually prefer the latter, but let's do this first. |
Adds a scheduled workflow that runs daily at 8 AM UTC to check PyPI
for the latest claude-agent-sdk version and opens a PR if a newer
version is available.
https://claude.ai/code/session_01AF1ro2VAMS7WSb7QayTetZ