Skip to content

feat: tidy up plan decline + sort/paginate tasks page#73

Merged
pufit merged 2 commits into
mainfrom
pufit/plan-decline-moves-task-to-done
May 13, 2026
Merged

feat: tidy up plan decline + sort/paginate tasks page#73
pufit merged 2 commits into
mainfrom
pufit/plan-decline-moves-task-to-done

Conversation

@pufit
Copy link
Copy Markdown
Member

@pufit pufit commented May 13, 2026

Two small UX improvements landing on one branch.

1. Plan decline moves task to done

Declining a plan now moves the related task to the done/ directory with a note. Previously the task was left in pending status while the plan transitioned to declined — leaving an orphan task that had to be closed manually.

  • UI: the Decline button expands an optional feedback textarea mirroring the existing Revise flow. A Confirm Decline button submits the action; the feedback is optional.
  • Backend: both PATCH /api/plans/{id} and the plan_decline MCP tool route through task_done so file movement and DB status stay consistent across surfaces.
  • Note text:
    • With feedback → Plan {id} declined — {feedback}
    • Without feedback → Related plan {id} was closed without a specified reason

2. Tasks page sort + pagination

  • Three sort orders: Deadline (default), Last update, Created.
  • 50-per-page pagination with prev/next controls and a Showing X–Y of N indicator.
  • Sort/page reset to defaults when the filter/search/status changes.
  • list_tasks gains sort and offset kwargs; new count_tasks helper returns the total ignoring pagination.
  • A stable secondary key (id DESC) is appended to every ORDER BY so equal timestamps don't shuffle between pages.
  • Each task card now shows a compact updated 2h ago label — makes the Last update sort visually meaningful.
  • Search is not paginated — it returns the top 100 BM25-ranked hits and the pagination row is hidden, since slicing relevance results across pages fights the ranking.

Verification

  • pytest tests/ -v542 passed (added one test covering sort orders, pagination slicing, and count_tasks).
  • npm run build clean.

Generated by Nerve

pufit added 2 commits May 13, 2026 16:46
Declining a plan now moves the related task to the done/ directory with
a note. The note is optional — if no feedback is supplied, the task gets
a generic 'closed without a specified reason' comment instead.

UI: the Decline button now expands an optional feedback textarea
mirroring the Revise flow, with a 'Confirm Decline' button that submits
the action (empty feedback allowed).

Backend: both the HTTP PATCH /api/plans/{id} route and the plan_decline
MCP tool route through task_done so file movement and DB status stay
consistent across surfaces.
Adds three sort orders (deadline, last update, created) and 50-per-page
pagination with prev/next controls and a 'Showing X-Y of N' indicator.

DB: list_tasks gains sort and offset kwargs with a stable secondary key
(id DESC) so equal timestamps don't shuffle between pages; new
count_tasks helper returns the total ignoring pagination.

API: /api/tasks accepts sort/limit/offset and returns
{tasks, total, limit, offset}. Unknown sort silently falls back to
default; limit clamped to [1, 200]. Search route keeps relevance order
and stays unpaginated (top 100 hits).

UI: a 'Sort by' dropdown appears next to the New Task button (hidden
during search). Each task card now shows a compact 'updated 2h ago'
label so the Last update sort is visually meaningful.
@pufit pufit merged commit 814123b into main May 13, 2026
@pufit pufit deleted the pufit/plan-decline-moves-task-to-done branch May 13, 2026 20:55
constkolesnyak pushed a commit to constkolesnyak/nerve that referenced this pull request May 17, 2026
When plan_decline started moving the related task to done (PR ClickHouse#73),
the de-facto 'decline + re-propose' flow for refining an agent's own
plan stopped working — the task gets closed before the v2 propose
can land cleanly.

This adds a dedicated plan_update(plan_id, content, feedback?) tool
that mirrors what plan_propose already does on re-propose but in a
single explicit step:

  - Marks the old pending plan as 'superseded' (not 'declined')
  - Optionally stores feedback on the old plan
  - Creates a new plan with version = old.version + 1 and
    parent_plan_id pointing at the old one
  - Leaves the task untouched (no done transition, no status change)
  - Writes a 'Plan updated: …' note to the task history

The tool is session-scoped so the new plan is attributed to the
agent that made the revision. plan_revise's outbound prompt now
tells the planner to use plan_update instead of plan_propose so the
version history stays linked instead of producing an orphan.

Docs, worker/personal AGENTS templates, and the chat PlanToolBlock
renderer are updated. plan_decline still moves the task to done —
that semantic ('the effort is being abandoned') is kept distinct
from plan_update ('refine my own plan').
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant