fix(ploeg): settle stopped Work Items whose tracker task was closed #200

Merged
ryangr0 merged 1 commit from ryangr0/ploeg-settle-closed-stopped-items into development 2026-10-03 15:14:19 +00:00 AGit
Owner

Summary

Closing a tracker task now settles a stopped Work Item (needs_human or awaiting_review) instead of leaving it in Vloer's "Needs you" list. Before this change, Ploeg withdrew a Work Item on close only while it was queued and no Run had started.

  • Close webhook: a stopped item moves to withdrawn with reason withdrawn_closed and an audit row with actor webhook:<provider> (store.SettleClosedInTracker). An item with a running Run is not touched, and an operator-owned item is left unchanged.
  • Missed webhooks: the Shift sweep re-reads the tracker task of each stopped item at most once every 15 minutes and settles the ones the tracker reports done (actor sweep:<provider>). Each read has a 10 s timeout and each sweep reads at most 20 items. Migration 0036_tracker_checked_at.sql adds work_items.tracker_checked_at. FetchItem reports a closed task through the new WorkItem.Closed field (json:"-", so no contract schema changes) for Vikunja and ClickUp.
  • Ploeg posts no tracker comment for this change and leaves an open pull request alone.
  • Re-opening the task does not bring the item back. Assigning it again re-queues it, as before.
  • Docs: docs/concepts/journeys.md and docs/how-to/assign-work-to-an-agent.md.

Ticket: https://vikunja.webgrip.dev/tasks/1615

Tests

  • New regression test TestClosingATaskSettlesStoppedWorkWithoutAComment (httpapi). It fails on the old code: "closing a awaiting_review item left it {state:awaiting_review ...}".
  • New tests: TestSettleClosedInTracker*, TestReassigningASettledItemStartsNewWork and TestClaimStoppedTrackerChecksIsRateLimitedPerItem (store), and TestSweepSettlesStoppedItemsWhoseTaskClosedWithoutAWebhook (shiftengine, against an httptest Vikunja).
  • cd apps/ploeg && go test -count=1 ./...: 34 packages ok, 0 failed. go vet ./...: clean.
  • mise run verify: all gates passed (vloer 7, demo-replay 1, vloer-extension 4, ploeg 7, brand 1, site 5, site-demo 1, helm 15, release 3, integration 1, docs 1).

Checks left to CI

None. Every gate ran locally. The docs gate used a scratchpad virtualenv (UV_PROJECT_ENVIRONMENT) because the worktree's .venv could not be created.

After deploy

VIK-1279's Work Item should settle on the first sweep without anyone touching it. Check that the operator API no longer lists it under "Needs you".

🤖 Generated with Claude Code

## Summary Closing a tracker task now settles a stopped Work Item (needs_human or awaiting_review) instead of leaving it in Vloer's "Needs you" list. Before this change, Ploeg withdrew a Work Item on close only while it was queued and no Run had started. - Close webhook: a stopped item moves to `withdrawn` with reason `withdrawn_closed` and an audit row with actor `webhook:<provider>` (`store.SettleClosedInTracker`). An item with a running Run is not touched, and an operator-owned item is left unchanged. - Missed webhooks: the Shift sweep re-reads the tracker task of each stopped item at most once every 15 minutes and settles the ones the tracker reports done (actor `sweep:<provider>`). Each read has a 10 s timeout and each sweep reads at most 20 items. Migration `0036_tracker_checked_at.sql` adds `work_items.tracker_checked_at`. `FetchItem` reports a closed task through the new `WorkItem.Closed` field (`json:"-"`, so no contract schema changes) for Vikunja and ClickUp. - Ploeg posts no tracker comment for this change and leaves an open pull request alone. - Re-opening the task does not bring the item back. Assigning it again re-queues it, as before. - Docs: `docs/concepts/journeys.md` and `docs/how-to/assign-work-to-an-agent.md`. Ticket: https://vikunja.webgrip.dev/tasks/1615 ## Tests - New regression test `TestClosingATaskSettlesStoppedWorkWithoutAComment` (httpapi). It fails on the old code: "closing a awaiting_review item left it {state:awaiting_review ...}". - New tests: `TestSettleClosedInTracker*`, `TestReassigningASettledItemStartsNewWork` and `TestClaimStoppedTrackerChecksIsRateLimitedPerItem` (store), and `TestSweepSettlesStoppedItemsWhoseTaskClosedWithoutAWebhook` (shiftengine, against an httptest Vikunja). - `cd apps/ploeg && go test -count=1 ./...`: 34 packages ok, 0 failed. `go vet ./...`: clean. - `mise run verify`: all gates passed (vloer 7, demo-replay 1, vloer-extension 4, ploeg 7, brand 1, site 5, site-demo 1, helm 15, release 3, integration 1, docs 1). ## Checks left to CI None. Every gate ran locally. The docs gate used a scratchpad virtualenv (`UV_PROJECT_ENVIRONMENT`) because the worktree's `.venv` could not be created. ## After deploy VIK-1279's Work Item should settle on the first sweep without anyone touching it. Check that the operator API no longer lists it under "Needs you". 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(ploeg): settle stopped Work Items whose tracker task was closed
Some checks are pending
[Workflow] On Pull Request / checks (pull_request) Waiting to run
[Workflow] On Pull Request / warnings (pull_request) Blocked by required conditions
[Workflow] On Pull Request / release-policy (pull_request) Waiting to run
4dd9849767
A task closed in the tracker withdrew its Work Item only while the item
was queued and no Run had started. A needs_human or awaiting_review item
whose task a person closed by hand stayed in Vloer's "Needs you" list
indefinitely: VIK-1279 was done and merged, yet still showed "Needs you".

The close webhook now settles a stopped item to withdrawn with reason
withdrawn_closed, audited as webhook:<provider>. An item with a running
Run, or one owned by an operator execution, is left alone. Ploeg posts
no tracker comment for this and leaves any open pull request open.

The Shift sweep catches missed close webhooks: it re-reads the tracker
task of each stopped item at most once per 15 minutes (migration 0036
adds work_items.tracker_checked_at) and settles the ones the tracker
reports done. FetchItem now reports that through WorkItem.Closed for
Vikunja and ClickUp. A re-opened task does not bring the item back;
assigning it again starts new work as before.

VIK-1615
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ryangr0 merged commit 91a0bce473 into development 2026-10-03 15:14:19 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
webgrip/unfold!200
No description provided.