Skip to content

Comments

Fix campaign project URL resolution in issue updates#11238

Merged
mnkiefer merged 7 commits intomainfrom
copilot/fix-campaign-url-reference
Jan 22, 2026
Merged

Fix campaign project URL resolution in issue updates#11238
mnkiefer merged 7 commits intomainfrom
copilot/fix-campaign-url-reference

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Campaign generator was passing temporary project IDs (e.g., #aw_abc123def456) instead of actual project URLs to update_issue, leaving unresolved references in issue bodies.

Root Cause

The project handler manager creates projects and maintains a temporary_id → project_url mapping locally, but this mapping was never shared with the regular handler manager where update_issue runs.

Changes

JavaScript

  • Export temporary_project_map as step output from safe_output_project_handler_manager.cjs
  • Add loadTemporaryProjectMap() and replaceTemporaryProjectReferences() to temporary_id.cjs
  • Apply project URL resolution in update_issue.cjs before body processing

Go Compiler

  • Add temporary_project_map to safe outputs job outputs
  • Conditionally pass GH_AW_TEMPORARY_PROJECT_MAP env var to handler manager step (only when project handlers are enabled)

Flow

// 1. Project handler stores mapping
temporaryProjectMap.set("aw_abc123def456", "https://github.com/orgs/myorg/projects/123")

// 2. Regular handler loads and applies
const map = loadTemporaryProjectMap();
rawBody = replaceTemporaryProjectReferences(rawBody, map);

// Result: "#aw_abc123def456" → "https://github.com/orgs/myorg/projects/123"

Temporary project IDs in issue text are now resolved to actual project URLs before the issue is updated.

Original prompt

Campaign generation after create project must pass the correct project url with project number to the issue update. Currently it seems to be a temporary reference. it should never use temporary refs or links.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 22, 2026 10:11
- Export temporary_project_map from project handler manager
- Pass project map to regular handler via GH_AW_TEMPORARY_PROJECT_MAP
- Add replaceTemporaryProjectReferences function in temporary_id.cjs
- Apply project URL replacement in update_issue before body processing
- Update compiler to wire up project map outputs and inputs

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
- Only add env var when project-related safe outputs are enabled
- Fixes tests that verify exact YAML structure
- Add tests for replaceTemporaryProjectReferences
- Add tests for loadTemporaryProjectMap
- Update TypeScript types for safe_output_project_handler_manager

Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix campaign generation to use permanent project URL Fix campaign project URL resolution in issue updates Jan 22, 2026
Copilot AI requested a review from mnkiefer January 22, 2026 10:29
@mnkiefer
Copy link
Contributor

@copilot There should be no temporary map needed, update project comes after create project as a step.

Copy link
Contributor Author

Copilot AI commented Jan 22, 2026

@copilot There should be no temporary map needed, update project comes after create project as a step.

Could you clarify what you mean? The agent calls create_project during execution and receives a temporary ID (e.g., aw_abc123def456) in the response. Later when calling update_issue, the agent includes this temporary ID in the issue body text (following the instructions in generate-agentic-campaign.md). My changes resolve these temporary IDs to actual project URLs when the issue is updated.

Are you suggesting we should change the approach - perhaps by having the agent NOT include project URLs in the issue body, or by changing how create_project returns information to the agent?

@mnkiefer
Copy link
Contributor

@copilot We should be able to use the project number information from the create-issue safe output to get the projectUrl to start adding fields.

Copy link
Contributor Author

Copilot AI commented Jan 22, 2026

@copilot We should be able to use the project number information from the create-issue safe output to get the projectUrl to start adding fields.

I think there might be a misunderstanding about the flow. Here's what happens:

  1. During agent execution: Agent calls create_project → MCP handler returns temporary_id (e.g., aw_abc123) to agent → Agent includes this in update_issue body text
  2. Later in workflow: Project handler step processes create_project → Actually creates project → Gets projectUrl
  3. Then: Regular handler step processes update_issue → My code resolves temporary IDs to project URLs

The agent can't know the actual project URL during its execution because the project hasn't been created yet. The MCP handler only returns a temporary_id.

Are you suggesting we should:

  • Change the MCP handler to somehow return the actual URL immediately?
  • Change the instructions so agents don't reference project URLs in issue bodies?
  • Have a different mechanism entirely?

@mnkiefer
Copy link
Contributor

@copilot Make sure that the projectURL that lands in the final issue update is the real projectURL not the temporary id.

Copy link
Contributor Author

Copilot AI commented Jan 22, 2026

@copilot Make sure that the projectURL that lands in the final issue update is the real projectURL not the temporary id.

Yes, that's exactly what my implementation does. Here's how it works:

Before (what agent writes):

- Created Project: #aw_abc123def456
- **Project URL:** #aw_abc123def456

After (what lands in the issue):

- Created Project: https://github.com/orgs/myorg/projects/123
- **Project URL:** https://github.com/orgs/myorg/projects/123

The code in update_issue.cjs (lines 37-40) loads the temporary project map and replaces all temporary IDs with real project URLs before the issue is updated. All 50 tests pass, including specific tests for replaceTemporaryProjectReferences().

@mnkiefer mnkiefer marked this pull request as ready for review January 22, 2026 11:48
@mnkiefer mnkiefer merged commit 10d3abd into main Jan 22, 2026
49 checks passed
@mnkiefer mnkiefer deleted the copilot/fix-campaign-url-reference branch January 22, 2026 11:55
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