spec: tasks dedup key, worker, results #17
No reviewers
Labels
No labels
agent
blocked
agent
new
agent
review
agent
working
complexity
high
complexity
low
priority
high
priority
low
priority
medium
risk
high
risk
low
risk
medium
type
bug
type
chore
type
feature
type
security
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
tfks/trippin!17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/task-queue-dedup-results"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs: #8
Summary
Draft spec proposal — propose phase, no implementation. Cherry-picks three fields from fotolog's
taskstable into ours:key text NOT NULL+ partial unique index on(key) WHERE status IN ('pending','processing')— duplicate enqueues of the same logical task become idempotent.worker text— set on claim fromWORKER_IDenv (fallbackhostname:pid) so DB state correlates to a worker process.results jsonb— handlers may return a JSON-serializable value; worker persists it in the sameUPDATEthat marks the rowdone.enqueueTask(db, type, payload, key?)gains an optionalkey; default istype:sha256(canonical_json(payload)).slice(0,16), so existing call sites need no changes to get dedup.ON CONFLICT DO NOTHINGreturns the existing active row's id when an identical enqueue collides.New migration
0002_tasks_dedup_results.sql;0001is not edited.Artifacts
openspec/changes/task-queue-dedup-results/proposal.mdopenspec/changes/task-queue-dedup-results/design.mdopenspec/changes/task-queue-dedup-results/specs/task-queue/spec.md(MODIFIEStask-queuevia ADDED Requirements)openspec/changes/task-queue-dedup-results/tasks.mdopenspec validate task-queue-dedup-results --strictpasses.Review focus
type:sha256(canonical_json(payload)):16— is the contract for accidental-dedup behaviour. Right window? Right hash slice length?ON CONFLICT DO NOTHINGfollowed by aSELECTto return the existing id — preserves the "always return an id" contract; the small extra round-trip on collision is acceptable.Test plan
/spec-approved; tests defined intasks.md §5will be added in the apply phase.agent-dev referenced this pull request2026-05-22 16:19:17 +00:00