Add agent/working label to track active agent runs - #29
Conversation
Implements automatic agent/working label management across all three gh-aw workflows (drafter, review, fix) to provide visibility into which issues/PRs currently have agents actively working on them. Each workflow now includes two new jobs: - add_working_label: Runs after pre_activation succeeds and adds the agent/working label (to issues for drafter, to PRs for review/fix) - remove_working_label: Runs at the end with if: always() to remove the label regardless of success or failure The jobs use the GitHub App token (same pattern as merge.yml) and plain GitHub Actions steps, not gh-aw's safe-outputs mechanism, ensuring cleanup happens even if the agent job fails or times out. README.md updated to: - Add agent/working to the repository setup checklist (now 5 labels) - Document the label tracking mechanism in "Design notes and gotchas" - Note that these .lock.yml modifications are manual and will be lost if workflows are recompiled Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Review Feedback
The implementation is excellent and correct. The workflow YAML changes are well-structured with proper job dependencies, permissions, and error handling. However, there's one documentation error that needs to be corrected:
Documentation Error
Location: README.md:201-202 (in the "Repository setup checklist" section)
Issue: The cross-reference direction is incorrect. The text currently says:
(see "Agent working label tracking" below)But the referenced section ("Agent working label tracking uses manual .lock.yml jobs") appears earlier in the document (lines 98-107) in the "Design notes and gotchas" section, not later.
Fix required: Change "below" to "above":
(see "Agent working label tracking" above)What I Checked
✅ Workflow YAML syntax and structure
✅ Job dependencies and conditional execution
✅ Permissions (issues vs pull-requests)
✅ GitHub App token usage pattern
✅ Issue vs PR context handling
✅ Error handling and cleanup logic
✅ Security considerations
✅ Documentation completeness
Everything else looks great. Once the cross-reference is corrected, this will be ready to merge.
|
Closing without merging. The approach here is functionally correct — the gh-aw supports exactly this kind of always-run cleanup job natively via a A proper fix redone at the source level will follow in a separate PR referencing #26. |
PR #29 implemented this by hand-editing the compiled .lock.yml output directly, which is a dead end: .lock.yml files are regenerated from the .md sources on every `gh aw compile`, so the next recompile of any of these three workflows would silently revert the hand-edit with no error. See #24. gh-aw supports this natively: a custom job in frontmatter that depends on pre_activation (rather than activation) gets automatically threaded into activation's own needs by the compiler, so agent - which already depends on activation - transitively waits for it without any extra wiring. add_working_label uses this to apply the label right after the membership/permission gate passes. remove_working_label depends directly on the same jobs conclusion itself depends on (activation, agent, detection, safe_outputs) with `if: always()`, since gh-aw's compiler unconditionally makes conclusion depend on every other job in the workflow - a custom job that itself needs conclusion would create a needs cycle. Both jobs use plain GitHub Actions steps with the same GitHub App token pattern as merge.yml, not safe-outputs: safe-outputs handlers only run when the agent job succeeds, which can't guarantee the label is removed on agent failure or timeout. Also make add_working_label best-effort (|| true), matching remove_working_label, so a transient labeling failure never blocks the actual agent run. Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
PR #29 implemented this by hand-editing the compiled .lock.yml output directly, which is a dead end: .lock.yml files are regenerated from the .md sources on every `gh aw compile`, so the next recompile of any of these three workflows would silently revert the hand-edit with no error. See #24. gh-aw supports this natively: a custom job in frontmatter that depends on pre_activation (rather than activation) gets automatically threaded into activation's own needs by the compiler, so agent - which already depends on activation - transitively waits for it without any extra wiring. add_working_label uses this to apply the label right after the membership/permission gate passes. remove_working_label depends directly on the same jobs conclusion itself depends on (activation, agent, detection, safe_outputs) with `if: always()`, since gh-aw's compiler unconditionally makes conclusion depend on every other job in the workflow - a custom job that itself needs conclusion would create a needs cycle. Both jobs use plain GitHub Actions steps with the same GitHub App token pattern as merge.yml, not safe-outputs: safe-outputs handlers only run when the agent job succeeds, which can't guarantee the label is removed on agent failure or timeout. Also make add_working_label best-effort (|| true), matching remove_working_label, so a transient labeling failure never blocks the actual agent run. Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
Summary
Implements automatic
agent/workinglabel management to all three gh-aw workflows (drafter, review, fix) to provide visibility into which issues/PRs currently have agents actively working on them.Changes
Workflow modifications
Each workflow now includes two new jobs:
add_working_label- Runs afterpre_activationsucceeds and adds theagent/workinglabel:drafter.lock.yml: Adds label to the issuereview.lock.ymlandfix.lock.yml: Adds label to the pull requestremove_working_label- Runs at the end withif: always()to remove the label regardless of success or failureThe jobs use the GitHub App token (same pattern as
merge.yml) and plain GitHub Actions steps, not gh-aw's safe-outputs mechanism. This ensures cleanup happens even if the agent job fails or times out.Documentation updates
Updated
README.mdto:agent/workingto the repository setup checklist (now 5 labels instead of 4).lock.ymlmodifications are manual and will be lost if workflows are recompiledValidation
Changes validated by:
needs:dependenciesif: always()condition ensures cleanup runs in all casesgh issue edit, review/fix usegh pr edit)merge.ymlfor GitHub App token usageImportant note
The
.lock.ymlfiles are normally auto-generated bygh aw compile. These changes are manual modifications to the compiled output and will be overwritten if the workflows are recompiled. The README now documents this and explains that these jobs need to be manually re-added after any recompilation.