T-YQY2-task-next-lease-exclusion
Status: closed/superseded · Impact: high · Complexity: medium
Stage 3 of D-S30G-task-state-plane-split. Once in-progress
stops being written to frontmatter, task next would re-offer
in-flight work every tick. Exclude candidates with an active lease
ref in the local mirror — the double-dispatch guard, with
cas_create failing at claim as the hard backstop.
| Location | Role today |
|---|---|
apps/sdlc/lib/model/entities/task/ops/next.ts | Frontmatter-only selector: status filter, autonomy exclusion, priority/impact sort, depends_on dispatchability. No lease read, no network. |
apps/sdlc/skills/orchestrate/SKILL.md | Tick sync step fetches main; no refs/sdlc/* refspec, so the local lease mirror only freshens when the dashboard happens to run. |
Proposed
Section titled “Proposed”next skips any candidate whose basename has an active ref at
refs/sdlc/tasks/<basename> in the local mirror (archived refs
don’t exclude), reports the skips (skipped_leased), and stays
network-free. The orchestrate tick’s sync step gains the
refs/sdlc/* refspec so the mirror is tick-fresh. Pre-cutover a
leased task is also in-progress, so exclusion is a zero-behavior
change; stale-mirror failure modes degrade safely (under-dispatch
self-heals on next fetch; stale-missing is caught at claim).
Approach
Section titled “Approach”- Add a local-ref existence check per candidate in
next.ts; thread askipped_leasedlist into--explain/ output. - Add the
refs/sdlc/*refspec to orchestrate’s tick sync. - Tests: leased candidate skipped; archived lease not skipped; absent mirror behaves as today.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
apps/sdlc/lib/model/entities/task/ops/next.ts | modify | Active-lease exclusion + skipped_leased. |
apps/sdlc/skills/orchestrate/SKILL.md | modify | Tick sync fetches refs/sdlc/*. |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: A task with an active ref at
refs/sdlc/tasks/<b>in the local mirror is never emitted bytask next. - AC-2: A task whose lease lives only under
refs/sdlc/archive/is still offered. - AC-3:
nextmakes no network calls; with no local mirror it behaves exactly as today.
Out of scope
Section titled “Out of scope”- Lease-phase-aware ordering or reporting beyond exclusion.
Dependencies
Section titled “Dependencies”- T-5G81-lease-payload-gates — payload version this reader tolerates.
Discovery context
Section titled “Discovery context”- Scaffolded from D-S30G-task-state-plane-split (migration stage 3 of 7).