Commit Graph
745 Commits
Author SHA1 Message Date
2988cbe14a docs: map custom_instructions to --append-system-prompt (#1480) (#1484)
* docs: map custom_instructions to --append-system-prompt (#1480)

The v1 migration guide mapped the v0 `custom_instructions` input to
`claude_args: --system-prompt`, but these have different semantics:
`custom_instructions` *appended* to Claude Code's default system prompt,
while `--system-prompt` *replaces* it entirely. Users who followed the
guide silently lost the whole built-in system prompt (tool-usage guidance,
sub-agent conventions, etc.), keeping only their few custom lines.

Fixes #1480:
- Map `custom_instructions` -> `--append-system-prompt` (matches v0 append
  semantics) in the deprecated-inputs table, the migration example, and the
  checklist.
- Correct the claude_args options table: `--system-prompt` replaces the
  entire prompt; add an `--append-system-prompt` row for append behavior.

Docs-only; no code changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* docs: fix remaining custom_instructions migration references (#1480)

Update usage.md, faq.md, and configuration.md to map custom_instructions
to --append-system-prompt, matching the migration-guide fix. The
override_prompt row is left unchanged since replacement semantics may be
intended there.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-15 20:35:32 -07:00
a1c0599a9c fix(format): filter out thinking_tokens system messages from step summary (#1479)
## Summary

Signed-off-by: anish <anishesg@users.noreply.github.com>
Co-authored-by: anish <anishesg@users.noreply.github.com>
2026-07-15 20:27:23 -07:00
5bfa96a5b0 fix: allow leading underscore in branch names (valid per git-check-ref-format) (#1486)
Branch names starting with an underscore (e.g. _release/v1.2.3) are valid
per git check-ref-format but were rejected by validateBranchName's
first-character whitelist. Since setupBranch validates a PR's baseRefName
after checkout, the action failed on every open PR targeting such a
branch. A leading underscore carries no option-injection risk (only a
leading dash does, which is still rejected separately).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 20:27:12 -07:00
Jianke LINandGitHub 214a70611b fix: map claude_args model to SDK options (#1474) 2026-07-15 20:22:15 -07:00
5f509a1c1f fix(sanitizer): strip alt text from reference-style markdown images (#1488)
stripMarkdownImageAltText removed alt text from inline images
(![alt](url)) but not reference-style images (![alt][ref]), because the
regex requires the "](" of the inline form. Alt text is a
hidden-instruction channel that reaches the prompt via sanitizeContent,
so the reference-style form let it survive.

Add a matching replace for the reference-style form (![alt][ref] ->
![][ref]), preserving the [ref] label so the image definition still
resolves. Adds regression tests.

Co-authored-by: Contributor <you@example.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-15 20:21:12 -07:00
PaarthandGitHub e64308ff97 fix: sanitize {{label}} in branch name templates (#1492)
A scoped label like area:permissions was substituted into the branch
name verbatim, producing a ":" that validateBranchName rejects. Because
the branch setup block catches that error and calls process.exit(1), the
whole run died. {{description}} was already sanitized via extractDescription;
{{label}} was the only free-text variable that skipped it.

Add a sanitizeLabel helper (replaces invalid-char runs with a hyphen so
scoped labels stay readable) and apply it before substitution, falling back
to entityType when a label sanitizes to empty. Adds regression tests that
also assert the result passes validateBranchName.
2026-07-15 20:21:02 -07:00
58dc33d9ad test: cover prepareContext validation error branches (#1460)
* test: cover prepareContext validation error branches

create-prompt.test.ts exercised only happy paths; the ~20 validation
guards in prepareContext (missing PR_NUMBER, unsupported event type,
unsupported issue action, missing claude branch, etc.) had no coverage.

Adds a "prepareContext validation errors" block asserting the thrown
messages for the reachable guards, using the existing createMockContext
helper.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test: cover comments/common link and body builders

`src/github/operations/comments/common.ts` had no direct test coverage,
though its exports are live code used by create-initial.ts and
update-with-branch.ts. This adds unit tests for all four exports:
SPINNER_HTML, createJobRunLink, createBranchLink, and createCommentBody.

Assertions are built from the imported GITHUB_SERVER_URL so they hold on
GHES as well as github.com. Pure test additions — no production changes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-15 20:20:53 -07:00
evol1228andGitHub ae650f8355 docs: fix dead example links in custom-automations.md (#1513) 2026-07-15 20:18:08 -07:00
GitHub Actions 1298632ce7 chore: bump Claude Code to 2.1.211 and Agent SDK to 0.3.211 v1.0.175 2026-07-15 23:10:52 +00:00
GitHub Actions 1253134445 chore: bump Claude Code to 2.1.210 and Agent SDK to 0.3.210 v1.0.174 2026-07-14 23:46:09 +00:00
NickNojiriandGitHub 4f07c81564 fix(sanitizer): redact GitHub user-to-server (ghu_) tokens (#1502)
redactGitHubTokens covers ghp_, gho_, ghs_, ghr_, and github_pat_
tokens but misses ghu_ (GitHub App user-to-server tokens), one of the
documented GitHub token prefixes. A ghu_ token appearing in issue or
PR content passed through sanitization unredacted.

Add the ghu_ pattern, mirroring the existing 40-character token
patterns, with unit tests including the git-credential URL form.
2026-07-14 13:06:18 -07:00
GitHub Actions f1bd27ca5b chore: bump Claude Code to 2.1.209 and Agent SDK to 0.3.209 v1.0.173 2026-07-14 06:36:42 +00:00
GitHub Actions a08f8913d5 chore: bump Claude Code to 2.1.208 and Agent SDK to 0.3.208 v1.0.172 2026-07-14 01:11:18 +00:00
972a512078 fix(sdk): fail step when result has is_error:true despite success subtype (#1496)
Treat subtype success with is_error:true as a failed run so CI does not
show a misleading green check when the review never actually ran.

Fixes #1495

Co-authored-by: syf2211 <syf2211@users.noreply.github.com>
2026-07-13 09:01:51 -07:00
GitHub Actions e90deca476 chore: bump Claude Code to 2.1.207 and Agent SDK to 0.3.207 v1.0.171 2026-07-11 00:52:42 +00:00
GitHub Actions 536f2c32a3 chore: bump Claude Code to 2.1.206 and Agent SDK to 0.3.206 v1.0.170 2026-07-09 23:35:14 +00:00
GitHub Actions 37b464ce72 chore: bump Claude Code to 2.1.205 and Agent SDK to 0.3.205 v1.0.169 2026-07-08 21:22:46 +00:00
GitHub Actions ba0aafd430 chore: bump Claude Code to 2.1.204 and Agent SDK to 0.3.204 v1.0.168 2026-07-08 00:28:40 +00:00
GitHub Actions 0fe28cdb64 chore: bump Claude Code to 2.1.203 and Agent SDK to 0.3.203 v1.0.167 2026-07-07 21:07:00 +00:00
GitHub Actions f87768c6d2 chore: bump Claude Code to 2.1.202 and Agent SDK to 0.3.202 v1.0.166 2026-07-06 22:52:16 +00:00
Ashwin BhatandGitHub 58a2944bbc chore: fix prettier formatting (#1463) 2026-07-04 09:31:09 -07:00
Akhilesh AroraandGitHub beb753ed72 fix: propagate curl failures in install pipeline (#1241)
installClaudeCode() pipes `curl -fsSL | bash -s --`. Bash exits with
the status of the last command, so when curl fails (429 rate limit,
403, or connection error) `bash -s` still exits 0 on empty stdin and
the action logs "Claude Code installed successfully". The 3-attempt
retry loop never triggers because the first attempt looks successful,
and the run later dies with "Executable not found in $PATH: claude".

Prefix the pipeline with `set -o pipefail;` so curl's non-zero exit
propagates through the pipe and the retry loop can actually kick in.
Extracted into buildInstallCommand() with regression tests covering
both the old buggy shape and the fixed one.
2026-07-03 22:38:53 -07:00
JerryLeeandGitHub 235b39bf21 fix: preserve repeated add-dir flags in claude args (#1256) 2026-07-03 22:38:30 -07:00
石岳峰andGitHub d060ddc963 fix(restore): handle symlinked CLAUDE.md paths during config snapshot (#1441)
When snapshotting PR-authored sensitive paths into .claude-pr/, cpSync with
dereference:true throws ENOENT if a symlink target is missing on the PR head
(e.g. .claude/CLAUDE.md -> ../AGENTS.md). Fall back to copying the symlink
itself so restoreConfigFromBase can continue and restore trusted base versions.

Fixes #1398
2026-07-03 22:38:23 -07:00
tarunag10andGitHub 0f07aee435 Use modern noreply email for co-author trailers (#1369) 2026-07-03 22:38:02 -07:00
a221ad2dd9 Drop buffered inline comment when it is posted live (#1405) (#1412)
When classify_inline_comments is enabled, create_inline_comment buffers calls
without confirmed=true. The model frequently re-issues the call with confirmed=true
after reading the buffered reply, which posts the comment live but leaves the
original buffered entry behind. The post-session replay step then posts it again,
so every inline comment lands twice.

Reconcile the buffer on a live post: after a confirmed comment is created, remove
any buffered entry matching the same path, line, startLine and body so it cannot be
replayed. Extracts the reconciliation into src/mcp/inline-comment-buffer.ts (the MCP
server module starts a server on import) and adds unit tests.

Co-authored-by: archievi <13202986+archievi@users.noreply.github.com>
2026-07-03 22:37:36 -07:00
GitHub Actions 558b1d6cab chore: bump Claude Code to 2.1.201 and Agent SDK to 0.3.201 v1.0.165 2026-07-03 23:51:09 +00:00
GitHub Actions 01872ccc02 chore: bump Claude Code to 2.1.200 and Agent SDK to 0.3.200 v1.0.164 2026-07-03 16:53:31 +00:00
GitHub Actions 769e3bdff9 chore: bump Claude Code to 2.1.199 and Agent SDK to 0.3.199 v1.0.163 2026-07-02 23:36:20 +00:00
GitHub Actions 6c0083bb72 chore: bump Claude Code to 2.1.198 and Agent SDK to 0.3.198 v1.0.162 2026-07-01 20:46:29 +00:00
846d5d8993 Add agent-approval-check composite action (#1429)
* Add agent-approval-check composite action

Require N human approvals on PRs that contain agent-authored commits.
Posts an agent-approval-check commit status that repos mark as a
required check on protected branches.

This is a sanitized port of the check Anthropic runs internally on
every agent-authored PR — same detection rules, /approve <sha>
comment flow, sibling-PR-same-SHA guard, and fail-closed semantics,
with the Anthropic-specific path exemptions and kill-switch removed
and config moved to action inputs.

Co-Authored-By: Claude <noreply@anthropic.com>

* Drop stray internal acronym from comment

* agent-approval-check: require write-access approvers, pin deps, pagination + doc fixes

🏠 Remote-Dev: homespace

* agent-approval-check: prettier

🏠 Remote-Dev: homespace

* agent-approval-check: verify approver write permission via REST; commits(last:100); docstring

🏠 Remote-Dev: homespace

* agent-approval-check: use headRefOid; drop pull_request_review trigger and correct threat-model docs

🏠 Remote-Dev: homespace

* agent-approval-check: stale-notification wording, no-retry-on-4xx, docstring API-call count

🏠 Remote-Dev: homespace

* agent-approval-check: fail-closed sibling guard on commits-ordering edge; drop stale 'reviewed' from README

🏠 Remote-Dev: homespace

* agent-approval-check: drop hardcoded API-call counts from logs; clarify author write-access requirement in README

🏠 Remote-Dev: homespace

* agent-approval-check: count all agent-email commits (close-reopen bypass); validate REQUIRED_APPROVALS>=1; exempt_head_branches warning

🏠 Remote-Dev: homespace

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Octavian Guzu <oct@anthropic.com>
2026-06-30 14:09:57 -07:00
GitHub Actions fad22eb3fa chore: bump Claude Code to 2.1.197 and Agent SDK to 0.3.197 v1.0.161 2026-06-30 17:57:23 +00:00
GitHub Actions 4633baf526 chore: bump Claude Code to 2.1.196 and Agent SDK to 0.3.196 v1.0.160 2026-06-29 23:27:52 +00:00
GitHub Actions a92e7c70a4 chore: bump Claude Code to 2.1.195 and Agent SDK to 0.3.195 v1.0.159 2026-06-26 21:30:09 +00:00
tarunag10andGitHub f8076dc008 fix: bound app token revocation cleanup (#1437) 2026-06-25 20:57:44 -07:00
GitHub Actions 5211368122 chore: bump Claude Code to 2.1.193 and Agent SDK to 0.3.193 v1.0.158 2026-06-25 21:46:38 +00:00
GitHub Actions 428971d2ec chore: bump Claude Code to 2.1.191 and Agent SDK to 0.3.191 v1.0.157 2026-06-24 21:59:09 +00:00
GitHub Actions 74eedf1a18 chore: bump Claude Code to 2.1.190 and Agent SDK to 0.3.190 v1.0.156 2026-06-24 15:55:36 +00:00
GitHub Actions 80b3182633 chore: bump Claude Code to 2.1.187 and Agent SDK to 0.3.187 v1.0.155 2026-06-23 21:05:06 +00:00
360be9c8fc fix: allow @ in branch names (valid per git-check-ref-format) (#1411)
`validateBranchName` rejects branch names containing `@`, even though
`git check-ref-format` permits `@` and GitHub itself accepts such
branches. PRs whose head or base branch contains an `@` fail validation
in-process before any git operation, so the action errors out
immediately.

Branch names with `@` show up in real workflows: ticket conventions
like "TICKET-123@add-feature" (#998), leading-prefix conventions like
"@hotfix/...", and agent tooling that appends "@<sessionid>" (#1305).
There is no workaround other than renaming the branch, which is often
not under the user's control.

Branch names are never passed through a shell (git calls use
execFileSync argv arrays), so `@` carries no injection risk. This is
the same reasoning used to add `#` in #1167, `+` in #1248, and `,` in
#1310. The bare name "@" (HEAD shorthand in git revision syntax) and
the "@{" reflog sequence are still rejected.

- Add `@` to the validateBranchName whitelist regex, including the
  leading position (the leading-character rule blocks option injection
  via `-`, which `@` cannot cause)
- Reject the bare name "@" with a dedicated check
- Update the surrounding comment, JSDoc, and error message to match
- Add test cases for @-containing names and bare "@"

Fixes #998

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-06-22 14:42:36 -07:00
e452eb9dce test: cover format-turns content-type fallbacks and system_other handling (#1421)
Adds unit tests for previously-uncovered branches in
src/entrypoints/format-turns.ts:

- detectContentType: malformed-JSON fall-through (objects and arrays)
  and the default python classification for non-python/non-js code
- formatResultContent: non-string inputs (number, plain object)
- groupTurnsNaturally / formatGroupedContent: the system_other path
  for non-init system turns

Tests only; no source changes. format-turns.ts line coverage rises
from ~86% and the file's non-CLI logic is now fully exercised.

Co-authored-by: hk <solanamobilech@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 14:41:41 -07:00
Steven Zimmerman, CPAandGitHub 6b8063043e fix: filter PR reviews and inline review comments to trigger time (#1385)
Issue/PR comments (#512) and the issue/PR body (#710) are filtered to the
trigger timestamp so content created or edited after an authorized trigger
cannot be injected into Claude's prompt (TOCTOU protection). Reviews and
inline review comments were not: fetchGitHubData returned reviewData filtered
by actor only, and formatReviewComments renders it into the prompt, so a
review submitted or edited after the trigger reached Claude verbatim.

filterReviewsToTriggerTime already existed (added alongside the comment filter
in #512) but was only wired to the image-download list, never to the returned
reviewData.

Filter reviewData.nodes through filterReviewsToTriggerTime and each review's
inline comments through filterCommentsToTriggerTime, alongside the existing
actor filter, then build the review image-processing lists from those
already-filtered nodes (removing a now-redundant second filter pass).
Strengthen the two integration tests to assert post-trigger and edited-after
reviews/comments are dropped.
2026-06-22 14:41:33 -07:00
GitHub Actions 30544b6743 chore: bump Claude Code to 2.1.186 and Agent SDK to 0.3.186 v1.0.154 2026-06-22 20:38:23 +00:00
GitHub Actions 2fee155104 chore: bump Claude Code to 2.1.185 and Agent SDK to 0.3.185 v1.0.153 2026-06-20 21:00:13 +00:00
GitHub Actions 51705da45e chore: bump Claude Code to 2.1.183 and Agent SDK to 0.3.183 v1.0.152 2026-06-19 01:21:31 +00:00
GitHub Actions 806af32823 chore: bump Claude Code to 2.1.181 and Agent SDK to 0.3.181 v1.0.151 2026-06-17 22:08:47 +00:00
Ryan NoonanandGitHub 0a08a86780 fix: skip workflow validation token exchange failures (#1417) 2026-06-17 13:53:35 -07:00
GitHub Actions 9dd8b95a39 chore: bump Claude Code to 2.1.179 and Agent SDK to 0.3.179 v1.0.150 2026-06-16 20:23:28 +00:00
GitHub Actions 4d7e1f0cd8 chore: bump Claude Code to 2.1.178 and Agent SDK to 0.3.178 v1.0.149 2026-06-15 21:37:45 +00:00
3d9f0dc7dc fix(mcp): align allowed-tools parser with SDK option parser (#1373)
parseAllowedTools (used to decide which GitHub MCP servers to install)
hand-rolled a regex parse of claude_args, while the tools actually
granted to Claude are parsed by parseClaudeArgsToExtraArgs in
base-action/src/parse-sdk-options.ts using shell-quote. The two parsers
diverged on two inputs (#1357):

- Multiple values after a single flag: for
  `--allowedTools "Read" "Grep" "mcp__github__get_commit"` the regex
  captured only "Read", so the github MCP server was not installed even
  though mcp__github__get_commit was granted — tool calls then failed.
- Commented-out lines: the regex counted tools on `#`-prefixed lines
  that the SDK parser strips, installing servers that were never used.

Reimplement parseAllowedTools on the same shell-quote tokenizer and the
same "accumulating flag consumes all consecutive non-flag values"
semantics, stripping comment lines first, so the install decision agrees
with the tools that are actually granted. Unquoted glob patterns (e.g.
`mcp__github__*`), which shell-quote yields as glob objects, are
recovered to their literal text to preserve existing behavior.

Closes #1357

Co-authored-by: bymle <229636660+bymle@users.noreply.github.com>
2026-06-13 22:49:34 -07:00