Skip to content

feat(tasks): add owner-private Nostr task events - #5757

Open
FurnitAI wants to merge 6 commits into
block:mainfrom
FurnitAI:codex/buzz-tasks-pr1
Open

feat(tasks): add owner-private Nostr task events#5757
FurnitAI wants to merge 6 commits into
block:mainfrom
FurnitAI:codex/buzz-tasks-pr1

Conversation

@FurnitAI

@FurnitAI FurnitAI commented Aug 13, 2026

Copy link
Copy Markdown

Summary

  • add signed Buzz Tasks v1 kinds and strict payload/envelope validation
  • keep public reads on the existing NIP-98 /query and NIP-42 Nostr surfaces; the buzz_tasks table is internal derived state only
  • add atomic projection transitions plus kind-5/kind-9005 deletion replay
  • use the existing (created_at DESC, id ASC) bridge keyset cursor and cover create/update/resolve mutations between pages
  • p-gate task content, apply result-level owner gates, and deny task kinds in global FTS even on brownfield search vectors
  • keep only canonical community_id, channel_id, and source Nostr event identity; construct buzz://message?channel=<uuid>&id=<event-id> after authorization
  • add the agent-first client surface: buzz-sdk task builders and the buzz tasks CLI group (request/update/resolve/list)

Review findings resolved

  • P1 Nostr-first: removed the task-specific GET /api/buzz-tasks routes and DTO/list implementation. Clients use signed Nostr filters through /query; no new permanent HTTP task contract remains.
  • P1 deletion projection: task event deletions now tombstone and rebuild derived state from remaining live signed events in the same transaction for both standard kind 5 and admin kind 9005 paths.
  • P2 pagination: removed the OFFSET task cursor with the deleted list API. The documented public cursor is the bridge keyset over the complete deterministic (created_at, id) order.
  • P1 agent-first CLI: kinds 44300–44302 now have the required buzz-cli command surface. buzz-sdk gains TaskRef + build_task_requested/updated/resolved (round-trip locked to TaskEventV1::parse), and buzz tasks request|update|resolve|list signs, re-validates through the exact task contract, and submits. The owner p tag defaults from the NIP-OA auth tag. Because task reads are owner-gated, update/resolve take the original request's signed identity explicitly and list is the owner-side #p view.
  • P2 duplicate requests: an equal-version kind-44300 for an existing task identity with a differing payload now returns an error and rolls back the event insert instead of committing a second, unfoldable v1 request as Stale. Only a payload identical to the stored v1 projection remains Stale, mirroring the equal-version conflict rule in require_open_newer.

Migration gate

Migration 0031 creates only the empty buzz_tasks projection and its constraints/index/write fence in one SQLx transaction with a 5-second lock_timeout. It does not alter events.search_tsv, rewrite events, or rebuild the GIN index. Lock behavior, interruption recovery, rollback, production-volume implications, and the separate staged FTS hardening plan are documented in docs/buzz-tasks-migration-plan.md.

Verification

  • ./bin/just ci
  • ./bin/just test
  • cargo test -p buzz-core --test task_contract — 6 passed
  • cargo test -p buzz-db --test task_projection -- --include-ignored --test-threads=1 — 8 passed against PostgreSQL (includes the new conflicting-duplicate rollback test)
  • cargo test -p buzz-sdk — 258 passed (includes the task builder contract round-trip)
  • cargo test -p buzz-cli — 344 passed (includes the tasks command registry and parser tests)
  • targeted clippy with -D warnings — passed

Scope boundary

PR 1 adds no task UI, reply/approval/choice/resolve API, preferences, EventKit/Reminders integration, or HTTPS/universal-link support. The HTTPS/universal-link security review remains a separate delivery before PR 2. Do not merge until the renewed review is complete.

@FurnitAI
FurnitAI requested a review from a team as a code owner August 13, 2026 11:00

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d5eebf5440

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/buzz-relay/src/router.rs Outdated
Comment thread crates/buzz-db/src/task.rs Outdated
Comment thread crates/buzz-db/src/task.rs Outdated
@FurnitAI FurnitAI changed the title feat(tasks): add private task projection API feat(tasks): add owner-private Nostr task events Aug 13, 2026
@FurnitAI

Copy link
Copy Markdown
Author

@codex review

Please re-review commit fa1a8fc8d, including the Nostr-first read surface, full (created_at, id) keyset pagination test, transactional deletion replay, and migration lock/recovery plan. PR 2 remains out of scope.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa1a8fc8d4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/buzz-db/src/task.rs
Comment thread docs/nips/NIP-BT.md
@FurnitAI

Copy link
Copy Markdown
Author

@codex review

1 similar comment
@FurnitAI

Copy link
Copy Markdown
Author

@codex review

@FurnitAI
FurnitAI force-pushed the codex/buzz-tasks-pr1 branch from 3945203 to 6236f92 Compare August 13, 2026 13:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6236f9275f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/buzz-relay/src/handlers/event.rs
Comment thread docs/nips/NIP-BT.md
Comment thread docs/nips/NIP-BT.md Outdated
@FurnitAI

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 150f8d9f69

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/buzz-core/src/kind.rs
Comment thread crates/buzz-db/src/task.rs Outdated
@FurnitAI

Copy link
Copy Markdown
Author

@codex review

Please re-review commit 30caaa97a. This round resolves both open findings:

  • P1 agent-first CLI: buzz-sdk task builders (TaskRef, build_task_requested/updated/resolved, round-trip locked to TaskEventV1::parse) and the buzz tasks CLI group (request/update/resolve/list). Writes sign, re-validate through the exact task contract, then submit; the owner p tag defaults from the NIP-OA auth tag. Task reads are owner-gated on the relay, so update/resolve take the original request's signed identity explicitly and list is the owner-side #p view.
  • P2 duplicate requests: equal-version kind-44300 with a differing payload now errors and rolls back the event insert; only an identical payload stays Stale. Covered by the new conflicting_duplicate_request_rolls_back_and_identical_retry_stays_stale projection test.

PR 2 remains out of scope.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 30caaa97a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Co-authored-by: Admin Furnit <admin@furnit.ai>
Signed-off-by: Admin Furnit <admin@furnit.ai>
Co-authored-by: Admin Furnit <admin@furnit.ai>
Signed-off-by: Admin Furnit <admin@furnit.ai>
Co-authored-by: Admin Furnit <admin@furnit.ai>
Signed-off-by: Admin Furnit <admin@furnit.ai>
Co-authored-by: Admin Furnit <admin@furnit.ai>
Signed-off-by: Admin Furnit <admin@furnit.ai>
A second kind-44300 event for an existing task identity always competes
at sourceVersion 1. The projection previously returned Stale and
committed the differing signed event into the public stream, leaving
clients with two equal-version requests they cannot deterministically
fold. Only a payload identical to the stored v1 projection row remains
Stale; any other equal-version request now fails and rolls back the
event insert, matching the equal-version conflict rule update and
resolve transitions already enforce.

Co-authored-by: Admin Furnit <admin@furnit.ai>
Signed-off-by: Admin Furnit <admin@furnit.ai>
Buzz Tasks previously shipped relay-side handling for kinds 44300-44302
with no agent-facing client, violating the agent-first rule in AGENTS.md
(new agent-facing features get a buzz-cli subcommand first).

buzz-sdk gains TaskRef plus build_task_requested/updated/resolved
builders that serialize the buzz-core contract payloads and attach the
signed identity tags; a round-trip test locks the builders to
TaskEventV1::parse. buzz-cli gains the tasks group: request, update,
resolve, and list. Writes sign, re-validate through the exact task
contract, and submit; the owner p tag defaults from the NIP-OA auth tag.
Task reads are owner-gated on the relay, so update and resolve take the
original request's identity explicitly and list is the owner-side view
over the #p filter.

Co-authored-by: Admin Furnit <admin@furnit.ai>
Signed-off-by: Admin Furnit <admin@furnit.ai>
@FurnitAI
FurnitAI force-pushed the codex/buzz-tasks-pr1 branch from 30caaa9 to 7b8325f Compare August 16, 2026 07:49
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