Skip to content

[q] Enhance Q workflow with explicit file editing and PR creation instructions #3429

@github-actions

Description

@github-actions

Q Workflow Enhancement: Explicit File Editing and PR Creation Instructions

Summary

Updated the Q workflow prompt to explicitly inform the AI agent that it has the capability to directly edit workflow files and create pull requests. This addresses the request from discussion #3416 to make it clear that the agent should apply changes rather than just analyze them.

Changes Made

Updated .github/workflows/q.md

  1. Enhanced Mission Statement (lines 38-48):

    • Added step 5: "Applying changes directly to workflow files using your edit capabilities"
    • Added prominent note: "YOU CAN DIRECTLY EDIT FILES AND CREATE PULL REQUESTS"
    • Clarified that safe-outputs for PR creation is pre-configured
  2. Enhanced Phase 4 Instructions (line 161):

    • Added emphasis: "You have full access to edit workflow files directly"
    • Explicitly mentioned using "Serena's editing tools to make changes"
  3. Completely Rewrote Phase 6 (lines 240-268):

    • Renamed from "Create Pull Request" to "Apply Changes and Create Pull Request"
    • Added step 1: "Apply Changes Directly" with detailed instructions
    • Explicitly listed Serena tools: replace_symbol_body, insert_after_symbol, or edit tools
    • Clarified that PR creation happens automatically via safe-outputs
    • Made it clear the agent should make file changes first, then PR is created automatically

Expected Improvements

  • Clearer Agent Behavior: The AI agent will now understand it should actively edit files, not just suggest changes
  • Better Workflow Execution: Reduces confusion about whether the agent should analyze-only or analyze-and-fix
  • Leverages Existing Capabilities: Makes full use of the safe-outputs PR creation already configured in frontmatter
  • More Autonomous Operation: Agent can complete the full optimization cycle without requiring manual intervention

Validation

✅ Workflow compiled successfully using gh aw compile:

✓ .github/workflows/q.md (312.2 KB)
✓ Compiled 1 workflow(s): 0 error(s), 0 warning(s)

Note: There's a deprecation warning about timeout_minutes vs timeout-minutes, but this is not blocking and can be addressed separately.

Context

This change was requested in discussion #3416 comment to "/q add create pull request safe output so that the agent is able to apply the changes. Update the prompt accordingly."

The safe-output configuration was already present in the workflow frontmatter:

safe-outputs:
  add-comment:
    max: 1
  create-pull-request:
    title-prefix: "[q] "
    labels: [automation, workflow-optimization]
    reviewers: copilot
    draft: false

The issue was that the prompt didn't make it clear to the AI agent that it should use this capability. This PR fixes that by making the instructions explicit and actionable.

AI generated by Q


Note

This was originally intended as a pull request, but the git push operation failed.

Workflow Run: View run details and download patch artifact

The patch file is available as an artifact (aw.patch) in the workflow run linked above.
To apply the patch locally:

# Download the artifact from the workflow run https://github.com/githubnext/gh-aw/actions/runs/19158681351
# (Use GitHub MCP tools if gh CLI is not available)
gh run download 19158681351 -n aw.patch
# Apply the patch
git am aw.patch
Show patch preview (159 of 159 lines)
From 12b63c932f07cc2910813d29c540631ca268bc91 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Fri, 7 Nov 2025 05:02:38 +0000
Subject: [PATCH] Update Q workflow to explicitly enable direct file editing
 and PR creation

- Enhanced Phase 6 instructions to clarify agent can directly modify workflow files
- Added emphasis that safe-outputs PR creation is pre-configured
- Updated mission statement to include 'Applying changes directly' step
- Made it clear the agent should use Serena editing tools to make changes
- Clarified that PR creation happens automatically via safe-outputs

This makes it clear to the AI agent that it has the capability and permission
to directly edit workflow files and create pull requests with those changes.
---
 .github/workflows/q.lock.yml | 34 ++++++++++++++++++++--------------
 .github/workflows/q.md       | 34 ++++++++++++++++++++--------------
 2 files changed, 40 insertions(+), 28 deletions(-)

diff --git a/.github/workflows/q.lock.yml b/.github/workflows/q.lock.yml
index c8a3c58..b4d4d37 100644
--- a/.github/workflows/q.lock.yml
+++ b/.github/workflows/q.lock.yml
@@ -2234,7 +2234,10 @@ jobs:
           2. **Identifying missing tools** and permission issues
           3. **Detecting inefficiencies** through excessive repetitive MCP calls
           4. **Extracting common patterns** and generating reusable workflow steps
-          5. **Creating a pull request** with optimized workflow configurations
+          5. **Applying changes directly** to workflow files using your edit capabilities
+          6. **Creating a pull request** with optimized workflow configurations
+          
+          **YOU CAN DIRECTLY EDIT FILES AND CREATE PULL REQUESTS** - This workflow is configured with safe-outputs for pull request creation, so you can make changes to workflow files and they will automatically be included in a PR.
           
           <current_context>
           ## Current Context
@@ 
... (truncated)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions