Skip to content

work-items local-markdown claim.sh: lease/assignee integrity (expired lease never clears assignee; failed assignee write reports success) #367

Description

@kyle-sexton

Follow-up from #224 (bundle work-item-tracker seam, shape A). Two related local-markdown/claim.sh lease/assignee-integrity gaps, deferred by author delegation. Both are in byte-identical-moved code (relocated from medley, not changed by #224) and need care/design, not a mechanical patch.

Finding 1 (P1) — expired lease never clears the assignee, so abandoned claims never return to the frontier

Source: #224 review thread on adapters/local-markdown/claim.sh.

For the local-markdown binding, an expired lease still leaves the item's assignees frontmatter populated. /work now treats its unsupported reclaim (exit 6) as a no-op, while list-frontier always excludes assigned items — so any abandoned local claim is permanently absent from normal autonomous/manual selection after its TTL expires.

Assessment: is there a small safe fix?

No — both candidate fixes change runtime frontier-selection behavior on relocated code, and one raises a genuine design question:

  1. Clear the stale assignee when an expired lease is detected during frontier/list derivation. Changes how list-frontier/list derivation treats expired-lease items — behavioral, not mechanical.
  2. Add a genuine local-markdown reclaim.sh (mirroring github) and flip capabilities.json reclaim to true. github's reclaim also does an activity check (comments / PR cross-references) with no offline equivalent, since local-markdown is deliberately "never a coordination surface" (per the setup skill). Defining offline reclaim semantics is a design decision.

Note this is a direct consequence of #224's own commit f15a329; it does not regress below the pre-#224 state (where local-markdown reclaim was unsupported and exit-6 was a hard failure).

Finding 2 (P2) — a failed assignee write still reports a successful claim

Source: #224 re-review thread on adapters/local-markdown/claim.sh (post-merge-head re-review).

claim.sh appends the inline lease marker to the item file, then calls wit_fm_set "$file" assignees ... with no return-code check and no set -e. If wit_fm_set fails (e.g. the filesystem is full or the store cannot be rewritten), the nonzero result is ignored and the script still emits a successful claim JSON. The lease marker has already been appended, but assignees remains empty — so list-frontier presents the item as available while later claims conflict on the live lease until it expires.

Suggested direction

Propagate the wit_fm_set failure (fail the claim) and compensate for the partial write — roll back the lease marker appended immediately before — rather than reporting success on a half-applied claim. Extend the local-markdown conformance suite to cover a failed assignee write and expired-lease reclamation.

Why grouped

Both concern claim.sh's invariant that a claim's lease marker and assignees stay consistent (and that expired/failed claims return to the frontier). A single design/hardening pass over claim.sh should address both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumReal value, no hard deadline; normal backlog flow.status: readyTriaged, unblocked, and fully specified; eligible to pick up.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions