Skip to content

Plans: adopt bb 0.43.1 metadata pointer, queue-cancel events, and host icons - #61

Merged
erwinkn merged 7 commits into
mainfrom
bb/plans-bb-0-43-thr_sepeapi8k8
Sep 13, 2026
Merged

erwinkn merged 7 commits into
mainfrom
bb/plans-bb-0-43-thr_sepeapi8k8

Conversation

@erwinkn

@erwinkn erwinkn commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Summary

Adopts bb 0.43.x capabilities in the plans plugin (WP0 + WP3 of the approved 0.43 adoption plan):

  • WP0: @get-bb/plugin-sdk bumped to 0.4.87; bb plugin types clean; typecheck + 182 tests pass.
  • Icons: HugeIcons copies replaced by experimental_Icon on the host registry. lib/host-icon-names.ts is generated from bb desktop-v0.43.1 by scripts/host-icon-names.mjs; icon names are compile-time checked and every call passes a fallback. plans-keyboard and plans-strikethrough are registered by the plugin since bb does not ship them. Frontend bundle: 230 KB → 114 KB.
  • Metadata pointer: submit, update, and approval write { activePlanId, status, version } to the thread's plans metadata namespace. The database stays authoritative — bb plans get without an ID resolves the pointer and only returns the plan when it belongs to the calling thread. Deletes move the pointer to the newest remaining plan or remove the keys. Writes are best-effort and serialized per thread. engines.bb raised to >=0.43.1.
  • message.cancelled: deleting the plugin's queued row marks its batch cancelled (new outbox state), clears delivery metadata, resends nothing, and restores the review prompt. Cards show Not delivered · cancelled; a cancelled approval shows Approval not delivered · cancelled in the footer.
  • thread.unarchived: clears the unavailable notice and restores the review hold for an open plan; feedback dropped at archive time is not replayed.

Live verification (bb 0.43.1, plugin running from this worktree)

  • bb plans submit → thread_plugin_metadata row for the calling thread: {"activePlanId":"e12d4095…","status":"open","version":1}; bb plans get with no ID resolved the pointer and returned the plan; bb plans update → version:2; a second thread's submit wrote its own row (thr_3tmnkd2672).
  • Review-hold interaction Review plan: … appears pending on the plan's thread after submit.
  • Annotation added from another thread while this thread was busy → outbox queued, queue row qmsg_5fn4d4a3tc. bb thread queue delete → outbox row cancelled, delivery cleared, nothing resent, review hold restored (pint_e9rk9ipshm). Panel Comments view shows #1 Comment · Not delivered · cancelled (screenshot).
  • Plan bound to a scratch thread, thread archived, annotation added → outbox dropped, delivery.notice = "The linked thread is archived or deleted. Feedback was not delivered." bb thread unarchive → notice cleared, review hold restored (pint_q55hn49pdk), dropped row stays dropped.
  • bb plans review --approve from another thread → status:"approved", metadata {"status":"approved","version":2}, hold released, approval event queued for delivery.
  • Tested at commit 113290e.

Test plan

  • npm run typecheck clean; npm test 182/182; npm run build clean
  • Live: metadata pointer on submit/update/approve, per-thread attribution, pointer resolution in bb plans get
  • Live: queued-message cancellation → cancelled state, Not delivered · cancelled in panel, no resend
  • Live: archive → dropped + notice; unarchive → notice cleared + hold restored, no replay
  • Desktop panel renders host icons and cancelled/approval labels (headless Chromium screenshots in thread storage)

Draft until Erwin asks for ready.

exedev and others added 3 commits September 13, 2026 08:44
Pinned with bb plugin types on bb 0.43.1. Typecheck and tests pass unchanged.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Replace the copied HugeIcons sets with experimental_Icon. lib/host-icon-names.ts
is generated from bb desktop-v0.43.1 by scripts/host-icon-names.mjs, so every
icon name is checked at compile time and each call still passes a fallback.
Keyboard and strikethrough glyphs, which bb does not ship, are registered by the
plugin as plans-keyboard and plans-strikethrough. The Comments view icon uses the
host MessageSquare. The frontend bundle shrinks from 230 KB to 114 KB.

