Skip to content

docs(issues): propose PR5 outbox and realtime delivery plan - #539

Closed
yxr-2025 wants to merge 1 commit into
Noveum:mainfrom
yxr-2025:docs/issue-outbox-design
Closed

yxr-2025 wants to merge 1 commit into
Noveum:mainfrom
yxr-2025:docs/issue-outbox-design

Conversation

@yxr-2025

@yxr-2025 yxr-2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Current design revision continues in #569, preserving this proposal's history. It addresses the earlier Human producer gate, sequential release, v1 protocol, scheduler, delivery lifetime/blocked-row, gate-off cron, response-safe drain and public-doc placement feedback. The revised proposal is maintained outside public product documentation.

#569 is documentation only and does not approve implementation or activate an outbox. Current Actor delivery PRs are #564, #562, #565 and #566. This original proposal remains unchanged until its replacement merges.


What this changes

Adds the English design proposal for PR5, the fifth follow-up split from #512. This draft contains only docs/pr5-outbox-plan.md; it includes the complete technical plan, estimated file changes, failure-test matrix and rollout requirements.

Why

The proposed Issue outbox persists realtime actions in the same transaction as the business write, then publishes them through bounded request draining and cron recovery. Slack and email retain the existing Provider Outbox, and MCP request idempotency remains separate under #407.

Two points need coordination before their corresponding changes proceed: realtime replay and global since semantics, and the production cutover, old hub retirement and rollback procedure. Other engineering choices are stated explicitly for normal PR review.

Refs #512, #215. Related implementation stages: #516, #523, #524 and #525. This design proposal does not close #215.

How you know it works

  • bun run docs:build passed with the new proposal included.
  • git diff --cached --check passed; the staged change is one Markdown file with 197 added lines.
  • Manually checked that the English proposal retains the full technical design, file estimates and test matrix, raises only two advance-coordination items, and contains no em-dash characters or local Windows paths.
  • bun run verify passed lint, comment/source-byte/Bun-import/dependency checks and all workspace typechecks, then stopped in the existing scripts/backup-prune.test.ts CLI subprocess assertion (proc.exitCode: expected 0, received 1). That test phase reported 179 passed and 1 failed on Windows/Bun 1.4.0; the remaining suite did not run. Full verification is not claimed green.

The implementation and failure tests described in the document are planned work, not executed feature validation. Source and review status observations are pinned to the 2026-10-15 evidence baseline.

Checklist

  • Documentation only, with no application, migration, deployment or configuration changes.
  • Full plan, file estimates and test matrix retained in English.
  • Only the two shared protocol and production coordination questions are raised for advance discussion.
  • No code comments, attribution to development tools or em-dash characters added.
  • No issue closed and no production release requested by this draft.
  • Full bun run verify green; the local failure is recorded above.

Anything reviewers should know

The planned implementation is estimated at 2,250-3,450 handwritten changed lines, with generated migration metadata reported separately. This PR contains the design document only. The standalone worker is deferred; the plan retains a shared drain interface for a future optional self-hosted entry point.

@github-actions

Copy link
Copy Markdown

Thanks for your first pull request to Orbit.

Two things that will save you a review round: bun run verify runs the
same four checks CI does, and the repo has no comments in code by policy,
so bun run check-comments will flag any you added out of habit.

A maintainer will review this shortly. Ask anything on the thread.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the documentation Docs, the README, or anything that explains Orbit label Oct 15, 2026
@yxr-2025

yxr-2025 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor Author

@imshashank This documentation-only draft is PR5, the fifth follow-up split from #512, covering the Issue outbox and reliable realtime publication. The full plan is in docs/pr5-outbox-plan.md.

The plan follows your earlier deployment direction: bounded in-request draining plus a per-minute cron, with a shared drain interface and a standalone self-hosted worker deferred. Slack and email keep their existing Provider Outbox. MCP request idempotency remains separate under #407. The delivery guarantee ends at Redis accepting a publication; it does not promise that every client receives it.

There are two areas I need to coordinate with you:

  1. Realtime replay and since semantics. A delayed event can have a lower sync ID than a connection's subscription watermark. The proposed durable path carries optional event identity and bypasses that global filter, using per-object version checks, current authorization and hub-side protection for older browser bundles. Is this shared protocol direction acceptable? If the existing filtering semantics should remain, I would revise the plan around a narrower reference-invalidation protocol and state its guarantees explicitly.

  2. Production cutover and rollback. The proposed rollout first deploys a preparation artifact with consumer protection and draining, retires or closes old WebSocket-bearing hubs, and then enables transactional event producers. Rollback retains compatible consumers and backlog processing. Can the current production workflow deploy those pinned artifacts and verify that old hubs have drained? Who should perform and record those checks, and what rollback floor can that workflow support?

Separately, the plan documents a behavior fix for normal review: once the Issue transaction commits, an immediate delivery failure returns the original successful business result and retries delivery asynchronously. Authorization, validation and transaction failures remain errors.

This draft contains the design only. No feature implementation or production change is included.

@imshashank imshashank left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this up before building it. Checked against the blockers from #512:

  1. Human writes need a gate. The plan routes the Human REST writes through the outbox and says no feature flag is proposed. That gives every human issue write an in-transaction insert plus up to a 250ms in-request drain, and makes rollback a redeploy. Please add an env gate, default off, with the off path keeping today's handler.publish and originClientId stamping exactly as they are. Your plan to pass originClientId before the transaction and store it on the row is sound once it's on.
  2. The two-artifact rollout doesn't fit how we deploy. apps/web/vercel.json deploys only from main, so there's no way to "deploy a specified preparation artifact before merge". Please plan it as sequential merges to main instead: consumer hardening first, then the table, drain and cron with the gate off, then the producer behind the gate. That also avoids one PR of 2,250 to 3,450 handwritten lines plus 16 to 18k generated, which is what #512 was split to avoid. Old hubs are already bounded: /api/ws has maxDuration = 300, so the operator inventory step can just be "wait more than 300 seconds after the preparation deploy".
  3. Worker. In-request drain plus cron, with no required worker, is right. The file list is missing apps/web/src/lib/deployment/scheduler.ts, which replicates vercel.json's crons for Docker and the catalog deploys. Without it, self-hosted installs never drain. Alternatively, piggyback on the existing per-minute /api/cron/notifications.
  4. Bounded growth. Backoff, leases, fencing and the 7-day terminal prune are fine. But pending, retry and blocked rows never age out, Redis failures retry forever, and a missing REDIS_URL never marks a row published, so a misconfigured instance gains a row per action indefinitely. Add a delivery TTL in minutes after which rows are marked expired, since a reconnect already does an authoritative refresh. Also cap or alert on blocked rows.
  5. Gate off means 200. With the gate added, the cron's gate-off path should be a 200 no-op, not a 503.
  6. Ordering. Bypassing the global since filter is what drives most of the hub rework. A late lower-sync_id event is only missed by connections that subscribed after it was allocated, which already happens with direct publish today, and those clients loaded state on subscribe. I'd keep since semantics in v1. With the TTL, most of the historical replay authorization work goes away. Keep the strict per-issue version check and counterVersion dedupe.
  7. The in-request drain should run via after() or waitUntil rather than block the response, or the added latency should be stated.
  8. Placement. docs/pr5-outbox-plan.md would be published on the public docs site (VitePress excludes only superpowers/**), and it carries PR status tables. Please move it to extras/ or the PR body.

Copy link
Copy Markdown
Contributor

Rechecked unchanged head 297867d. Current proposal review should continue in #569, which addresses the prior design feedback and keeps the plan outside published product documentation. Preserve this PR as proposal history until its replacement lands. Neither proposal authorizes outbox implementation or activation.

Copy link
Copy Markdown
Contributor

The revised proposal in #569 has now landed as a79b93d9bf93e3699d0ee400441b680a0b9b7eb6, after current-main integration, full verification and fresh CI. It preserves this proposal's history and makes the staged rollout and v1 recovery prerequisites explicit. Closing this older draft as superseded; implementation and activation remain separate work.

@imshashank imshashank closed this Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Docs, the README, or anything that explains Orbit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agents as a first class actor, assignable and attributed

2 participants