Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 25, 2026

Update close-older-issues to use workflow-id marker

Analysis

  • Currently, close-older-issues searches using title prefix and/or labels
  • GH_AW_WORKFLOW_ID environment variable is available in safe-output jobs
  • Workflow-id markers need to be consistent across all item types

Implementation Plan

  • Add workflow-id marker to issue bodies
  • Add workflow-id marker to discussion bodies
  • Add workflow-id marker to pull request bodies
  • Ensure standalone marker pattern (consistent with comments)
  • Update searchOlderIssues to search using workflow-id marker
  • Update closeOlderIssues to use workflow-id marker search
  • Update tests to verify workflow-id marker search
  • Update schema documentation
  • Format and lint JavaScript code
  • Rebuild binary after schema changes
  • Refactor marker creation into helper functions
  • Add comprehensive tests for helper functions

Changes Made

Marker Pattern Consistency

All item types now use a standalone workflow-id marker (consistent with comments):

<!-- gh-aw-workflow-id: workflow-name -->

This marker is added separately from the compound XML marker that contains engine metadata.

Refactored Helper Functions

Created centralized helper functions in generate_footer.cjs:

  • generateWorkflowIdMarker(workflowId) - Returns the full XML comment marker
  • getWorkflowIdMarkerContent(workflowId) - Returns just the marker content for search queries

Test Coverage

Added comprehensive test coverage in generate_footer.test.cjs:

  • 12 new tests for the workflow-id helper functions
  • Tests cover basic functionality, special characters, empty inputs
  • Tests verify consistency between full marker and content extraction
  • Tests ensure usability for search queries
  • All 30 tests pass successfully (18 existing + 12 new)

Files Updated

  1. generate_footer.cjs: Added helper functions for workflow-id marker generation
  2. generate_footer.test.cjs: Added 12 comprehensive tests for new helper functions
  3. create_issue.cjs: Uses generateWorkflowIdMarker() helper
  4. create_discussion.cjs: Uses generateWorkflowIdMarker() helper
  5. create_pull_request.cjs: Uses generateWorkflowIdMarker() helper
  6. add_workflow_run_comment.cjs: Uses generateWorkflowIdMarker() helper
  7. add_reaction_and_edit_comment.cjs: Uses generateWorkflowIdMarker() helper
  8. close_older_issues.cjs: Uses getWorkflowIdMarkerContent() helper for search
  9. main_workflow_schema.json: Updated description for close-older-issues feature

How It Works Now

When close-older-issues: true is enabled:

  1. Issues are created with a standalone <!-- gh-aw-workflow-id: {id} --> marker
  2. When a new issue is created, the system searches for older open issues with the same workflow-id marker
  3. Found issues are closed as "not planned" with a comment linking to the new issue

Benefits

  • Consistent: All item types (comments, issues, discussions, PRs) use the same standalone marker format
  • Searchable: Easy to find all items from a specific workflow
  • Maintainable: Marker format centralized in one location (generate_footer.cjs)
  • DRY: No hardcoded strings duplicated across files
  • Well-tested: Comprehensive test coverage for all helper functions
Original prompt

Update the implementation of close-older-issues to search for issues using the workflow-id marker instead of only the title prefix and label. When we create an issue, we add markers, and we should use those markers to find older issues from that workflow.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…prefix/labels

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Update close-older-issues to use workflow-id marker Use workflow-id marker for close-older-issues search Jan 25, 2026
@pelikhan
Copy link
Contributor

Copilot, ensure the workflow-id marker (the XML comment) is the same for comments, issues, discussions, and pull-requests.

Copilot AI requested a review from pelikhan January 25, 2026 23:48
@pelikhan
Copy link
Contributor

@copilot Ensure the xluncommon field that identifies the workflow that generated the item uses the same syntax across comments, issues, discussions, pull-requests, and other item types.

…cussions, PRs)

- Remove workflow-id from compound XML marker in generate_footer.cjs
- Add standalone workflow-id marker to issues, discussions, and pull requests
- Consistent with how comments already use standalone markers

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 25, 2026

Copilot, ensure the workflow-id marker (the XML comment) is the same for comments, issues, discussions, and pull-requests.

Done in d27aea6. The workflow-id marker is now a standalone <!-- gh-aw-workflow-id: {id} --> tag, consistent across comments, issues, discussions, and pull requests.

@copilot Ensure the xluncommon field that identifies the workflow that generated the item uses the same syntax across comments, issues, discussions, pull-requests, and other item types.

Done in d27aea6. The workflow-id marker now uses the same standalone XML comment syntax across all item types:

  • Comments: <!-- gh-aw-workflow-id: {id} -->
  • Issues: <!-- gh-aw-workflow-id: {id} -->
  • Discussions: <!-- gh-aw-workflow-id: {id} -->
  • Pull Requests: <!-- gh-aw-workflow-id: {id} -->

This is separate from the compound XML marker that contains engine metadata (gh-aw-agentic-workflow, tracker-id, engine, version, model, run).

Copilot AI changed the title Use workflow-id marker for close-older-issues search Use workflow-id marker for close-older-issues search and ensure consistency across all item types Jan 25, 2026
@pelikhan
Copy link
Contributor

@copilot, refactor the creation of the XMN marker into a helper function and use it in one location instead of hardcoding the string everywhere.

- Add generateWorkflowIdMarker() helper for creating the XML comment marker
- Add getWorkflowIdMarkerContent() helper for search queries
- Replace all hardcoded `<!-- gh-aw-workflow-id: ${workflowId} -->` strings with helper calls
- Centralize marker format in generate_footer.cjs for consistency

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot, refactor the creation of the XMN marker into a helper function and use it in one location instead of hardcoding the string everywhere.

Done in 61d139e. Created two helper functions in generate_footer.cjs:

  • generateWorkflowIdMarker(workflowId) - Generates the full XML comment marker (<!-- gh-aw-workflow-id: {id} -->)
  • getWorkflowIdMarkerContent(workflowId) - Returns just the marker content for search queries (gh-aw-workflow-id: {id})

Replaced all hardcoded workflow-id marker strings across 6 files with calls to these helpers.

@pelikhan
Copy link
Contributor

@copilo add tests

@pelikhan
Copy link
Contributor

@copilot Add tests

- Add 12 new tests for generateWorkflowIdMarker() and getWorkflowIdMarkerContent()
- Test basic functionality, special characters, empty inputs
- Test consistency between full marker and content extraction
- Test usability for search queries
- All 30 tests in generate_footer.test.cjs now pass

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot Add tests

Done in 52dbf03. Added 12 comprehensive tests for the workflow-id marker helper functions in generate_footer.test.cjs:

  • Tests for generateWorkflowIdMarker() - basic functionality, special characters, empty inputs, format consistency
  • Tests for getWorkflowIdMarkerContent() - content extraction, search query usability, consistency verification

All 30 tests in the file now pass (18 existing + 12 new).

@pelikhan pelikhan marked this pull request as ready for review January 26, 2026 00:50
@pelikhan pelikhan merged commit e674b7e into main Jan 26, 2026
84 checks passed
@pelikhan pelikhan deleted the copilot/update-close-older-issues-implementation branch January 26, 2026 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants