Duplicates: an open card on the task kept no longer blocks combining
The coordinator's ruling (2026-11-11), in line with Paul's "combine
automatically with Undo": only a pending decision on the task being
closed blocks a combine. An open card on the task kept, a merge card
included, stays open on it and no longer keeps the pair apart.
- housekeeping.duplicates drops the keeper's Carded check; foldable
re-checks open cards on the folded task only.
- Fixture: staging's Woodstar pair, tkf6dufnbzcg at Ready to merge
with its merge card is kept (stage beats age) and the older, stopped
tks6kwzzdngr closes; a card on the task that would close still keeps
them apart. The fixture failed before the change.
- TestContractCombineDuplicates: a task is combined into one waiting on
its merge card, which stays open; a second ready task with its own
merge card is only named. Reverting foldable's check fails it
("combined 0").
- Housekeeping spec: the duplicate_same_creator row and the Never list
state the new rule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 files changed,
+61
−20
docs/superpowers/specs/2026-11-08-equipo-housekeeping.md+5 −2internal/equipo/chat/duplicates.go+7 −4internal/equipo/housekeeping/duplicates.go+7 −2internal/equipo/housekeeping/testdata/duplicate_same_creator.json+13 −3internal/thintest/duplicates_contract_test.go+29 −9
Intent
diff --git a/docs/superpowers/specs/2026-11-08-equipo-housekeeping.md b/docs/superpowers/specs/2026-11-08-equipo-housekeeping.md| index a22d1a36..73eb19c6 100644 |
| --- a/docs/superpowers/specs/2026-11-08-equipo-housekeeping.md |
| +++ b/docs/superpowers/specs/2026-11-08-equipo-housekeeping.md |
| @@ -103,7 +103,7 @@ detectors of §8 arrive later. |
| | Detector | Fires on | Class | Judgement | |
| |---|---|---|---| |
| -| `duplicate_same_creator` | `record_task` by a creator whose open, unstarted task in the same project overlaps the new one at or above 0.75 with three shared title words, or 0.7 with five across title and brief (UX1's thresholds as shipped; kept by the controller 2026-11-08), both tasks owned by that creator and checked again in the transaction | Act and tell: combine, receipt with Undo (built on `thin-v1-ux1`) | none | |
| +| `duplicate_same_creator` | `record_task` (or the sweep) where two of one creator's open tasks in the same project overlap at or above 0.75 with three shared title words, or 0.7 with five across title and brief (UX1's thresholds as shipped; kept by the controller 2026-11-08), both tasks owned by that creator and checked again in the transaction. The one furthest along is kept (stage, then not stopped, then the older); the other closes. Only a pending decision on the task that closes (an open card other than its task card) or a step at work on it blocks the combine; an open card on the task kept, a merge card included, does not, and stays open on it (coordinator's ruling 2026-11-11, on Paul's "combine automatically with Undo": staging's Woodstar pair keeps `tkf6dufnbzcg` at Ready to merge and closes the stopped `tks6kwzzdngr`) | Act and tell: combine, receipt with Undo (built on `thin-v1-ux1`) | none | |
| | `duplicate_possible` | overlap at or above 0.6 with two shared title words, or 0.5 with three across title and brief, or any such overlap across creators | Link only: "Possible duplicate of" on the new task, `Task.duplicate_of` as UX1 | none | |
| | `retry_transient` | a step that **never pushed a candidate** stopped with `runner_restarted`, `interrupted`, `provider_failed`, `clone_failed`, `candidate_unavailable`, `checks_timeout` or `no_runner`, termination proven, no earlier automatic retry in this failure chain | Act and tell: one retry per chain, Undo until the retried step starts (slice 2) | none | |
| | `ready_waiting` | a task at Ready to merge with an open card or no card for over 24 h | Digest mention only, never a new card | none | |
| @@ -179,7 +179,10 @@ them and is unchanged. |
| **Never.** Delete tasks, projects, branches, notes or usage rows; merge, |
| or alter `merge_eligible`, `merge_asked`, an open merge card or the |
| -checks-exception decision; touch another person's task or notebook, |
| +checks-exception decision (combining another task into one with an open |
| +merge card is allowed and leaves that card, its SHA and its answer |
| +exactly as they were; closing a task that has a decision still open is |
| +not); touch another person's task or notebook, |
| including as a fold's destination; create or start a task from a |
| suggestion without a tap; dispatch past the reservation or on a |
| connection that is `limited` or of unknown tier; post more than receipts |
diff --git a/internal/equipo/chat/duplicates.go b/internal/equipo/chat/duplicates.go| index adf4df06..934e45be 100644 |
| --- a/internal/equipo/chat/duplicates.go |
| +++ b/internal/equipo/chat/duplicates.go |
| @@ -19,7 +19,8 @@ import ( |
| // read alike are a pair. When one person filed both, they read very much |
| // alike, neither is merging and the weaker one has no open card and no |
| // step at work, the weaker is combined into the one that is furthest |
| -// along: its report, findings and thread are copied onto the survivor |
| +// along (an open card on that one, a merge card say, does not block): |
| +// its report, findings and thread are copied onto the survivor |
| // (marked as folded from it) and it is cancelled without merging. Nothing |
| // is deleted, so Undo restores it exactly. Any other pair is only named: |
| // the weaker task's DuplicateOf is the stronger one. A pair someone undid, |
| @@ -70,8 +71,10 @@ var errNotFoldable = errors.New("chat: not foldable") |
| // foldable re-reads both tasks inside the fold's transaction and checks |
| // everything a fold needs (Astra, housekeeping review): one creator who |
| // is still an active member, one project, neither ended, merging or |
| -// already folded, no open card on either, and nothing at work on the one |
| -// folded. Anything else never touches the other task. |
| +// already folded, no open card on the one folded (a decision still to |
| +// make; a card on the one kept stays open and does not block), and |
| +// nothing at work on the one folded. Anything else never touches the |
| +// other task. |
| func (t *txn) foldable(k, into taskRecord) (taskRecord, taskRecord, error) { |
| var err error |
| if k, err = t.loadTask(k.ID); err != nil { |
| @@ -99,7 +102,7 @@ func (t *txn) foldable(k, into taskRecord) (taskRecord, taskRecord, error) { |
| return k, into, err |
| } |
| var cards int64 |
| - if err := t.db.Model(&cardRecord{}).Where("task_id IN ? AND state = ? AND kind <> ?", []string{k.ID, into.ID}, wire.CardOpen, wire.CardTask).Count(&cards).Error; err != nil { |
| + if err := t.db.Model(&cardRecord{}).Where("task_id = ? AND state = ? AND kind <> ?", k.ID, wire.CardOpen, wire.CardTask).Count(&cards).Error; err != nil { |
| return k, into, err |
| } |
| var busy int64 |
diff --git a/internal/equipo/housekeeping/duplicates.go b/internal/equipo/housekeeping/duplicates.go| index 4ecb5b81..4a16ad61 100644 |
| --- a/internal/equipo/housekeeping/duplicates.go |
| +++ b/internal/equipo/housekeeping/duplicates.go |
| @@ -42,7 +42,8 @@ type View struct { |
| // TaskFact is one open task as a detector sees it. Stopped: its last step |
| // failed. Busy: a step is queued or running. Carded: an open card other |
| -// than its task card. Hidden: its creator is a test identity. |
| +// than its task card, a decision still to make (it blocks closing this |
| +// task, never keeping it). Hidden: its creator is a test identity. |
| type TaskFact struct { |
| ID string `json:"id"` |
| Title string `json:"title"` |
| @@ -132,7 +133,11 @@ func duplicates(v View, combine bool) []Finding { |
| if stronger(b, a) { |
| keep, fold = b, a |
| } |
| - combinable := high && keep.Creator == fold.Creator && keep.Stage != "merging" && fold.Stage != "merging" && !fold.Busy && !fold.Carded && !keep.Carded |
| + // Only a pending decision on the task that would close blocks |
| + // a combine; an open card on the one kept (staging's Woodstar |
| + // pair: a merge card) stays where it is (coordinator, |
| + // 2026-11-11, on Paul's "combine automatically with Undo"). |
| + combinable := high && keep.Creator == fold.Creator && keep.Stage != "merging" && fold.Stage != "merging" && !fold.Busy && !fold.Carded |
| ev := Evidence{Tasks: []TaskRef{{ID: fold.ID, Title: fold.Title, Creator: fold.Creator}, {ID: keep.ID, Title: keep.Title, Creator: keep.Creator}}, Similarity: float64(int(score*100+0.5)) / 100, Shared: shared} |
| f := Finding{Subject: Subject{Kind: SubjectTask, ID: fold.ID}, Owner: fold.Creator, SubjectRevision: fold.Revision, Evidence: ev} |
| switch { |
diff --git a/internal/equipo/housekeeping/testdata/duplicate_same_creator.json b/internal/equipo/housekeeping/testdata/duplicate_same_creator.json| index c126359c..76ec18a8 100644 |
| --- a/internal/equipo/housekeeping/testdata/duplicate_same_creator.json |
| +++ b/internal/equipo/housekeeping/testdata/duplicate_same_creator.json |
| @@ -58,10 +58,20 @@ |
| "proposal": {"action": "combine", "task": "tkB", "into": "tkA"}}] |
| }, |
| { |
| - "name": "an open card on either task keeps them apart", |
| + "name": "an open merge card on the task kept does not block: staging's Woodstar pair, the older one stopped", |
| "view": {"project": "p1", "tasks": [ |
| - {"id": "tkA", "title": "Alpha beta gamma delta", "creator": "p@x", "stage": "ready_to_merge", "revision": 1, "created_at": "2026-11-08T09:00:00Z", "carded": true}, |
| - {"id": "tkB", "title": "Alpha beta gamma epsilon", "creator": "p@x", "stage": "noted", "revision": 1, "created_at": "2026-11-08T09:05:00Z"}]}, |
| + {"id": "tks6kwzzdngr", "title": "iOS edge swipe to go back doesn't work", "creator": "p@x", "stage": "in_review", "revision": 7, "created_at": "2026-11-07T10:00:00Z", "stopped": true}, |
| + {"id": "tkf6dufnbzcg", "title": "Swipe back from the edge doesn't work", "creator": "p@x", "stage": "ready_to_merge", "revision": 9, "created_at": "2026-11-07T10:20:00Z", "carded": true}]}, |
| + "findings": [ |
| + {"detector": "duplicate_same_creator", "subject": {"kind": "task", "id": "tks6kwzzdngr"}, "owner": "p@x", "subject_revision": 7, "key": "duplicate:tkf6dufnbzcg:tks6kwzzdngr", |
| + "evidence": {"tasks": [{"id": "tks6kwzzdngr", "title": "iOS edge swipe to go back doesn't work", "creator": "p@x"}, {"id": "tkf6dufnbzcg", "title": "Swipe back from the edge doesn't work", "creator": "p@x"}], "similarity": 1, "shared": 3}, |
| + "proposal": {"action": "combine", "task": "tks6kwzzdngr", "into": "tkf6dufnbzcg"}}] |
| + }, |
| + { |
| + "name": "a pending decision on the task that would close keeps them apart", |
| + "view": {"project": "p1", "tasks": [ |
| + {"id": "tkA", "title": "Alpha beta gamma delta", "creator": "p@x", "stage": "ready_to_merge", "revision": 1, "created_at": "2026-11-08T09:00:00Z"}, |
| + {"id": "tkB", "title": "Alpha beta gamma epsilon", "creator": "p@x", "stage": "noted", "revision": 1, "created_at": "2026-11-08T09:05:00Z", "carded": true}]}, |
| "findings": [] |
| }, |
| { |
diff --git a/internal/thintest/duplicates_contract_test.go b/internal/thintest/duplicates_contract_test.go| index d4b24bef..2fd61de1 100644 |
| --- a/internal/thintest/duplicates_contract_test.go |
| +++ b/internal/thintest/duplicates_contract_test.go |
| @@ -174,23 +174,43 @@ func TestContractCombineDuplicates(t *testing.T) { |
| t.Fatal("a refused fold changed the other person's task") |
| } |
| - // An open card on either task keeps them apart (staging's pair: the |
| - // survivor waits on its merge card), and so does a creator no longer |
| - // on the team. |
| - ready := r.judgedTask("dc", "Timeline jumps when images load", strings.Repeat("3", 40), strings.Repeat("4", 40), wire.ChecksCannotRun, "needs_macos") |
| - r.wait("merge card", func(c *Conversation) bool { |
| + // An open card on the task kept does not keep them apart (the |
| + // coordinator, 2026-11-11, on staging's Woodstar pair: the survivor |
| + // waits on its merge card): the other is combined into it and the |
| + // card stays open. A decision still to make on the task that would |
| + // close does keep them apart, and so does a creator no longer on the |
| + // team. |
| + cardOn := func(c *Conversation, task string) bool { |
| for _, k := range c.Cards { |
| - if k.Kind == wire.CardMerge && k.TaskID == ready && k.State == wire.CardOpen { |
| + if k.Kind == wire.CardMerge && k.TaskID == task && k.State == wire.CardOpen { |
| return true |
| } |
| } |
| return false |
| - }) |
| + } |
| + mergeCard := func(task string) (open bool) { |
| + r.conv.Locked(func(c *Conversation) { open = cardOn(c, task) }) |
| + return open |
| + } |
| + ready := r.judgedTask("dc", "Timeline jumps when images load", strings.Repeat("3", 40), strings.Repeat("4", 40), wire.ChecksCannotRun, "needs_macos") |
| + r.wait("merge card", func(c *Conversation) bool { return cardOn(c, ready) }) |
| again := taskID(t, r.call("d10", wire.ToolRecordTask, map[string]any{"repo": "oficina/sample", "title": "Timeline jumps when the images load", "brief": "Again.", "separate": true})) |
| r.forgetPair(again, ready) |
| + if n := r.tidy(); n != 1 { |
| + t.Fatalf("an open merge card on the task kept blocked the combine: combined %d", n) |
| + } |
| + if k, _ := r.client.Task(ctx, again); k.Folded == nil || k.Folded.Into.ID != ready || k.Stage != wire.StageCancelled { |
| + t.Fatalf("not combined into the task with the merge card: %+v", k.Folded) |
| + } |
| + if k, _ := r.client.Task(ctx, ready); k.Stage != wire.StageReadyToMerge || !mergeCard(ready) { |
| + t.Fatalf("the task kept lost its merge card or moved: %s", k.Stage) |
| + } |
| + later := r.judgedTask("dd", "Timeline jumps when the images load late", strings.Repeat("5", 40), strings.Repeat("6", 40), wire.ChecksCannotRun, "needs_macos") |
| + r.wait("second merge card", func(c *Conversation) bool { return cardOn(c, later) }) |
| + r.forgetPair(later, ready) |
| r.tidy() |
| - if k, _ := r.client.Task(ctx, again); k.Folded != nil || k.DuplicateOf == nil || k.DuplicateOf.ID != ready { |
| - t.Fatalf("folded beside an open card: folded %+v, named %+v", k.Folded, k.DuplicateOf) |
| + if k, _ := r.client.Task(ctx, later); k.Folded != nil || k.DuplicateOf == nil || k.DuplicateOf.ID != ready { |
| + t.Fatalf("closed a task with a decision still open: folded %+v, named %+v", k.Folded, k.DuplicateOf) |
| } |
| one := taskID(t, b.call("d11", wire.ToolRecordTask, map[string]any{"repo": "oficina/sample", "title": "Compose sheet keyboard covers the send button", "brief": "x"})) |
| two := taskID(t, b.call("d12", wire.ToolRecordTask, map[string]any{"repo": "oficina/sample", "title": "Keyboard covers the compose sheet send button", "brief": "y", "separate": true})) |