Skip to content

fix(create-issues-from-todos): TODOs workflow crashes on ambiguous issue match (upstream web_url KeyError) #222

@devantler

Description

@devantler

🤖 Generated by the Daily AI Assistant

Summary

The create-issues-from-todos composite action (which pins alstr/todo-to-issue-action@v5.1.13) crashes the TODOs workflow whenever a removed # TODO: comment matches multiple existing GitHub issues (an "ambiguous match"). The crash is a KeyError in the upstream action's diagnostic print, not in the issue-closure logic itself — closure is already (correctly) skipped, but the action then dies trying to print the ambiguous candidates with a GitLab-only field name.

This is a shared-library / portfolio-wide failure mode: every devantler-tech repo whose TODOs workflow calls reusable-workflows/.github/workflows/scan-for-todo-comments.yamlcreate-issues-from-todostodo-to-issue-action@v5.1.13 is exposed.

Evidence (observed live)

platform-template TODOs run 26907228942 (push of the auth-proxy TODO-dedup merge platform-template#16, commit 73a12fb) failed with:

Processing issue 1 of 6: 'Remove auth-proxy when Cilium supports native forward auth (...cilium#23797)' @ k8s/.../auth-proxy/config-map.yaml:1
Skipping issue closure due to ambiguous match against multiple existing issues, shown below
Traceback (most recent call last):
  File "/app/main.py", line 169, in <module>
    process_diff(StringIO(last_diff), client, insert_issue_urls)
  File "/app/main.py", line 138, in process_diff
    status_code = client.close_issue(raw_issue)
  File "/app/GitHubClient.py", line 371, in close_issue
    print(f' {x["web_url"]}')
KeyError: 'web_url'

Root cause

GitHubClient.close_issue (upstream alstr/todo-to-issue-action, pinned v5.1.13 / c45b007) takes the ambiguous-match branch when a removed TODO maps to >1 open issue, then prints each candidate with x["web_url"]. GitHub's REST issue object exposes html_url, not web_url (web_url is a GitLab field) → KeyError → non-zero exit → red workflow.

The trigger is duplicate issues with the same title — exactly the state the upstream scanner produces when one TODO is repeated across N files (it opens one issue per occurrence; see the dedup in platform-template#16). When such a TODO is later removed, the close path goes ambiguous and crashes.

Scope / severity

  • Self-healing per repo: the failure is bound to the specific diff that removes the TODO(s); the next push runs TODOs with a clean diff and goes green. It does not persistently red a main.
  • But it recurs across the portfolio any time a multi-occurrence TODO with duplicate issues is cleaned up, and it produces a noisy, misleading red on main for that commit.
  • A version bump does not fix it: upstream v5.1.14 (latest) leaves GitHubClient.py unchanged vs v5.1.13 (confirmed via the v5.1.13...v5.1.14 compare — the file is not in the changeset), so the bug persists in the newest release.

Proposed direction (pick one; sized S–M)

  1. Report upstream alstr/todo-to-issue-action (web_urlhtml_url in the ambiguous-match diagnostic) and re-pin once fixed. Cleanest root-cause path, but gated on upstream cadence.
  2. Dedup discipline (mitigation, already proven): keep each repeated TODO once at the source so the close path is never ambiguous (the pattern applied in platform-template#16). Roll the same single-occurrence convention into the template(s) and the platform repo (which still carries the identical 5-file auth-proxy TODO).
  3. Harden our wrapper to tolerate a non-zero exit on the close-only path (e.g. only fail the job on creation errors), if scan-for-todo-comments can be made to distinguish them — needs investigation.

Acceptance criteria

  • A removed multi-occurrence TODO no longer crashes the TODOs workflow on any consumer repo.
  • The chosen mitigation is documented in this action's README / the reusable workflow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions