Skip to content

work-items GitHub adapter: renew back-off gaps and contract wording found after the lease fix merged #16505

Closed

Description

@kyle-sexton

An independent read of the last two rounds of #16475 (commits 7f524f7..e5af891, read after the merge) found one new gap, two failure paths the new back-off does not cover, and contract text that overstates the code. No finding lets two sessions hold one item. Line numbers are at e5af891, under plugins/work-items/tools/work-item-tracker/.

Findings

  1. A holder can end unassigned (three sessions on one login). adapters/github/common.sh:519-521: the hand-back's last removal has no re-list after it. Session X releases and removes the login; Z posts a lease, so X's re-list re-adds the login; Z's lease ends; X's third list shows no live lease and X pauses 1 s before its DELETE; H claims and wins inside that pause; X's DELETE lands. H holds a live lease with nobody assigned, so list-frontier offers the item and each later claimant posts a lease, loses and backs off. No fixed sequence of removals and re-adds closes this without compare-and-swap; CONTRACT.md:752-754 says one session always sees the other's write, which is not true here.
  2. A renew PATCH that GitHub applies but reports as failed skips the back-off. adapters/github/renew-lease.sh:87: wit_patch_lease_comment exits through wit_run_gh before the after-expiry check, so a lease revived after its expiry is kept.
  3. Renew's back-off hands back even when its supersede failed. adapters/github/renew-lease.sh:91-92: the lease is still live, the login is removed, and the lease blocks the item for its TTL.
  4. Contract drift. CONTRACT.md:754 (finding 1); :817-818 say a list failing twice makes the rollback remove the assignee, but the re-list at common.sh:513-516 can put it back; :772-779 say every exit-0 release hands back, but release.sh:79-83 exits 0 with no hand-back for another login's already-superseded lease.
  5. Test gaps in adapters/github/lease-coordination.test.sh: no case for finding 1's race; the after-expiry back-off has no case where a same-login winner keeps the login.

Done when

  • CONTRACT.md "Lease protocol" states finding 1 as a known limit (a holder left unassigned; the lease still excludes other workers) and no longer claims one session always sees the other's write.
  • renew-lease.sh runs the back-off when its PATCH fails and the clock is at or past the old expiry or within the 300 s margin, with a test that fails before the change.
  • Renew's back-off retries its supersede once and hands the assignee back only when a supersede succeeded, with a test that fails before the change.
  • CONTRACT.md lines for the rollback after a failed list and for release's exit-0 paths say what the code does.
  • lease-coordination.test.sh has the after-expiry back-off case where a same-login winner keeps the login.

Not asked for: a code change for finding 1. Basis for leaving it as a stated limit: the lease still gives one holder (model check on #16475), the cost is wasted claim attempts, and the alternatives each add a part (a fourth list and re-add narrows the window without closing it; having renew re-assert the assignee needs a new lease field to tell a default claim from a lease-only one).

Refs: #16475, #16472

Activity

  1. added
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Nov 16, 2026
  2. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    Size: Medium
    Complexity: Medium
    Uncertainty: Known
    Flags: none
    Blocked by: none

    I read this as follow-up work after #16475, which is already merged. It covers two gaps in renew's back-off in the GitHub adapter. It also asks for contract wording that matches the code, and for tests of those cases. The race in finding 1 is to be documented as a known limit, not fixed, and the five done-when items are specific enough to act on.

    I found no open duplicate and no merged pull request that already covers these items.

    Automated triage. A maintainer reviews it.

  3. removed
    needs-triageNot yet classified. Floor until a type and one priority tier are set.
    on Nov 16, 2026
  4. melodic-automation-lanes commented on Nov 16, 2026

    @melodic-automation-lanes
    Contributor

    {"v":1,"actor_id":337595936,"title_sha256":"57b923bad58b13340fbe2ded5080a24826bf83b8b056cd9cf7a5c986ac300b56","body_sha256":"522fa847d8a077114262a49728a6345977c1078db314e4af25abe3f53fc33f86"}

  5. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor
    No description provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Work status

    needs-triage

    Priority

    medium

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions