Skip to content

Fix Daily TODO Check workflow: use correct gh agent-task flags and prevent duplicate issue creation#23

Merged
zaxlofful merged 3 commits intomainfrom
copilot/fix-daily-todo-check-errors
Jan 2, 2026
Merged

Fix Daily TODO Check workflow: use correct gh agent-task flags and prevent duplicate issue creation#23
zaxlofful merged 3 commits intomainfrom
copilot/fix-daily-todo-check-errors

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 2, 2026

The Daily TODO Check workflow was using incorrect flags for gh agent-task create and had logic that would create duplicate issues when the --json flag failed.

Changes

  • Fixed gh agent-task create command: Changed from using invalid --title and --body-file flags to the correct --from-file flag:

    # Before: Using non-existent flags
    gh agent-task create --repo "$GITHUB_REPOSITORY" --title "..." --body-file "$FILE" --follow
    
    # After: Using correct flag
    gh agent-task create --repo "$GITHUB_REPOSITORY" --from-file "$FILE" --follow
  • Added GH_TOKEN authentication: Added GH_TOKEN environment variable to the agent-task step for proper authentication

  • Fixed duplicate issue creation: Consolidated two gh issue create calls into one:

    # Before: Two separate calls - one with --json, one as fallback
    ISSUE_NUMBER=$(gh issue create --json number -q '.number') || true
    if [ -z "$ISSUE_NUMBER" ]; then
      CREATED_URL=$(gh issue create ...) || true  # Creates duplicate!
    fi
    
    # After: Single call with URL parsing
    ISSUE_URL=$(gh issue create ... 2>&1) || true
    ISSUE_NUMBER=$(echo "$ISSUE_URL" | sed -n 's#.*/issues/\([0-9][0-9]*\).*#\1#p')

Net result: Workflow now correctly uses gh agent-task when available with proper flags and creates exactly one issue per TODO when falling back to regular issue creation.

Original prompt

The Daily TODO Check workflow completed, but it had errors.: (https://github.com/zaxlofful/SimpleWish/actions/runs/20657443588)

Figure out why its not using agent-task the right way and then also figure out when the TODO is complainging during the second creation step.


💡 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.

…prevent duplicate issue creation

Co-authored-by: zaxlofful <33877007+zaxlofful@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Jan 2, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
simplewish 90c0960 Jan 02 2026, 10:53 PM

Copilot AI changed the title [WIP] Fix errors in Daily TODO Check workflow Fix Daily TODO Check workflow: remove non-existent gh agent-task and prevent duplicate issue creation Jan 2, 2026
Copilot AI requested a review from zaxlofful January 2, 2026 22:45
@zaxlofful
Copy link
Copy Markdown
Owner

@copilot Very close, but not quite right. If you examine the output more closely, it says:

"Attempting gh agent-task create using /tmp/tmp.7Umcxretc2
unknown flag: --title

Usage: gh agent-task create [] [flags]

Flags:
-b, --base string Base branch for the pull request (use default branch if not provided)
-a, --custom-agent string Use a custom agent for the task. e.g., use 'my-agent' for the 'my-agent.md' agent
--follow Follow agent session logs
-F, --from-file file Read task description from file (use "-" to read from standard input)
-R, --repo [HOST/]OWNER/REPO Select another repository using the [HOST/]OWNER/REPO format

gh agent-task create failed"

Which is the helper text from gh agent-task create, which thus means that the function is available, but it wasn't used right. From this it seems that there is no title, so the call just needs to be reduced to work correctly.

So intead of removing it entirely, you need to keep it but use the right parameters. We also want the fall back just in case, because we want additional failure modes to be automatic.

Additionally, when you look at the output of the next step, ytou'

…file, remove duplicate issue creation

Co-authored-by: zaxlofful <33877007+zaxlofful@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 2, 2026

@copilot Very close, but not quite right. If you examine the output more closely, it says:

"Attempting gh agent-task create using /tmp/tmp.7Umcxretc2...

Fixed in commit 90c0960. Changed to use --from-file instead of --title and --body-file, added GH_TOKEN env var, and removed the duplicate gh issue create call that was using the non-existent --json flag.

Copilot AI changed the title Fix Daily TODO Check workflow: remove non-existent gh agent-task and prevent duplicate issue creation Fix Daily TODO Check workflow: use correct gh agent-task flags and prevent duplicate issue creation Jan 2, 2026
@zaxlofful zaxlofful marked this pull request as ready for review January 2, 2026 23:00
Copilot AI review requested due to automatic review settings January 2, 2026 23:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes critical bugs in the Daily TODO Check workflow related to incorrect CLI flags and duplicate issue creation logic.

Key Changes:

  • Corrects gh agent-task create command to use the valid --from-file flag instead of non-existent --title and --body-file flags
  • Adds GH_TOKEN environment variable for proper authentication in the agent-task step
  • Consolidates duplicate gh issue create calls into a single call with URL parsing to prevent creating multiple issues for the same TODO

@zaxlofful zaxlofful merged commit 644e4cd into main Jan 2, 2026
8 of 9 checks passed
@zaxlofful zaxlofful deleted the copilot/fix-daily-todo-check-errors branch January 2, 2026 23:07
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.

3 participants