Repository navigation
feat(ci): sweep both status:needs-human-merge and status:needs-info every 4h - #335
Conversation
…cklog docs/agent-team-pipeline.md's state machine ends most risk:high PRs at status:needs-human-merge — correct by design, but until now that backlog only got cleared when a human noticed it and manually asked Claude Code to review + merge each one (as happened this session for PRs #327 and #324, plus closing #292 and #326 as stale/superseded along the way). This adds a new, separate workflow that automates the noticing, not the judgment: - human-merge-sweep.yml: schedule-triggered (every 4 hours) + workflow_dispatch for manual testing. Plain GITHUB_TOKEN — merging/ closing PRs isn't blocked by this repo's "Actions can't create/approve PRs" setting the way *opening* one is (principal-review.yml's own auto-merge step already proves this), so no App-token minting needed. - human-merge-sweep-agent.md: the actual review persona. Re-verifies each status:needs-human-merge PR is still current (stale/conflicting PRs get closed with an explanation if genuinely superseded, left alone if ambiguous), does a real second review (reads the whole diff, cross- checks claims against ground truth, checks for vacuous tests) before merging, and separately sweeps ALL open PRs for the same staleness pattern regardless of label. Hard rule, not a judgment call: never merges anything touching .github/workflows/**, .github/agent-policy.yml, or .claude/agents/** — that class of change always needs a human directly, however clean it looks. - human-merge-sweep-log.md: audit trail, same spirit as auto-merge-log.md but for this human-merge-routed path instead of the risk:low auto-merge path. This PR itself is exactly the kind of change its own new agent is hard-coded to never touch (.github/workflows/**, .claude/agents/**) — by design, flagging it plainly rather than leaving that as an implicit assumption: needs a human's own read, this session will not self-merge it even if CI is green. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
|
Automated pipeline health check: This PR needs a human look — it doesn't match any of the 5 known failure patterns, and it's also a case where self-healing is hard-blocked regardless.
Not self-healing (no safe action applies here either way) — flagging so a human applies the appropriate label and reviews it directly, same as recommended for #170/#217/#334. Generated by Claude Code |
status:needs-human-merge isn't the only place the pipeline parks work on a human — status:needs-info (issue triage that's underspecified, or a PR whose QA/review run crashed or hit workflow-file drift) blocks on a human just as silently, and was out of scope for the sweep as first built. Adds Part 3 to human-merge-sweep-agent.md, deliberately more conservative than Parts 1-2 given how different the task is — "is this safe to merge/close" is a mechanical check, "does this actually need a human" is not: - Detects when status:needs-info was applied because the *pipeline* crashed (turn budget exhausted, workflow-file drift) rather than because there's a real open question, and retries the stage that crashed — at most once per item, logged to human-merge-sweep-log.md same as a merge. - For everything else — the default assumption, not an edge case — never answers, never changes a label, never invents scope. Only ever ensures a clear comment exists naming the actual open question, so a human can answer faster. - Hard-excludes anything labeled security/release-blocker (agent-policy.yml's sensitive_issue_labels) from all autonomous action, including investigation. Bumped --max-turns 120→160 (three backlogs to work per run now, not two) and broadened human-merge-sweep-log.md's scope/column naming (PR → Item) to cover issues and retries alongside merges/closes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
Principal review — PR #335 (
|
Two CONFIRMED findings from principal review of PR #335's own diff: - permissions: was missing id-token: write. Every sibling workflow invoking claude-code-action carries this with an identical comment citing issue #158 ("Could not fetch an OIDC token" after 3 retries) — missed here, and continue-on-error: true on the agent step would have swallowed the failure silently, forever, every 4 hours. - Part 3's retry action re-applies status:ready-for-dev/needs-qa/ needs-review to restart a crashed pipeline stage — that label change must trigger the corresponding workflow, which a plain GITHUB_TOKEN cannot do (see docs/agent-team-pipeline.md's "Cross-workflow triggering"; pr-intake.yml already mints an App token for exactly this reason). Fixed by minting the same pipeline App token and passing it to the agent step as a distinctly-named PIPELINE_APP_TOKEN, with explicit instructions (both in the workflow prompt and the persona file) that it's used for that one action only — everything else stays on the default GH_TOKEN, unchanged. Also tightened the retry-dedup check flagged as a plausible weak point: "grep the comment history for retry text" is now "grep for an exact <!-- human-merge-sweep-retry --> marker, always the first line of the retry comment" — an exact string match instead of a fuzzy read. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
Principal review (round 2) — verifying fix commit
|
…344) Previously a manually-opened PR with no resolvable "Closes #N" line exited pr-intake.yml's guard early with no risk:*/status:* label applied at all, requiring a human to notice and hand-label it (as happened for PRs #326, #335, #342). Now it still runs classify_pr_risk.py and routes into the pipeline — status:needs-qa when an issue is linked (unchanged), status:needs-review when it isn't, since qa-agent.yml hard-stops on a missing linked issue (no acceptance criteria to check) while principal-review.yml already tolerates one gracefully. Closes #343 Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
What
Every 4 hours, clears both places
docs/agent-team-pipeline.md's state machine parks work on a human:status:needs-human-merge— re-verify each PR is still current, run a genuine second review, merge what's clean, close what's gone stale/conflicting/superseded.status:needs-info— a deliberately more conservative task, added after the original PR here was already reviewed once (see commit history). Moststatus:needs-infoitems are a real question only a human can answer (scope, product intent, anything security-sensitive) — the sweep never guesses at those. It only acts when the label was applied because the pipeline itself got stuck (a crashed run, workflow-file drift) rather than because there's an actual open question: in that case it retries the stage that crashed, once, and leaves a comment explaining why. Everything else either already has a clear explanation for the human, or gets one added if it didn't. Anything also labeledsecurity/release-blocker(agent-policy.yml'ssensitive_issue_labels) gets zero autonomous action, not even investigation.This was requested directly, same as the original scope: the human-merge gate is correct by design, but in practice both backlogs only got cleared when a human noticed and asked for a manual pass — which is what happened this session for PRs #327 and #324 (merge backlog) plus this exact addition for the info backlog.
What's here
human-merge-sweep.yml— unchanged trigger/auth from the original PR (scheduleevery 4h +workflow_dispatch, plainGITHUB_TOKEN).--max-turnsraised 120→160 for the extra backlog.human-merge-sweep-agent.md— new Part 3 (needs-info), described above. Parts 1-2 (merge backlog + general staleness sweep) unchanged from the original review.human-merge-sweep-log.md— broadened to cover needs-info retries alongside merges/closes (column renamed PR → Item); plain clarifying comments don't get a log row since they change nothing and are already visible in place.docs/agent-team-pipeline.mdaddendum updated to describe both backlogs.Hard-coded limits (not left to judgment) — unchanged plus new ones for Part 3
.github/workflows/**,.github/agent-policy.yml, or.claude/agents/**.dev; never deletes a branch other than one it just merged.status:blockedand the repo-wideAGENTS_PAUSEDkill switch.Risk
Same as before, restated because it's still true after this addition: this PR is exactly the kind of change its own agent is hard-coded to never touch.
.github/workflows/**and.claude/agents/**are bothsensitive_pathsentries,classify_pr_risk.pywill forcerisk:high, and this session will not self-merge it even if CI is green.🤖 Generated with Claude Code