Skip to content

Refactor agent-session safe-output parsing to a single shared path - #53840

Draft
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/duplicate-code-deduplicate-create-agent-session
Draft

Refactor agent-session safe-output parsing to a single shared path#53840
pelikhan with Copilot wants to merge 3 commits into
mainfrom
copilot/duplicate-code-deduplicate-create-agent-session

Conversation

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

parseAgentSessionConfig had two near-identical branches for create-agent-session and deprecated create-agent-task, creating drift risk for future field changes. This PR centralizes parsing while preserving key-precedence and deprecation behavior.

  • What changed

    • Extracted shared parsing into parseAgentSessionConfigMap(configData any).
    • Kept key selection in parseAgentSessionConfig:
      • prefer create-agent-session
      • fallback to create-agent-task with existing warning
  • Behavior preserved

    • base, target-repo, and base safe-output fields are parsed identically for both keys.
    • invalid target-repo still returns nil (validation path unchanged).
    • non-map / empty config still defaults max to 1.
  • Coverage updates

    • Added focused tests for deprecated-key parsing parity.
    • Added a precedence test to ensure create-agent-session wins when both keys are present.
if configData, exists := outputMap["create-agent-session"]; exists {
    return c.parseAgentSessionConfigMap(configData)
}
if configData, exists := outputMap["create-agent-task"]; exists {
    createAgentSessionLog.Print("WARNING: Using deprecated 'create-agent-task' configuration. Please migrate to 'create-agent-session' using 'gh aw fix'")
    return c.parseAgentSessionConfigMap(configData)
}

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Deduplicate parsing for create-agent-session config keys Refactor agent-session safe-output parsing to a single shared path Aug 18, 2026
Copilot AI requested a review from pelikhan August 18, 2026 22:12
@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

Part of the same safe-output parsing refactor cluster. Recommend batch review with the other two PRs.

Generated by 🔧 PR Triage Agent · auto · 58.5 AIC · ⌖ 2.15 AIC · ⊞ 8.3K ·

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot Remove create-agent-task add codemod to migrate

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

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Remove create-agent-task add codemod to migrate

Implemented in ec94ca5. create-agent-task support was removed from runtime parsing/handler aliases and from the main workflow schema, while keeping codemod migration support (gh aw fix) to rewrite safe-outputs.create-agent-task to safe-outputs.create-agent-session.

@github-actions

Copy link
Copy Markdown
Contributor

Triage: category=refactor · risk=medium · score=40/100 (impact 20/50, urgency 10/30, quality 10/20)
Recommended action: batch_review

Part of the B1-safeoutput-refactor batch (with #53841, #53838). Draft, no CI yet, no reviews. Undraft once ready and review together with the batch.

Generated by 🔧 PR Triage Agent · auto · 58.8 AIC · ⌖ 2.56 AIC · ⊞ 8.3K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[duplicate-code] Deduplicate create-agent-session parsing for current and deprecated config keys

2 participants