engines.bb is raised to >=0.43.1 for the metadata pointer in the next commit.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
…handling

- Submit, update, and approval write { activePlanId, status, version } to the
  thread's plugin metadata (plans namespace); deleting a plan moves the pointer
  to the newest remaining plan or removes the keys. The database stays
  authoritative: bb plans get without an ID resolves the pointer and only
  returns the plan when it belongs to the calling thread. Writes are
  best-effort and serialized per thread.
- message.cancelled: when the user deletes the plugin's queued row, its batch
  becomes a new outbox state 'cancelled', delivery metadata is cleared, nothing
  is resent, and the review prompt is restored. Cards show
  'Not delivered · cancelled'; a cancelled approval is shown in the footer.
  A row cancelled while an append is in flight is no longer treated as
  delivered.
- thread.unarchived: clears the unavailable notice and restores the review
  hold for an open plan. Feedback dropped at archive time stays dropped.
- Docs: README, PLUGIN_OVERVIEW, and the plan-review skill.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@erwinkn
erwinkn marked this pull request as ready for review September 13, 2026 11:36
Comment thread plugins/plans/server/session.ts Resolved
Comment thread plugins/plans/README.md Resolved
A message.cancelled for the row send() just created could arrive before
deliver() persisted delivery.queuedMessageId; the subscriber's pointer match
dropped the event and recovery later reconciled the batch as delivered even
though its message was deleted. Sessions now record cancellations that arrive
while a send is in flight and settle them when the queued result returns; the
subscriber routes every matching-thread cancellation to the session instead of
pre-filtering on the persisted pointer. The review prompt is only restored when
a cancellation actually applied. Point the icon-name regeneration note at the
generator's landing PR until it merges. Addresses Macroscope findings on #61.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@erwinkn

erwinkn commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

Addressed both findings in fba1db0:

  • session.ts:91 (High) — valid. A message.cancelled for the row send() just created could arrive before deliver() persisted delivery.queuedMessageId; the subscriber's pointer match dropped it and recovery later reconciled the batch as delivered. Sessions now record cancellations that arrive while a send is in flight and settle the batch as cancelled when the queued result returns; the subscriber routes every matching-thread cancellation and lets the session match. The review hold is only restored when a cancellation actually applied. Regression tests cover both the in-flight-row case and an unrelated-row cancellation while busy (184 tests pass).
  • README.md:267 (Low) — valid. The generator lands with Add a generator for bb's built-in host icon names #53; the README now says so and gives the fetch command from its branch until it merges.

Re-verified live on fba1db0 (plugin reloaded from the worktree): annotation → queued row qmsg_aix9g3e7x4 → bb thread queue delete → outbox cancelled, delivery cleared, nothing resent, review hold restored (pint_hcsecnzdbt). Approve path re-checked: metadata {"status":"approved","version":1}.

exe.dev user and others added 2 commits September 13, 2026 12:53
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread plugins/plans/server.ts Resolved
Comment thread plugins/plans/server/metadata.ts Resolved
- create, update, approve and remove now await the metadata sync so a
  `bb plans get` issued right after the mutation resolves the fresh pointer
  instead of reading a stale or absent one.
- annotationDeliveryStatus reports only the newest outbox row per annotation,
  so a cancelled batch superseded by an edited and redelivered annotation no
  longer keeps the Not-delivered badge.
- The per-thread write chain map drops entries once drained, so a long-lived
  plugin does not accumulate a settled promise per thread.

Addresses Macroscope findings on the merged head of #61.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@erwinkn
erwinkn merged commit a6d66a4 into main Sep 13, 2026
3 checks passed
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