Skip to content

feat(workflows): expose durable run history [issue:#2980] - #3903

Open
tcballard wants to merge 2 commits into
block:mainfrom
tcballard:tcballard/workflow-run-history
Open

feat(workflows): expose durable run history [issue:#2980]#3903
tcballard wants to merge 2 commits into
block:mainfrom
tcballard:tcballard/workflow-run-history

Conversation

@tcballard

@tcballard tcballard commented Jul 31, 2026

Copy link
Copy Markdown

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}/runs relay read path over the existing durable workflow_runs table.
  • 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_runs records directly instead of reconstructing partial state from event kinds 4600146003, 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 -- --check
  • git diff --check
  • cargo check -p buzz-relay
  • cargo check -p buzz-cli
  • cargo clippy -p buzz-relay -- -D warnings
  • cargo clippy -p buzz-cli -- -D warnings
  • cargo test -p buzz-relay workflow_run_wire_preserves_failure_diagnostics --lib
  • pnpm --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.ts
  • pnpm --dir desktop build:e2e
  • BUZZ_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

  1. crates/buzz-relay/src/api/bridge.rs and router.rs
  2. Desktop relay/Tauri transport and workflow wire conversion
  3. Desktop collapsed run-history status treatment and focused E2E fixture
  4. CLI command and runbook
  5. 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.

Signed-off-by: Tom Ballard <tom@armytage.co>
@tcballard
tcballard requested a review from a team as a code owner July 31, 2026 10:57
@Chessing234

Copy link
Copy Markdown
Contributor

durable run history will help a lot for debugging workflows. can the list show a failed/cancelled badge without opening the run detail?

Keep failed and cancelled statuses visible in collapsed run-history rows and cover both states with focused Desktop E2E evidence.

Signed-off-by: Tom Ballard <tom@armytage.co>
tcballard added a commit to tcballard/buzz that referenced this pull request Jul 31, 2026
@tcballard

Copy link
Copy Markdown
Author

Workflow run status badges

Failed and cancelled runs remain visibly labelled in the collapsed run-history list, without opening run detail.

workflow-run-status-badges

@nathansmithopenclaw-alt

Copy link
Copy Markdown

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.

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.

3 participants