Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 500
fix: use GraphQL baseRef field for base-branch in assign-to-agent#17347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
581dd5dd26a6300ddfb3fbb429ea54909b8881d740fda34db98e8eb8b239313File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| --- | ||
| description: Smoke test that validates assign-to-agent with the agentic-workflows custom agent | ||
| on: | ||
| workflow_dispatch: | ||
| pull_request: | ||
| types: [labeled] | ||
| names: ["metal"] | ||
| status-comment: true | ||
| permissions: | ||
| contents: read | ||
| issues: read | ||
| pull-requests: read | ||
| name: Smoke Agent | ||
| engine: codex | ||
| strict: true | ||
| tools: | ||
| github: | ||
| network: | ||
| allowed: | ||
| - defaults | ||
| - github | ||
| safe-outputs: | ||
| assign-to-agent: | ||
| target: "*" | ||
| max: 1 | ||
| allowed: [copilot] | ||
| custom-agent: agentic-workflows | ||
| add-comment: | ||
| hide-older-comments: true | ||
| max: 2 | ||
| messages: | ||
| footer: "> 🤖 *Smoke test by [{workflow_name}]({run_url})*" | ||
| run-started: "🤖 [{workflow_name}]({run_url}) is looking for a Smoke issue to assign..." | ||
| run-success: "✅ [{workflow_name}]({run_url}) completed. Issue assigned to the agentic-workflows agent." | ||
| run-failure: "❌ [{workflow_name}]({run_url}) {status}. Check the logs for details." | ||
| timeout-minutes: 10 | ||
| --- | ||
| # Smoke Agent: assign-to-agent with agentic-workflows | ||
| This workflow validates that `assign-to-agent` works correctly with the `agentic-workflows` custom agent. | ||
| ## Instructions | ||
| 1. **Find a Smoke issue**: Use the GitHub MCP tools to search for an open issue in ${{ github.repository }} whose title starts with "Smoke". Use the search query: `is:issue is:open in:title Smoke repo:${{ github.repository }}`. Pick the first result. | ||
| 2. **Assign the issue**: Use the `assign_to_agent` safe-output tool to assign the issue to copilot using the `agentic-workflows` custom agent: | ||
| ```json | ||
| { | ||
| "type": "assign_to_agent", | ||
| "issue_number": <issue_number>, | ||
| "agent": "copilot" | ||
| } | ||
| ``` | ||
| 3. **Report**: Add a brief comment to the current pull request confirming the issue number that was assigned and which agent was used. | ||
| If no Smoke* issue is found, use the `noop` tool to report that no matching issue was found. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -9,7 +9,7 @@ const { resolveTarget } = require("./safe_output_helpers.cjs"); | ||
| const { loadTemporaryIdMap, resolveRepoIssueTarget } = require("./temporary_id.cjs"); | ||
| const { sleep } = require("./error_recovery.cjs"); | ||
| const { parseAllowedRepos, validateRepo, resolveTargetRepoConfig, resolveAndValidateRepo } = require("./repo_helpers.cjs"); | ||
| const { resolvePullRequestRepo, buildBranchInstruction } = require("./pr_helpers.cjs"); | ||
| const { resolvePullRequestRepo } = require("./pr_helpers.cjs"); | ||
| async function main() { | ||
| const result = loadAgentOutput(); | ||
| @@ -147,8 +147,6 @@ async function main() { | ||
| let pullRequestRepoId = null; | ||
| // Effective base branch: explicit config > fetched default branch from PR repo | ||
| let effectiveBaseBranch = configuredBaseBranch || null; | ||
| // Resolved default branch fetched from the target PR repo (used in NOT clause of branch instructions) | ||
| let resolvedDefaultBranch = null; | ||
| // Get allowed PR repos configuration for cross-repo validation | ||
| const allowedPullRequestReposEnv = process.env.GH_AW_AGENT_ALLOWED_PULL_REQUEST_REPOS?.trim(); | ||
| @@ -175,7 +173,6 @@ async function main() { | ||
| const resolved = await resolvePullRequestRepo(github, pullRequestOwner, pullRequestRepo, configuredBaseBranch); | ||
| pullRequestRepoId = resolved.repoId; | ||
| effectiveBaseBranch = resolved.effectiveBaseBranch; | ||
| resolvedDefaultBranch = resolved.resolvedDefaultBranch; | ||
| core.info(`Pull request repository ID: ${pullRequestRepoId}`); | ||
| if (!configuredBaseBranch && effectiveBaseBranch) { | ||
| core.info(`Resolved pull request repository default branch: ${effectiveBaseBranch}`); | ||
| @@ -201,12 +198,7 @@ async function main() { | ||
| // They are NOT available as per-item overrides in the tool call | ||
| const model = defaultModel; | ||
| const customAgent = defaultCustomAgent; | ||
| // Build effective custom instructions: prepend base-branch instruction when needed | ||
| let customInstructions = defaultCustomInstructions; | ||
| if (effectiveBaseBranch) { | ||
| const branchInstruction = buildBranchInstruction(effectiveBaseBranch, resolvedDefaultBranch); | ||
| customInstructions = customInstructions ? `${branchInstruction}\n\n${customInstructions}` : branchInstruction; | ||
| } | ||
| const customInstructions = defaultCustomInstructions || null; | ||
| // Use these variables to allow temporary IDs to override target repo per-item. | ||
| // Default to the per-item resolved repo (from item.repo or defaultTargetRepo). | ||
| @@ -466,7 +458,10 @@ async function main() { | ||
| if (customInstructions) { | ||
| core.info(`Using custom instructions: ${customInstructions.substring(0, 100)}${customInstructions.length > 100 ? "..." : ""}`); | ||
| } | ||
pelikhan marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| const success = await assignAgentToIssue(assignableId, agentId, currentAssignees, agentName, allowedAgents, effectivePullRequestRepoId, model, customAgent, customInstructions); | ||
| if (effectiveBaseBranch) { | ||
| core.info(`Using base branch: ${effectiveBaseBranch}`); | ||
| } | ||
| const success = await assignAgentToIssue(assignableId, agentId, currentAssignees, agentName, allowedAgents, effectivePullRequestRepoId, model, customAgent, customInstructions, effectiveBaseBranch); | ||
| if (!success) { | ||
| throw new Error(`Failed to assign ${agentName} via GraphQL`); | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.