Skip to content

Event subscriptions for Junior-initiated resource actions #682

Closed

Description

@dcramer

Junior currently fires and forgets after taking upstream actions. After opening a PR, filing an issue, or kicking off a workflow, it has no way to learn what happened — the feedback loop is severed. This feature proposes letting Junior self-subscribe to outcomes of actions it initiates, routing high-signal events back into the originating Slack conversation.

Current behavior

Junior opens a PR and the conversation ends. It has no awareness of CI results, review feedback, merge state, or closure. Users must manually return to Junior with status updates ("CI failed", "it got merged"), which also means the original intent context is lost.

Gap

  • No mechanism for Junior to express interest in the outcome of something it started.
  • No routing path from upstream events back to the originating conversation.
  • No context capsule to restore what Junior was trying to do when the event arrives.

Proposed primitive: conversation-bound event subscriptions

When Junior takes an action that creates or mutates an upstream resource, it should be able to register a durable subscription tied to the originating Slack thread. When a matching event arrives, a structured runtime turn fires in that thread with enough context for Junior to understand why the event matters and what, if anything, to do.

This generalizes the existing scheduled task model from time-triggered to event-triggered. Instead of "wake Junior up at time T," the primitive becomes "wake Junior up when resource R reaches condition C, and restore the conversation context."

Key components:

  • Registration: the action tool returns a subscribable affordance; Junior calls a generic subscribeToEvent tool with resource ref, event filters, intent summary, TTL, and delivery policy. This is explicit rather than implicit to keep behavior auditable.
  • Context capsule: each subscription persists the original resource, conversation ref (channel + thread_ts), user intent summary, success/failure conditions, and provenance (originating message, tool call). Without this, Junior has no idea why it should care about the event.
  • Event routing: a runtime ingestion layer receives provider events (push-first, poll fallback), normalizes them, matches active subscriptions, applies dedupe and rate limits, and constructs a trusted runtime turn — not a raw user message. Provider content (comments, commit messages) must remain untrusted.
  • Noise gating: only high-signal terminal or actionable events should trigger a turn. For a GitHub PR: merged, closed unmerged, CI failed, CI recovered, review approved, review requested changes. Not every label change, synchronize event, or bot comment.
  • Lifecycle: subscriptions expire on TTL (default 14 days for PRs) or terminal state (merged/closed). Dedupe windows prevent duplicate Slack messages from duplicate webhook deliveries.
  • Delivery modes: conservative default is notify-and-suggest. Autonomous follow-up actions (e.g. inspecting CI logs and proposing a fix) should obey the same tool permission model as normal Junior turns.

MVP scope

GitHub pull requests created by Junior:

  • Events: PR merged, PR closed unmerged, CI failed, review approved, review requested changes.
  • Delivery: post into original Slack thread with restored context.
  • Junior summarizes the event and can suggest next steps.
  • No autonomous code changes beyond existing permissions.

Safety considerations

  • Webhook payloads are untrusted data; subscription metadata is trusted runtime context.
  • Routing must enforce original workspace/channel permissions.
  • Idempotency keys are required to prevent duplicate delivery.
  • Event-triggered turns must not grant additional tool permissions vs. normal turns.
  • Subscriptions should be listable and cancellable per conversation.

Related

  • Add hooks for follow-up actions using a fast model #529 (fast-model post-action hooks) covers lightweight hygiene actions after a skill completes — distinct in that it's pre-configured fast-model chains, not declarative outcome-awaiting subscriptions with restored conversation context.
  • feat(github): plugin-defined reactive behavior hooks #435 (plugin-defined reactive hooks) covers plugin-declared reactive behaviors for GitHub events — distinct in that it's about external event routing to predefined behaviors, not Junior self-expressing interest in outcomes it cares about for a specific conversation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions