DamianEdwards / DamianEdwards/copilotd

Use GitHub issue events API to detect rule re-match within a single poll cycle

Open
#4 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
60
Forks
9
Avg merge
1d 5h
Merged PRs (30d)
1

Description

Currently, if a copilot session explicitly completes itself (via copilotd session complete), the CompletedBySession flag prevents re-dispatch. The flag is cleared when the daemon detects the issue no longer matches rules during a poll cycle. If a user toggles the issue state (e.g., removes and re-adds a label) within a single poll interval, the daemon never sees the 'unmatched' intermediate state and the flag remains set.

Proposed enhancement: During reconciliation, for Completed sessions with CompletedBySession = true that still match rules, use the GitHub issue events API (gh api repos/{owner}/{repo}/issues/{number}/events) to check for relevant state changes since the session's CompletedAt timestamp. Relevant events include:

  • unlabeled followed by labeled (for label-based rules)
  • unassigned followed by assigned (for user-based rules)
  • demilestoned followed by milestoned (for milestone-based rules)
  • closed followed by reopened

If such a sequence is detected, clear the CompletedBySession flag and allow re-dispatch, even if both changes occurred within the same poll cycle.

Tradeoff: One additional gh api call per completed-but-still-matching session per poll cycle. In practice this should be a small number of sessions.

Current workarounds:

  1. copilotd session reset <issue> — immediate manual reset
  2. Toggle the issue and wait at least one poll interval between changes

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the reconciliation path for Completed sessions where CompletedBySession and CompletedAt are checked. Read the GitHub issue events endpoint response and determine how to identify the listed change sequences after CompletedAt. Done means a relevant sequence clears the flag and permits re-dispatch while ordinary matching sessions remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, github
Domain
api, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.