Skip to content

fix(workflows): restore discovery and authorize agent wake#2737

Draft
loganj wants to merge 3 commits into
mainfrom
fix/workflows-discovery
Draft

fix(workflows): restore discovery and authorize agent wake#2737
loganj wants to merge 3 commits into
mainfrom
fix/workflows-discovery

Conversation

@loganj

@loganj loganj commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

🤖

Summary

  • Restore Desktop workflow discovery when it batches multiple channel IDs in one #h filter.
  • Define and implement a fail-closed authority contract for relay-signed workflow messages that wake agents.

Details

Desktop's global Workflows view can request workflows across multiple accessible channels. The relay previously applied those #h values only after a limited database read, so newer unrelated events could consume the page and hide valid workflows. Multi-channel #h values are now intersected with the authenticated reader's channel access and pushed into SQL before LIMIT; explicit channel filters continue to exclude global events.

Workflow send_message events are relay-signed, so ACP previously evaluated them as authored by the relay and rejected them under normal owner-only policy. Relay output now carries a dedicated workflow-owner authority tag while p tags remain attribution and mention routing only. ACP accepts that delegated principal only when the kind-9 event is validly signed by the configured endpoint's NIP-11 self identity and contains exactly one valid workflow marker and owner tag. Missing, malformed, ambiguous, or forged provenance falls back to ordinary signer authorization, and the derived owner still passes through existing respond_to and DM restrictions.

ARCHITECTURE.md documents both contracts. Regression coverage includes adversarial workflow provenance cases, access/requested-channel intersection, SQL-before-limit behavior, global exclusion, empty intersections, and emitted relay/owner provenance.

npub13n66s06epmqf2kc3v373ez8hj65cuzyvxzjf93vwpervxqn2u7jq2qd9je added 3 commits July 24, 2026 14:52
Signed-off-by: npub13n66s06epmqf2kc3v373ez8hj65cuzyvxzjf93vwpervxqn2u7jq2qd9je <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
Signed-off-by: npub13n66s06epmqf2kc3v373ez8hj65cuzyvxzjf93vwpervxqn2u7jq2qd9je <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
Resolve the Desktop workflow overview against the authenticated user's active channel memberships in PostgreSQL, with bounded keyset pagination. Remove the multi-channel request array and SQL pushdown path while preserving exact single-channel reads.

Signed-off-by: npub13n66s06epmqf2kc3v373ez8hj65cuzyvxzjf93vwpervxqn2u7jq2qd9je <8cf5a83f590ec0955b11647d1c88f796a98e088c30a492c58e0e46c3026ae7a4@buzz.block.builderlab.xyz>
@loganj
loganj force-pushed the fix/workflows-discovery branch from d1a1a6f to 3688eda Compare July 24, 2026 18:53
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