Skip to content

feat(relay): plan-based gating, KV error logging, and request logging#33

Open
iceteaSA wants to merge 1 commit into
cortexkit:mainfrom
iceteaSA:feat/relay-worker-improvements
Open

feat(relay): plan-based gating, KV error logging, and request logging#33
iceteaSA wants to merge 1 commit into
cortexkit:mainfrom
iceteaSA:feat/relay-worker-improvements

Conversation

@iceteaSA
Copy link
Copy Markdown
Contributor

@iceteaSA iceteaSA commented May 21, 2026

Worker script improvements:

  • Plan-based gating: WebSocket transport requires paid plan (RELAY_PLAN=paid), returns 403 on free
  • KV error logging: Non-429/403 upstream errors logged to KV with 7-day TTL for post-mortem debugging
  • Request logging: HTTP and WebSocket requests logged on paid plan only
  • GET health endpoint: Returns plan info and available transports

All changes are within the WORKER_SCRIPT constant — no client-side relay code modified.


Summary by cubic

Adds plan-based gating to the relay worker and improves observability with KV-backed error logging, request logs, and a health endpoint. All changes are scoped to WORKER_SCRIPT; no client relay code touched.

  • New Features
    • WebSocket transport requires paid plan (RELAY_PLAN=paid); returns 403 on free.
    • Non-429/403 upstream errors are logged to RELAY_STATE KV with a 7-day TTL (includes response preview and headers).
    • Request logging for HTTP and WebSocket is enabled only on the paid plan.
    • GET health endpoint returns status, plan, and available transports (HTTP on free; HTTP + WebSocket on paid).

Written for commit 5e33a83. Summary will update on new commits. Review in cubic

…ging

Worker script improvements:
- Plan-based gating: WebSocket transport requires paid plan (RELAY_PLAN=paid)
- KV error logging: non-429/403 upstream errors logged to KV with 7-day TTL
- Request logging: HTTP and WebSocket requests logged on paid plan
- GET health endpoint returns plan info and available transports
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread packages/core/src/relay.ts
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