feat(workflows): expose durable run history [issue:#2980]
Summary
Implements workflow run history for #2980, as a separate contribution in the #3863 handoff workstream.
The current workflows runs path queried lifecycle event kinds the relay does not emit, so it returned [] even when the durable workflow_runs table contained failed or completed executions. Desktop had the same empty placeholder.
Scope
Included
- Adds an authenticated
GET /api/workflows/{id}/runsrelay read path over the existing durableworkflow_runstable. - Enforces host-bound tenant resolution, NIP-98 GET authentication, replay protection, relay membership, and the caller's existing channel-access scope. Unknown and inaccessible workflows share a 404 response.
- Returns newest-first run records with run/workflow IDs, trigger event ID, status, current step, per-step
execution_trace, timestamps, and failure diagnostics. - Updates the Desktop Tauri command and agent CLI to consume the durable read path.
- Carries the trigger event ID through the Desktop wire/type conversion.
- Keeps failed and cancelled statuses visible as badges in collapsed Desktop run-history rows; failed uses the destructive treatment and cancelled uses the warning treatment.
- Adds focused Desktop E2E coverage for both terminal statuses.
- Updates the CLI testing runbook to describe the durable result.
Excluded
- No new Nostr event kind or lifecycle-event emission.
- No workflow approval-history redesign.
- No slash-command autocomplete or command-palette work; that remains a separate handoff item.
- No OEXL-specific code, matching, outcome contracts, payments, ledger state, or settlement semantics.
Product / Architecture Decisions
- Reused the existing authenticated HTTP bridge and relay tenant/channel authorization rather than adding an endpoint-specific auth model.
- Read the authoritative
workflow_runsrecords directly instead of reconstructing partial state from event kinds46001–46003, which the relay does not emit. - The relay caps requests to 100 records; the Desktop and CLI callers default to 20.
- Reused the existing run-status badge component in the detail panel; the follow-up only makes terminal status styling and collapsed-row evidence explicit.
User-Facing Contract
CLI
buzz workflows runs --workflow <workflow-id> [--limit <n>] now returns a JSON array of durable run records. An empty array means that no records exist, rather than that lifecycle events were silently unavailable.
Desktop
The existing workflow detail panel receives durable run records and renders status, execution trace, and error information from the relay. The Run History list shows FAILED and CANCELLED badges while rows remain collapsed, so debugging can begin without opening each run detail.
Verification
Ran
cargo fmt --all -- --checkgit diff --checkcargo check -p buzz-relaycargo check -p buzz-clicargo clippy -p buzz-relay -- -D warningscargo clippy -p buzz-cli -- -D warningscargo test -p buzz-relay workflow_run_wire_preserves_failure_diagnostics --libpnpm --dir desktop exec biome check tests/e2e/workflow-run-status-badges.spec.ts src/features/workflows/ui/WorkflowDetailPanel.tsx src/testing/e2eBridge.ts tests/helpers/bridge.ts playwright.config.tspnpm --dir desktop build:e2eBUZZ_WORKFLOW_STATUS_SCREENSHOTS=1 pnpm --dir desktop exec playwright test tests/e2e/workflow-run-status-badges.spec.ts --project=smoke --reporter=line
Covered
The relay regression test verifies the wire conversion preserves failed status, trigger event ID, timestamps, per-step trace data, and the failure message.
The new Desktop regression test triggers failed and cancelled runs, collapses both rows, and verifies both badges remain visible without an open trace. Screenshot evidence is posted in a follow-up PR comment.
The Desktop Tauri check was attempted but this environment lacks cmake, so the existing audiopus_sys native build cannot start. No desktop application shell redesign was added; the follow-up is limited to the existing workflow detail panel and its test fixture.
Review Path
crates/buzz-relay/src/api/bridge.rsandrouter.rs- Desktop relay/Tauri transport and workflow wire conversion
- Desktop collapsed run-history status treatment and focused E2E fixture
- CLI command and runbook
- Regression tests
Notes For Reviewer
This is intentionally separate from the other Buzz upstream handoff contributions and is not stacked on the Canvas revision-history PR. It does not merge or alter any OEXL settlement boundary.
durable run history will help a lot for debugging workflows. can the list show a failed/cancelled badge without opening the run detail?
Workflow run status badges
Failed and cancelled runs remain visibly labelled in the collapsed run-history list, without opening run detail.

The authoritative relay and Desktop run-history work is now merged in #5780:
GET /workflows/{workflow_id}/runs returns { runs, next } with keyset
pagination, and the run-approval read is adjacent.
The remaining user-visible bug is in buzz workflows runs. It still queries
Nostr kinds 46001-46003, which the relay never emits, so it reports [] even
when Desktop shows durable runs.
Would you prefer this PR be refreshed and reduced to a CLI adapter for the
merged endpoint, or a new minimal CLI-only bugfix? I would preserve exact-query
NIP-98 signing, parse the current envelope, and cover pagination, authorization,
and relay error output. I would not reintroduce the older /api/... bare-array
contract or duplicate the merged Desktop/relay code.
@tcballard I found this PR while checking for overlap. #7577 is a narrow CLI-only correction against current main: it consumes the existing /workflows/{workflow_id}/runs route and its {runs,next} keyset page, rather than adding a new relay route or Desktop UI. It also preserves denial errors without suggesting removal of delegation credentials. Linking for coordination of the CLI/output contract; no edits were made to this branch.
Thanks for coordinating and linking #7577. Its CLI-only scope matches the direction I suggested above: consume the existing /workflows/{workflow_id}/runs endpoint and {runs,next} pagination, with authentication and relay errors preserved. I will defer the remaining CLI-history fix to #7577 rather than open a competing PR.