feat: tidy up plan decline + sort/paginate tasks page#73
Merged
Conversation
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.
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').
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 inpendingstatus while the plan transitioned todeclined— leaving an orphan task that had to be closed manually.PATCH /api/plans/{id}and theplan_declineMCP tool route throughtask_doneso file movement and DB status stay consistent across surfaces.Plan {id} declined — {feedback}Related plan {id} was closed without a specified reason2. Tasks page sort + pagination
Showing X–Y of Nindicator.list_tasksgainssortandoffsetkwargs; newcount_taskshelper returns the total ignoring pagination.id DESC) is appended to every ORDER BY so equal timestamps don't shuffle between pages.updated 2h agolabel — makes the Last update sort visually meaningful.Verification
pytest tests/ -v→ 542 passed (added one test covering sort orders, pagination slicing, andcount_tasks).npm run buildclean.