feat(sdk-typescript): rename telemetry harness → origin_actor#187
Conversation
Aligns @relaycast/sdk (JS) with the engine 3.0.0 contract (relaycast#184).
The JS SDK now sends the `X-Relaycast-Origin-Actor` header / `?origin_actor=`
WS query from an `originActor` option (was `harness` / `X-Relaycast-Harness`).
- origin.ts: HARNESS_HEADER -> ORIGIN_ACTOR_HEADER; sanitizeHarness ->
sanitizeOriginActor; max 120 -> 128 and allow `@` for the
{app}/{type}/{name}@{version}-{model} path.
- client.ts / ws.ts / relay.ts / agent.ts: the `harness` option + internal
`_originHarness` -> `originActor`; WS query `harness` -> `origin_actor`.
Breaking: the public `harness` constructor option is now `originActor`; no
alias (per cloud/plans/origin-actor.md). The domain session-event types are
untouched.
357 tests pass; tsc clean.
This is the JS-SDK foundation for the spawned-agent (23%) attribution. Once
published, the relay side (telemetry options + broker per-worker env) consumes
it to emit agent-relay-cli/agent/<harness>.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Warning Review limit reached
More reviews will be available in 5 minutes and 34 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR systematically renames the harness origin identifier concept to originActor across the TypeScript SDK. HTTP client options, WebSocket client options, and internal storage now use originActor with updated header and query-parameter names, with corresponding sanitization and validation logic. Tests validate sanitization behavior, HTTP header stamping, WebSocket query parameter forwarding, and origin precedence rules. ChangesOrigin Actor Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/sdk-typescript/src/__tests__/harness.test.ts (1)
274-297:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winTest checks wrong query param name — will always pass.
Line 296 asserts
url.searchParams.has('originActor')but the wire query param isorigin_actor(snake_case, as correctly checked on line 271). This assertion will always pass regardless of whether the param is present, making the test ineffective.🐛 Proposed fix
- expect(url.searchParams.has('originActor')).toBe(false); + expect(url.searchParams.has('origin_actor')).toBe(false);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/sdk-typescript/src/__tests__/harness.test.ts` around lines 274 - 297, The test in packages/sdk-typescript/src/__tests__/harness.test.ts is asserting the wrong query param name — change the assertion at the end of the test that currently checks url.searchParams.has('originActor') to check for the correct wire parameter 'origin_actor' so the test actually verifies WsClient (constructed via new WsClient) omits the snake_case origin_actor param; keep the rest of the MockWs and construction logic unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@memory/workspace/.relay/state.json`:
- Line 1: The tracked runtime workspace files under .relay (e.g., state.json and
outbox/capabilities.json) should be ignored and removed from the repo; add an
ignore rule like **/.relay/ to your .gitignore (or update existing ignore rules
to include .relay/), then remove the already-tracked files from version control
with git rm --cached for memory/workspace/.relay/state.json and
memory/workspace/.relay/outbox/capabilities.json and commit the change so the
runtime-only reconcile timestamps/counters and environment-specific roots are no
longer committed.
---
Outside diff comments:
In `@packages/sdk-typescript/src/__tests__/harness.test.ts`:
- Around line 274-297: The test in
packages/sdk-typescript/src/__tests__/harness.test.ts is asserting the wrong
query param name — change the assertion at the end of the test that currently
checks url.searchParams.has('originActor') to check for the correct wire
parameter 'origin_actor' so the test actually verifies WsClient (constructed via
new WsClient) omits the snake_case origin_actor param; keep the rest of the
MockWs and construction logic unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b47644c1-1599-4ed9-b477-e21bb291c5de
📒 Files selected for processing (9)
memory/workspace/.relay/outbox/capabilities.jsonmemory/workspace/.relay/state.jsonpackages/sdk-typescript/src/__tests__/harness.test.tspackages/sdk-typescript/src/agent.tspackages/sdk-typescript/src/client.tspackages/sdk-typescript/src/index.tspackages/sdk-typescript/src/origin.tspackages/sdk-typescript/src/relay.tspackages/sdk-typescript/src/ws.ts
| @@ -1 +1 @@ | |||
| {"workspaceId":"rw_7ccfea89","remoteRoot":"/memory/workspace","localRoot":"/home/daytona/workspace/memory/workspace","mode":"poll","syncMode":"mirror","intervalMs":5000,"lastReconcileAt":"2026-06-10T15:44:24.943864768Z","lastSuccessfulReconcileAt":"2026-06-10T15:44:24.943864768Z","staleAfter":"2026-06-10T15:44:34.943864768Z","status":"ready","states":{"stale":false,"offline":false,"hasConflicts":false,"hasPendingWriteback":false},"pendingWriteback":0,"pendingConflicts":0,"deniedPaths":0,"counters":{"snapshotDeleteBlocked":53},"circuit":{"open":false,"openedAt":"0001-01-01T00:00:00Z","windowMs":60000,"cooldownMs":30000,"threshold":5,"nextRetry":"0001-01-01T00:00:00Z"},"outbox":{"pending":0,"needsAttention":0,"failed":0,"acked":0}} | |||
| {"workspaceId":"rw_7ccfea89","remoteRoot":"/memory/workspace","localRoot":"/home/daytona/workspace/memory/workspace","mode":"poll","syncMode":"mirror","intervalMs":5000,"lastReconcileAt":"2026-06-10T23:49:15.652167138Z","lastSuccessfulReconcileAt":"2026-06-10T23:49:15.652167138Z","staleAfter":"2026-06-10T23:49:25.652167138Z","status":"ready","states":{"stale":false,"offline":false,"hasConflicts":false,"hasPendingWriteback":false},"pendingWriteback":0,"pendingConflicts":0,"deniedPaths":0,"counters":{"snapshotDeleteBlocked":16},"circuit":{"open":false,"openedAt":"0001-01-01T00:00:00Z","windowMs":60000,"cooldownMs":30000,"threshold":5,"nextRetry":"0001-01-01T00:00:00Z"},"outbox":{"pending":0,"needsAttention":0,"failed":0,"acked":0}} No newline at end of file | |||
There was a problem hiding this comment.
Prevent committing Relay runtime workspace state (memory/workspace/.relay/)
memory/workspace/.relay/state.json(andmemory/workspace/.relay/outbox/capabilities.json) is currently tracked and contains runtime-only reconcile timestamps/counters and environment-specific roots, so it creates unnecessary repo noise.- Add an ignore rule for
.relay/directories (e.g.,**/.relay/) and remove the already-tracked files from version control if they aren’t meant to ship.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@memory/workspace/.relay/state.json` at line 1, The tracked runtime workspace
files under .relay (e.g., state.json and outbox/capabilities.json) should be
ignored and removed from the repo; add an ignore rule like **/.relay/ to your
.gitignore (or update existing ignore rules to include .relay/), then remove the
already-tracked files from version control with git rm --cached for
memory/workspace/.relay/state.json and
memory/workspace/.relay/outbox/capabilities.json and commit the change so the
runtime-only reconcile timestamps/counters and environment-specific roots are no
longer committed.
Aligns
@relaycast/sdk(JS,packages/sdk-typescript) with the engine 3.0.0 contract (relaycast#184). This is the JS-SDK foundation for the spawned-agent (23%) attribution — PR1 only did engine + sdk-rust, so the JS SDK still sent the old header.Changes
The JS SDK now sends
X-Relaycast-Origin-Actor(HTTP) /?origin_actor=(WS) from anoriginActoroption:origin.ts:HARNESS_HEADER→ORIGIN_ACTOR_HEADER;sanitizeHarness→sanitizeOriginActor; max 120 → 128 and allow@for the{app}/{type}/{name}@{version}-{model}path.client.ts/ws.ts/relay.ts/agent.ts: the publicharnessoption + internal_originHarness→originActor; WS queryharness→origin_actor.Breaking
The public
harnessconstructor option is noworiginActor— no alias (per plan). Domain session-event types are untouched.Verification
357 sdk-typescript tests pass;
tsc --noEmitclean.Next (the two-repo chain, like the harness saga)
@relaycast/sdk(a new version) — this PR.withRelaycastTelemetry/relaycastTelemetryOptionspassoriginActor, bump the@relaycast/sdkdep, and the broker sets the per-worker env toagent-relay-cli/agent/<harness>(folding in the open #1078). That flips the JS spawned-agent traffic fromunknown→ per-agent harness.🤖 Generated with Claude Code