Skip to content

[PR #4100] Preserve task drafts and panel context - #4100

Merged
ymichael merged 8 commits into
get-bb:mainfrom
jem-computer:jem/clean-up-bb-task-plugin-thr_ywbsrpxyug
Oct 1, 2026
Merged

ymichael merged 8 commits into
get-bb:mainfrom
jem-computer:jem/clean-up-bb-task-plugin-thr_ywbsrpxyug

Conversation

@jem-computer

Copy link
Copy Markdown
Contributor

Human comments

bugbashing a few overlapping things that bit me today:

  • New Task modal could overflow the screen, leaving you unable to view the whole body or click the submit button (I wrote a long task and couldn't submit it)
  • When you exit the modal e.g. by clicking outside of it, you lost your content (I lost a long task I hadn't submitted yet)
  • Move tasks between projects

What was wrong

Three gaps in the Tasks plugin. The New task dialog had no height cap, so a long description pushed the Create task button below the viewport with no way to scroll to it. The dialog held its fields only in component state, so any dismissal (outside click, Escape, reload) threw away everything typed. And there was no way to move a task to a different project: project_id and the per-project task number were fixed at creation, labels are project-scoped, and task keys (OPS-3) are derived from the project prefix. Changing projects therefore also changes the key, which breaks every stored reference (mentions, URLs, agents told to bb tasks comment OPS-3).

What changed

New task dialog layout (views/manage/new-task-dialog.tsx)

  • The dialog is capped at 85dvh as a flex column. The description editor scrolls, and the title, attribute chips and footer stay pinned. A long staged-attachment tray is capped too. This works in both the desktop dialog and the compact drawer.

Draft persistence (views/manage/new-task-draft.ts, new-task-dialog.tsx)

  • Title, description, project, status, priority, labels and due date save to localStorage (bb-tasks:new-task-draft, versioned, validated with zod on read) as they change.
  • The draft restores on the next open and is cleared once the task is created. A Discard draft button appears while there is content.
  • Staged attachments are not persisted, because File objects can't be serialized.

Move tasks between projects

  • Store: new moveTaskToProject transaction. It allocates fresh numbers in the target project, places moved tasks at the end of their status column, and remaps labels by name (case-insensitive), creating any that are missing with the same color.
  • Sub-tasks move with their parent. A sub-task moved on its own is detached from its parent, because the existing "sub-task must share its parent's project" rule still holds.
  • Schema v7: new task_key_aliases (prefix, number, task_id) table. getTaskByKey falls back to it, so old keys keep resolving. Live keys always win over aliases, so a reused prefix/number is unaffected.
  • RPC: moveTaskToProject { taskId, projectId, authorName } returns the existing task mutation result. Each moved task gets a system comment, Moved from OPS-1 to HOME-5 by …, and tasks:changed is published for both the source and target projects.
  • CLI: bb tasks move <key-or-id> --project <prefix-or-id> [--json]. It is documented in the plugin README, PLUGIN_OVERVIEW.md and the tasks skill.
  • UI: the detail view's Project row (rail and compact inline chips) is now a searchable picker, and the list row context menu has a Move to project submenu. The detail view replaces the URL with the task's current key, so old links redirect.

No server/daemon wire changes. The changes are plugin-internal only.

How you verified

  • pnpm exec turbo run typecheck test --filter=bb-plugin-tasks: 401 tests pass. New tests:
    • API: moving a parent with a sub-task and labels. This covers new keys, alias resolution (including lower-case), label reuse/creation, positions, system comments and realtime signals. Also a sub-task detach, the same-project no-op (no signals), live keys winning over aliases after a prefix is reused, and moving back.
    • CLI: bb tasks move output, old-key show, and the JSON no-op.
    • UI: the rail project picker only fires for a different project. The dialog restores a dismissed draft, clears it on create and on Discard, and ignores a malformed stored draft.
  • oxlint plugins/tasks: no new findings compared with main.
  • Manual, in an isolated dev instance (pnpm dev, fresh data dir, seeded with bb tasks seed-demo), driven through headless Chrome:
    • With a 60-line description at 1280×800, the dialog is 680px tall, the editor scrolls, and Create task stays visible and works. This was also checked in the 390×760 compact drawer.
    • I typed a title and a formatted description, clicked outside, reloaded, and reopened: the draft was restored and was cleared after creating.
    • I moved OPS-1 (which has a sub-task) to Personal from the detail picker: it became HOME-5/HOME-6, the label was recreated, and /task/OPS-1 redirected to HOME-5. I moved OPS-3 from the list context menu: it became TASKS-5, and bb tasks show OPS-3 resolved it.

AGENT GENERATED

🤖 Generated with Claude Code

Jem Gold and others added 3 commits September 22, 2026 12:44
…tions

Cap the dialog at 85dvh and scroll the description editor so the Create
task button stays reachable.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Dismissing the dialog discarded everything typed. The title, description,
project, status, priority, labels, and due date now save to localStorage
as they change, restore on the next open, and clear once the task is
created or the draft is discarded.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Add moveTaskToProject (RPC, bb tasks move, detail Project picker, and a
list context-menu submenu). A moved task and its sub-tasks take new keys
in the target project; old keys stay resolvable through a new
task_key_aliases table so links, mentions, and agents using the old key
keep working, and stale detail URLs redirect to the current key. Labels
are matched by name in the target project and created when missing. A
sub-task moved on its own is detached from its parent. Each moved task
gets a system comment recording the old and new keys.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@ymichael ymichael changed the title Tasks quality of life bug-bashes [PR #4100] Preserve task drafts and panel context Sep 30, 2026
@ymichael

ymichael commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Final reviewer handoff: 713ed1f. Open, clean/mergeable and unmerged.

The latest human-reported issue affects all three New task Select controls: in narrow Chrome, clicking a chevron and then its original coordinates again closed the entire task drawer. The initial Project-only patch was incomplete. Project, Status and Priority now share one local typed responsive Popover/Command picker, using the existing persistent drawer lifecycle. Selection/dismissal closes its own layer and preserves the parent/draft. Stable option values distinguish same-name projects; labels/prefixes remain searchable. Labels already uses a responsive multi-select and was explicitly verified. Native date input is unchanged. No shared UI, API, SDK, wire, schema or storage-version changes.

Validation:

  • 422 Tasks tests, build/lint/typecheck pass; 24 shared drawer tests pass. The owner regression is extended across all three controls, with pre-fix Status/Priority failures recorded before repair.
  • Actual Chrome at 390×760: original-coordinate double clicks preserve New task for all three; selections retain title. Labels toggling/Escape preserves the parent. OPS-20 persists Operations, In Progress, High and Automation. Prefix search/keyboard selection also works.
  • Actual iPhone17Pro iOS26.5 Simulator Safari: native automated selections for all four controls, then scripted title input and ordinary Create, produce OPS-21 with Operations/In Progress/High/Automation; source CLI confirms. Status/Priority taps use screen positions derived from inspected screenshots after ambiguous native selectors failed. This is Simulator automation, not human/physical-device QA.
  • Full upstream CI passed at this exact head: CI 36816768440, Version Lockstep, PR Gate. Existing native mobile label gates and provider/Node event skips remain unchanged. Authorized final-head approvals used the ordinary endpoint; no permissions/protection/allowlists changed.

The earlier approved draft-project/valid-label, embedded-alias, move/alias and current-main windowed-list fixes remain intact. Their earlier commit-specific evidence is preserved. Safari editor-focus autozoom/clipping remains a pre-existing documented limitation; this patch does not claim to fix it.

The clean pushed branch serves the persistent review app. Refresh before testing. HANDOFF.md starts with the short all-picker reproduction/checklist; TECHNICAL_HANDOFF.md includes inline before/after evidence, exact provenance and remaining limitations. Normal fast-forward pushes preserved contributor work. No merge.

AGENT GENERATED

@ymichael
ymichael merged commit d7ae158 into get-bb:main Oct 1, 2026
18 checks passed
smsunarto added a commit to smsunarto/bb-plugins that referenced this pull request Nov 19, 2026
…3) (#187)

* fix(scott-tasks): return a saved comment before agent delivery finishes

Port of upstream get-bb/bb#4679. The app's createComment waited for the
thread lookup and send before answering, so a slow or stuck worker
held the composer. The app now returns the saved comment at once and
delivers in the background; the CLI still waits so it can report the
notified count.

* feat(scott-tasks): move a task and its sub-tasks to another project

Port of the server and CLI half of upstream get-bb/bb#4100. A moved
task gets a fresh number in the target project, lands at the end of its
status column, and keeps its old key as an alias, so mentions and agent
instructions that name the old key still resolve. Labels are remapped
by name and created when missing. A sub-task moved on its own leaves
its parent. New: moveTaskToProject RPC and bb tasks move.

* feat(scott-tasks): move tasks from the detail page and the list's context menu

The UI half of upstream get-bb/bb#4100. The properties rail and inline
chips get a project picker, and a list row's context menu gets Move to
project. Opening a task by a key it had before a move asks the server
and follows the task to its current key.

* feat(scott-tasks): keep New task drafts and cap the dialog's height

The dialog half of upstream get-bb/bb#4100. Title, description and
attributes save to localStorage as they change, so an outside click,
Escape or reload no longer throws a long task away; Discard draft
clears it. The dialog is capped at 85dvh with the description
scrolling, so Create task stays reachable.

* fix(scott-tasks): port upstream touch, embed and download fixes

- get-bb/bb#5097: label and preset row actions stay visible on screens
  without hover, such as a 13-inch iPad.
- get-bb/bb#5157: a narrow desktop pane keeps the compact topbar; only
  touch screens get the taller one.
- get-bb/bb#5903: the whole task embed card opens the task, and a
  loading card no longer highlights on hover.
- get-bb/bb#5508: attachment downloads go through bb's saveFile, which
  the iOS shell implements with WebKit's native download.

* docs(scott-tasks): document bb tasks move; drop unused hono and cron-parser

hono 4.11.9 was a vulnerable pin that nothing imports; cron-parser is unused too.

* feat(scott-tasks): delegate as a child thread from a chosen base branch

bb tasks delegate takes --parent-thread, --parent-notifications auto|stuck|off and --base-branch, passed to threads.spawn. An orchestrating agent dispatches its crew as children so bb reports their turns to it, and starts each worktree from its own branch. --base-branch always means a new worktree, whatever the preset names, and leaves the preset unchanged.

* fix(scott-tasks): let the attachment preview's img own its object URL

Attachment chips set state in an effect to hold the preview URL; the <img> ref callback now creates and revokes it. Clears a react(set-state-in-effect) lint error.

* feat(scott-tasks): owned fields, crew snapshot and parent wakes for Captain

- defineField/setField: typed fields only the owning plugin may write; a write
  bumps the task's updated_at.
- crewSnapshot({threadIds, changedSince}): one read of task, parent, fields,
  preset, live status and the last notifying comment with its delivery state.
- bb tasks comment --notify-parent sends a one-line wake to the commenting
  thread's parent and retries from the database (1, 2, 5, 15 min; 6 attempts),
  then marks it undeliverable; --attach puts files on the comment first.
- delegate takes reportContract and drops its built-in contract under stuck;
  taskThreadsAttach keeps presetName; plugin callers may author comments.
- Task threads get an archived live status that unarchive reverses.

* perf(scott-tasks): drop unused toolbar and command exports

Cuts 10 KB of app.css that Tailwind generated for components nothing imports.

* fix(scott-tasks): let the list's empty state fill the scroller

Port of get-bb/bb#7613's Tasks part: the list's size container moves inside the scroller, and the empty state grows to fill it.

* fix(scott-tasks): resolve CLI file paths with the target host's path rules

Port of get-bb/bb#6760: file flags resolve with the SDK's host-path parser, so Windows drive and UNC paths from a remote thread resolve on that machine instead of with the server's node:path.

* refactor(scott-tasks): drop store inputs nothing passes

Port of the Tasks part of get-bb/bb#4606: create inputs no longer take an id, comment updates take only notifiedCount, attachment updates only blobPath, and new comments rely on the column's 0 default. The tie-break test sets its ids with SQL, as upstream's does. Skipped: upstream blanking the is_image migration (it already ran here), and displayWidth and the description saver's schedule option, which fork tests still use.

* test(scott-tasks): cover list scope switches while reads are pending

Ports get-bb/bb#7056's regression tests. Upstream fixed a list stuck behind placeholders when it switched scope to a cached list; the fork's collection-backed list already passes them, so no code change was needed. All shows every task the shared collection holds, so the All step checks no absent row.

* fix(scott-tasks): apply resize-measured layout in the resize frame

Port of get-bb/bb#7635's Tasks part. The board-width check and the list's row window read their size in a shared ResizeObserver and write it inside flushSync, so a resize never paints one frame of the old layout. lib/shared-resize-observer.ts is vendored from upstream's registry, which the desktop-v0.49.0 pin predates. The row window measures through a plain function of the element so the mount read stays a ref-derived layout measurement.

* docs(scott-tasks): record the upstream sync to get-bb/bb 48c3a78

Names the new upstream base and every change the fork holds, with the reason for each.

* fix(scott-tasks): settle the list's scroll scope during render, not from a ref

ListView read settledScope.current during render, the one oxlint error left in scott-tasks (react(refs)), so bunx oxlint on the plugin failed. The settled scope is now state set during render, like the saved preference above it, and settles in the same render its rows finish loading.

* fix(scott-tasks): stop an expired wake attempt from sending after a retry

Promise.race ended the 30s wait but not the attempt, so a stalled thread lookup could resume after a retry had delivered and wake the parent twice. The deadline now aborts the attempt's signal, and the attempt re-checks right before threads.send (and before recording a target) that it is unexpired and still the latest claim on a pending record. Review's deterministic repro is the regression test; it fails on the old code.

* chore(scripts): prune the resolved scott-tasks list refs baseline entry
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.

2 participants