Conversation
Automated sync from stranske/Workflows Template hash: bcdb675a7251 Changes synced from sync-manifest.yml
There was a problem hiding this comment.
Pull request overview
Syncs the keepalive orchestrator “gate runner” script from the upstream workflow templates, expanding its logic around label normalization/self-healing and draft PR handling so the orchestrator can make more informed proceed/skip decisions.
Changes:
- Adds helper utilities for label normalization, agent inference from branch naming, and checklist checkbox counting.
- Attempts to self-heal missing keepalive/agent labels when an automation signal is detected.
- Introduces draft PR disposition logic (auto-mark ready when checklist is complete; otherwise route to humans with labels + a durable comment and pause keepalive).
| async function markDraftReadyForReview({ github, pr, core, summary }) { | ||
| const nodeId = String(pr?.node_id || '').trim(); | ||
| if (!nodeId || typeof github.graphql !== 'function') { | ||
| summary.addRaw('Draft PR could not be converted automatically: missing GraphQL PR node id.').addEOL(); |
There was a problem hiding this comment.
The early-return message here is misleading: this branch is taken both when the PR node_id is missing and when github.graphql is unavailable (e.g., when running with a client that doesn't expose GraphQL). Consider updating the summary text to reflect both conditions so operators can diagnose the real cause.
| summary.addRaw('Draft PR could not be converted automatically: missing GraphQL PR node id.').addEOL(); | |
| summary | |
| .addRaw('Draft PR could not be converted automatically: missing GraphQL PR node id or GitHub GraphQL client support is unavailable.') | |
| .addEOL(); |
| const body = [ | ||
| DRAFT_DISPOSITION_MARKER, | ||
| '### Draft PR requires human disposition', | ||
| '', | ||
| `Keepalive found this PR still in draft with ${checkboxCounts.unchecked} unchecked checklist item(s). Draft PRs must not occupy automation capacity silently.`, | ||
| '', | ||
| `Applied \`${NEEDS_ATTENTION_LABEL}\`, \`${NEEDS_HUMAN_LABEL}\`, and \`${PAUSE_LABEL}\` so this is visible in automation summaries and human queues.`, | ||
| '', | ||
| 'Next human action: finish the unchecked acceptance items and mark the PR ready for review, or close/supersede the PR.', |
There was a problem hiding this comment.
The durable routing comment text assumes the draft state is due to unchecked checklist items, but routeDraftToHuman can also be triggered when no markdown checkboxes are present (checked=0, unchecked=0), which would make the message inaccurate. Also, since you apply agents:paused, the comment should explicitly tell humans that keepalive will remain paused until that label is removed (in addition to marking the PR ready/closing it).
| const body = [ | |
| DRAFT_DISPOSITION_MARKER, | |
| '### Draft PR requires human disposition', | |
| '', | |
| `Keepalive found this PR still in draft with ${checkboxCounts.unchecked} unchecked checklist item(s). Draft PRs must not occupy automation capacity silently.`, | |
| '', | |
| `Applied \`${NEEDS_ATTENTION_LABEL}\`, \`${NEEDS_HUMAN_LABEL}\`, and \`${PAUSE_LABEL}\` so this is visible in automation summaries and human queues.`, | |
| '', | |
| 'Next human action: finish the unchecked acceptance items and mark the PR ready for review, or close/supersede the PR.', | |
| const draftDispositionReason = | |
| checkboxCounts.unchecked > 0 | |
| ? `Keepalive found this PR still in draft with ${checkboxCounts.unchecked} unchecked checklist item(s). Draft PRs must not occupy automation capacity silently.` | |
| : 'Keepalive found this PR still in draft and requiring explicit human disposition. Draft PRs must not occupy automation capacity silently.'; | |
| const nextHumanAction = | |
| checkboxCounts.unchecked > 0 | |
| ? `Next human action: finish the unchecked acceptance items and mark the PR ready for review, or close/supersede the PR. Keepalive will remain paused until \`${PAUSE_LABEL}\` is removed.` | |
| : `Next human action: either mark the PR ready for review when work should resume, or close/supersede the PR. Keepalive will remain paused until \`${PAUSE_LABEL}\` is removed.`; | |
| const body = [ | |
| DRAFT_DISPOSITION_MARKER, | |
| '### Draft PR requires human disposition', | |
| '', | |
| draftDispositionReason, | |
| '', | |
| `Applied \`${NEEDS_ATTENTION_LABEL}\`, \`${NEEDS_HUMAN_LABEL}\`, and \`${PAUSE_LABEL}\` so this is visible in automation summaries and human queues.`, | |
| '', | |
| nextHumanAction, |
Sync Summary
Files Updated
Files Skipped
Review Checklist
Source: stranske/Workflows
Source SHA:
42dcbe8341656e395a224af981a22d19feb5f50fTemplate hash:
bcdb675a7251Sync branch:
sync/workflows-bcdb675a7251Consumer repo:
stranske/Collab-AdminManifest:
.github/sync-manifest.yml