feat(agent): show completed work without reopening the full thread
Closes #2932.
Observed problem
Buzz already has signed agent job events, but kind:43004 results are opaque strings. A requester has to reconstruct the requested outcome, final state, artifacts, verification, and blockers from the full thread, and Home can expose structured content as raw JSON.
What changes
- Add a versioned
JobResultPayloadcontract with dispositions, typed artifact references, verification results, explicit blockers, byte and item limits, unsafe-reference rejection, and cross-field invariants. - Add a typed SDK builder and
buzz jobs handoff --channel <uuid> --job <event-id> --manifest <path|->. - Admit the existing
43001through43006job lifecycle at the relay under channel-scopedmessages:writeauthorization. - Add a Desktop handoff card and human-readable Home projection.
- Keep legacy, malformed, unsupported, oversized, or tag-mismatched
43004content on the existing Markdown fallback. - Document the protocol and privacy boundary in
docs/nips/NIP-AJ.md.
Trust and compatibility
The signed content is authoritative, while schema and disposition tags are query hints. Desktop only trusts structured content when the payload event ID matches the single signed reply tag.
Artifact references fail closed. URL-shaped references are parsed before kind-specific validation, including artifact kinds that also accept raw branch, canvas, workflow-output, or free-form references. Credential-bearing URLs, POSIX absolute paths, Windows rooted paths, drive-letter paths, and UNC paths are rejected in both Rust and Desktop instead of becoming clickable or relay-visible handoff data.
Version 1 ignores additive unknown object fields. Older clients continue to see JSON content as ordinary text, and newer clients continue to render legacy plaintext results as Markdown.
Verification
Verified on exact head 372308646b32fff1fe2324c7977c8207e0992d04, rebased onto current main at b1b283cd4c7f926e12eeee8ae1f38c7471922b16:
- Full Rust suites for
buzz-core,buzz-sdk, andbuzz-clipassed. - The three relay admission, channel-scope, and migrated-kind regressions passed.
- Full Desktop JavaScript suite: 3,901 tests passed, 0 failures.
- Desktop lint, file-size ratchet, typecheck, and production build passed.
- Rust and Desktop regressions cover relay authorization, channel scoping, unsafe URLs, absolute local paths across operating systems, malformed payload fallback, and reader-facing disposition copy.
The SDK signing test round-trips the canonical payload through the signed event shape. A complete relay library run reached 825 passed and 35 ignored, but nine unchanged admin/media tests could not acquire their local Postgres fixture (Sqlx(PoolTimedOut)); an isolated rerun reproduced the same missing-fixture failure. A live remote relay integration run was not performed.
Non-goals
- No scheduler, worker loop, approval system, project-management surface, or local workspace scanner.
- No change to job acceptance or agent mention delivery.
- No new HTTP endpoint or production dependency.
Result handoff card
The same signed kind:43004 payload renders with distinct outcome, progress, artifact, verification, and disposition fields in both supported themes.
Light theme

Dark theme

I rebased this branch onto current main and re-audited the trust boundary around artifact references.
The structured handoff remains relevant and does not overlap the newer invite or Markdown parser changes on main. The review did find one real validation gap: artifact kinds that can accept raw references (branch, canvas, workflow_output, and other) could also accept a URL containing embedded credentials because their validators treated the value as an opaque raw reference first. Desktop could then render that value as a link.
Head f387a8e9b75c4462df9073f3b442f12276d25fbe parses URL-shaped values before kind-specific raw-reference validation and rejects embedded credentials consistently in Rust and Desktop. Regression coverage spans every affected artifact kind.
Verification was refreshed against the rebased tree: the full affected Rust package suites, all 3,737 Desktop JavaScript tests, Desktop typecheck and E2E build, strict Rust formatting/Clippy, and targeted Biome checks passed. A live relay submission was not rerun, so the proof remains the signed-event round trip plus the existing relay submission path.
Rebased this branch onto current block/buzz main at c55e421a0.
Head moved from fcb0edeea to 7d1c3bc43. The CLI test conflict was resolved by retaining both current main's user-status parser coverage and this branch's jobs handoff parser coverage. The current message-row changes from main also remain intact alongside the inspectable job-result card.
Verification:
- The full
buzz-core,buzz-sdk, andbuzz-clitest suites passed. - Strict Clippy passed for those three packages with all targets and warnings denied.
- Desktop Biome, file-size, text-size, and pubkey-truncation checks passed.
- The full Desktop test suite, TypeScript typecheck, and production Vite build passed on the final rebased branch.
git diff --check, DCO trailer checks, and the direct merge-base audit passed.
GitHub checks are rerunning on the new head.
Rebased onto current main at b1b283cd4c7f926e12eeee8ae1f38c7471922b16 and re-audited #2932 against the current open-PR landscape. #3877 explicitly leaves structured handoff cards out of scope, so this work is not superseded.
A clean-context review found three gaps that are now repaired:
- The relay now admits job lifecycle kinds
43001through43006under channel-scopedmessages:writeauthorization and requires the signedhtag. - Rust and Desktop now reject Windows rooted and UNC file references in addition to POSIX absolute and drive-letter paths.
- Empty-artifact copy distinguishes blocked and failed results from an intentional
no_artifactcompletion.
Exact-head verification on 372308646b32fff1fe2324c7977c8207e0992d04:
- Full Rust suites for
buzz-core,buzz-sdk, andbuzz-clipassed. - The three relay admission, channel-scope, and migrated-kind regressions passed.
- Full Desktop JavaScript suite: 3,901 passed, 0 failed.
- Desktop lint, file-size ratchet, typecheck, and production build passed.
No live remote relay was used. A complete relay library run reached 825 passed and 35 ignored, but nine unchanged admin/media tests could not acquire their local Postgres fixture (Sqlx(PoolTimedOut)); an isolated rerun reproduced the same missing-fixture failure. The changed relay boundary is covered by the passing authorization and scope regressions, and the signed SDK event shape is round-tripped in tests.
Rebased onto block/buzz main at ce3cf3cd2591f132f286fbc0a42a9e6699d0b08d and re-audited #2932 against current job, CLI, relay, and timeline behavior.
The PR remains valid. Current main still treats kind:43004 results as opaque content and has no versioned JobResultPayload, typed SDK builder, buzz jobs handoff command, or inspectable JobResultCard. PR #3877 explicitly leaves structured handoff cards out of scope. The newer CLI and timeline changes do not supply or supersede this contract, and I found no external review claim that supports closing the PR.
The rebase was clean and retained current main's CLI and timeline behavior. Exact-head verification on c3fd8e1b88fd665be0c36c1ea9f8b0642d5f5361:
- The full
buzz-core,buzz-sdk, andbuzz-clisuites passed. - The complete
buzz-relaylibrary suite executed with 831 passed and 37 ignored. Nine unchanged database-backed admin/media tests failed because the local Postgres fixture was unavailable: seven reportedSqlx(PoolTimedOut)directly, while two admin endpoint assertions received 500 instead of the expected 404 under the same unavailable database path. - The changed relay admission regression
agent_job_kinds_require_message_write_and_channel_scopepassed, along with the SDK and CLI job-handoff regressions. - The full Desktop JavaScript suite, Desktop policy checks, TypeScript typecheck, and production build passed.
cargo fmt --all -- --check, warnings-as-errors Clippy,git diff --check, the direct merge-base check, and the required commit trailers passed.
No live remote relay submission was performed. The signed event shape, authorization boundary, structured fallback behavior, unsafe-reference rejection, and rendered handoff behavior are covered by the passing local regressions. GitHub checks are rerunning on the new head.
Review and rebase summary
Reviewed the PR for accuracy against current block/buzz main at d42d60d64 and rebased the branch onto that commit.
What this PR does
Adds a structured agent job result handoff as a new signed kind:43004 Nostr event. The payload (JobResultPayload in buzz-core/src/job.rs) carries schema version, job request reference, requested outcome, final outcome, disposition (completed, no_artifact, blocked, partial), artifacts with references (not embedded file contents), verification evidence, and an optional blocker. The buzz jobs handoff CLI subcommand validates and publishes the payload. The desktop app renders a result handoff card in the timeline.
Accuracy review
- The payload validation is thorough: schema version check, event ID format validation, size limits on every text field, cross-field invariants (completed requires an artifact, no_artifact forbids artifacts, blocked requires a blocker), and bounded item counts (max 50 artifacts, max 50 verifications).
- The
JobArtifactreference model is correct — it carries a URL or reference, not embedded content, and thesourceStatefield is bounded. This avoids relay storage abuse. - The CLI
handoffcommand correctly validates that the manifest'sjobRequestmatches the--jobargument, preventing a mismatched manifest from being published against the wrong job. - Unit tests cover manifest parsing, invalid JSON, invalid contract version, and job-ID mismatch. The CLI integration test verifies
--manifestaccepts both file paths and stdin. - The
buzz-sdkevent builder (build_job_result) is wired through the same sign-and-submit path as other CLI commands. - No
unwrap()orexpect()in production paths. No new dependencies.
Rebase result
Head moved from c3fd8e1b8 to dfa8e6b8b. No conflicts. git range-diff shows the patch is unchanged.
CI
DCO passes. Semgrep OSS and zizmor were pending at the time of this comment.
Rebase and accuracy review (2026-08-07)
Rebased onto current main (2b873cf20). 3 conflicts resolved — 52 commits applied, 3 files conflicted.
Branch state: 72a8d3b03 (was dfa8e6b8b) Mergeable: ✅ MERGEABLE · BLOCKED (branch protection — awaiting maintainer review)
Conflict resolution
-
crates/buzz-relay/src/handlers/ingest.rs— main addedKIND_PRIVATE_MANAGED_AGENTto the kind import block, while the branch addedKIND_JOB_ACCEPTED,KIND_JOB_CANCEL,KIND_JOB_ERROR,KIND_JOB_PROGRESS,KIND_JOB_REQUEST,KIND_JOB_RESULT. Resolution: merged both import additions into a single alphabetical import block containing all new kinds. -
desktop/src/features/home/ui/FeedSection.tsx— main addedmessageIdandlinkPreviewsSuppressedprops to theMarkdowncomponent, while the branch refactored the feed rendering to use afeedPresentation()function that handles job-result content. Resolution: kept both changes — thefeedPresentationfunction is called, and theMarkdowncomponent retains main's new props (messageId,linkPreviewsSuppressed). -
desktop/src/features/messages/ui/MessageRow.tsx— main refactored the defaultrenderBodycase to include video-review timecode handling andlinkPreviewsSuppressed/linkPreviewTagsprops, while the branch added aKIND_JOB_RESULTcase that renders aJobResultCard. Resolution: extracted main's default-body logic into arenderDefaultBody()function, then added theKIND_JOB_RESULTcase beforedefault— whenstructuredJobResultis present it renders the card, otherwise it falls through torenderDefaultBody(). Thedefaultcase also callsrenderDefaultBody(). All of main's link-preview and video-review features are preserved.
Accuracy review
The PR adds an inspectable job-result handoff system: a KIND_JOB_RESULT event type with structured content parsing, a JobResultCard UI component, CLI commands for job management, and a NIP-AJ specification document. The jobResult.ts lib provides safe content parsing with validation, and the JobResultCard renders summary, status, and tool outputs.
Tests cover content parsing (jobResult.test.mjs), card rendering (JobResultCard.render.test.mjs), and CLI commands. No unwrap()/expect() in production paths. No new dependencies — uses existing SDK builders. The JobResultCard is lazy-loaded via React.lazy to match the existing pattern for DiffMessage.
Scope is broad (19 files, ~2600 insertions) but the NIP-AJ spec, core types, CLI, and UI are all cohesive.
This is the third recurring review + rebase pass for the open BradGroux PRs on block/buzz.
What this PR does
Adds structured, inspectable agent job handoffs via a new kind:43004 job result event and a buzz jobs handoff CLI command. The PR introduces:
-
buzz-core/src/job.rs: AJobResultPayloadstruct with schema version 1, validation (size limits on outcome, details, labels, references, source state; max 50 items per collection), and avalidate()method. Artifacts include pull requests, issues, commits, and other reference types with optional source state. Verification entries carry label, status, and evidence. -
buzz-cli/src/commands/jobs.rs: Thehandoffsubcommand parses a manifest (file or stdin), validates it, checks thatjobRequestmatches the--jobargument, signs a kind:43004 event viabuzz_sdk::build_job_result, and submits it. -
CLI README and command registration: Documents the new
jobs handoffcommand and adds it to the command tree.
Correctness
- The
JobResultPayloadvalidation enforces reasonable size limits (64KB max serialized, 8KB outcome, 4KB detail, 512B label, 2KB reference, 512B source state, 50 items max). - The
ensure_job_matchescheck prevents publishing a result for a different job than specified. - The manifest parsing correctly rejects invalid JSON, invalid schema versions, and mismatched job IDs — all four cases are tested.
- The CLI argument parsing test covers both file and stdin manifest paths.
- URL validation is enforced for artifact references via the
url::Urltype. - No
unwrap/expectin production paths (test-onlyexpectis acceptable).
Rebase result
Already based on current main (02f640bc4). No rebase needed — 0 commits behind.
- Head SHA:
252f986f8ef2e8c66a67274ea862eff887e1702b(unchanged) - Mergeable: ✅ MERGEABLE
- CI: DCO ✅
No code changes were made — this was a review + rebase pass only.
Portfolio review update (2026-08-09)
I rechecked the job-result artifact contract against current main. The handoff remains needed, but review found that raw absolute and traversal-like references were rejected only for file artifacts while branch, canvas, workflow-output, and other artifact kinds could still carry unsafe local references.
I rebased the branch onto 5bf78671f45178f8de02ba18d3d321cbbf19cd1f and made reference validation uniform across all artifact kinds in Rust and Desktop parsing. Focused Rust job tests pass (17/17), the full Desktop JavaScript suite passes (4,552/4,552), and targeted Rust formatting passes. The workspace-wide format check still reports unrelated formatting drift in current main's relay ingest file.
Portfolio rebase and review update (2026-08-11)
Rebased onto main at 7e6e9c547 (2026-08-10). No conflicts.
Compile fix applied during rebase: Removed unused KIND_JOB_* imports from crates/buzz-relay/src/handlers/ingest.rs that were added by this PR but not referenced there (the job kinds are used in buzz-db/src/feed.rs, not in the ingest handler). This eliminates the unused_imports warning.
Still needed: The kind:43004 job result content is still an opaque string without a structured contract. No newer main commit adds a JobResultPayload or a desktop rendering surface for job results.
Verification: cargo check -p buzz-core -p buzz-cli -p buzz-sdk -p buzz-relay passes cleanly with no warnings. The PR adds a versioned JobResultPayload in buzz-core/src/job.rs, CLI inspect commands, a JobResultCard TSX component with render tests, and a NIP-AJ specification document.
I tested this against a real local relay and found one completion blocker that the builder/parser tests could not expose.
Before the patch, the signed job request failed at relay ingest:
relay rejected job request: restricted: unknown event kind
Root cause: required_scope_for_kind did not admit the existing 43001 through 43006 job lifecycle kinds. This meant the structured result could be built and signed, but the existing relay could not accept the lifecycle.
I prepared a focused commit on top of this PR's current head:
- commit: https://github.com/ScaleLeanChris/buzz/commit/e1dc74a53
- cherry-pick:
git cherry-pick e1dc74a53
The patch:
- maps all six existing job lifecycle kinds to
messages:write - requires an
htag for each, preserving channel scope - adds one relay E2E that publishes a signed request, a structured
43004result frombuzz_sdk::build_job_result, and a legacy plaintext43004result - queries both results back by channel and verifies canonical structured JSON plus unchanged legacy plaintext
Verification:
cargo test -p buzz-relay channel_scoped_content_kinds_require_h_tags
2 passed; 0 failed; 905 filtered out
NO_PROXY=localhost,127.0.0.1 no_proxy=localhost,127.0.0.1 RELAY_URL=ws://localhost:3300 cargo test -p buzz-test-client --test e2e_relay test_structured_and_legacy_job_results_round_trip -- --ignored --exact --nocapture
1 passed; 0 failed; 0 ignored; 44 filtered out
cargo clippy -p buzz-relay -p buzz-test-client --all-targets -- -D warnings
passed
cargo fmt --all -- --check
passed
I kept this to one core behavior test. It does not add another scheduler, scanner, uploader, or endpoint. The relay treats the referenced request as a signed claim; it does not independently resolve and validate the referenced event's kind or channel at ingest.
@ScaleLeanChris — thank you for the thorough field testing and the focused commit. Your root-cause analysis was spot on: the structured job result could be built and signed, but the relay rejected the lifecycle event because required_scope_for_kind did not admit kinds 43001–43006.
I cherry-picked your commit (e1dc74a5) onto this branch with original authorship preserved. The patch now:
- Maps all six job lifecycle kinds (43001–43006) to
messages:writeinrequired_scope_for_kind - Requires an
htag for each, preserving channel scope - Adds the relay E2E test that publishes a signed request, a structured 43004 result from
buzz_sdk::build_job_result, and a legacy plaintext 43004 result, then queries both back by channel and verifies canonical structured JSON plus unchanged legacy plaintext
I also rebased the entire branch onto the latest main (4b3570671, the 0.5.10 release) and ran cargo check clean.
Your observation about the relay not independently resolving the referenced event's kind or channel at ingest is noted — that is the correct behavior for a signed-claim model and this PR does not change it.
Thanks again for the real-relay testing. That is exactly the kind of gap unit tests cannot catch.
Portfolio rebase and review update (2026-08-13)
Rebased onto main at a96af8952 (2026-08-13). No conflicts.
Still needed
Yes. The job-result handoff feature (showing completed work without reopening the full thread) is not superseded. No recent main commit touches the job-result display or thread summary path.
Verification
cargo check clean. All 14 portfolio PRs confirmed MERGEABLE on GitHub.
Rebase review — 2026-08-15
Rebased onto current main at 82f7ed153 (2026-08-15). 41 new commits since last review. 2 conflicts resolved across 2 files.
Conflicts resolved
desktop/src/features/messages/ui/MessageRow.tsx: Main (#5748) refactored the default message body case into arenderDefaultBody()helper that handles wave messages and video review comments. The PR'sKIND_JOB_RESULTcase was already usingrenderDefaultBody()as its fallback. Merged by keeping the PR'sKIND_JOB_RESULTcase plusrenderDefaultBody()for the default branch — main's wave/video logic now lives insiderenderDefaultBody()which the PR already calls.crates/buzz-cli/src/lib.rs: Main added 2 new issue subcommands (issues count went from 4 to 6). Updated the PR's test assertion to expect 6 issues (main's count) plus 1 jobs entry (PR's addition).
Still-needed assessment
No new commits touch job-result rendering or the jobs CLI. PR is still needed.
Verification
cargo check -p buzz-cli -p buzz-corepasses clean- GitHub confirms
MERGEABLE
Rebased onto main at d8281b9c9 (2026-08-15). No conflicts — the branch rebased cleanly.
Three commits landed on main since the last rebase point (82f7ed153):
- #5947 hide the offcanvas-collapsed sidebar so it stops painting over the community rail
- #5645 Polish mobile message threads and composer
- #5116 require device authentication for identity export (mobile)
All three are mobile or desktop sidebar changes with no overlap with this PR's subject area. The fix is still needed — no recent commit addresses the same problem.
Verification: tsc --noEmit passes. GitHub confirms MERGEABLE.
Rebased onto current main (f956e6fe0, 2026-08-17). No conflicts. Still needed.
Rebased onto latest main (fe7c6808e). One conflict in desktop/src/features/messages/ui/MessageRow.tsx.
Main's #5821 replaced the Markdown component with VideoReviewCommentMarkdown in the default: branch of the message content switch. The PR's case KIND_JOB_RESULT: was placed before the default: case, and the renderDefaultBody() fallback was kept intact. The new VideoReviewCommentMarkdown props (including configNudgeAuthorPubkey, linkPreviewsSuppressed, customEmoji, imetaByUrl) are preserved from main.
cargo check -p buzz-cli passes clean.
Rebase and review check — 2026-08-20
Rebased onto latest main (a9640c7cc). No conflicts (3 commits rebased cleanly). GitHub reports MERGEABLE.
Accuracy review: jobs.rs does not exist in main. Job lifecycle event kinds and the JobResultCard UI component are not present. Agents cannot surface completed work without reopening the full conversation thread. Feature not present in main.
Continued relevance: No recent main commits add job result handoff. PR is still needed.
Rebased onto latest main (025425591). One conflict in crates/buzz-cli/src/lib.rs.
Main's #6359 added Buzz message link support to messages thread, adding two tests (messages_thread_accepts_link_or_explicit_identifiers and messages_thread_rejects_partial_or_mixed_targets) in the same test region where this PR adds jobs_handoff_parses_file_and_stdin_manifests. Resolved by keeping all three tests — main's two link tests followed by this PR's handoff test.
cargo check -p buzz-cli -p buzz-core passes clean.
Rebased onto latest main (e23632941). One conflict resolved in crates/buzz-cli/src/lib.rs.
Main's #6359 added messages_thread_accepts_link_or_explicit_identifiers and messages_thread_rejects_partial_or_mixed_targets tests in the same test module region as the PR's jobs_handoff_parses_file_and_stdin_manifests test. All three tests are kept — main's link parsing tests followed by the PR's job handoff parsing test.
cargo check -p buzz-cli -p buzz-core clean.