feat: emit origin_actor from spawned agents (JS SDK + per-worker)#1090
Conversation
Completes the origin_actor producer rollout for the JS spawned-agent path
(the ~23%). Consumes @relaycast/sdk 3.1.1 (relaycast#187), which renamed the
`harness` option -> `originActor` / `X-Relaycast-Origin-Actor`.
JS:
- relaycast-telemetry.ts (cli + sdk): resolve `originActor` from a new
AGENT_RELAY_ORIGIN_ACTOR env (the broker sets the per-worker path), falling
back to `agent-relay-cli/agent/<orchestrator-harness>` synthesized from the
existing harness env. `relaycastTelemetryOptions` now returns `{ originActor }`.
- messaging/relaycast.ts: pass `originActor`.
- bump @relaycast/sdk ^2.x -> ^3.1.1 (cli + sdk) + lockfile.
Broker (supersedes the open #1078):
- spawn_env_vars: set AGENT_RELAY_ORIGIN_ACTOR=agent-relay-cli/agent/<harness>
(was AGENT_RELAY_HARNESS), with the per-worker harness from
infer_harness_from_command(params.cli) (was the orchestrator harness).
- worker.rs (pty/app-server): stamp the same path from spec.cli.
- infer_harness_from_command -> pub(crate).
Result: each spawned JS agent reports `agent-relay-cli/agent/<its-harness>`
(codex / claude-code / …), per-agent — closing the 23% the core (broker-own,
agent-relay-cli/cli) didn't cover.
713 broker tests pass; clippy + fmt clean; sdk tsc clean; agent-relay (6) +
mcp.startup (20) JS tests pass. The cli typecheck vs the real 3.1.1 is left to
CI (verified 3.1.1 has originActor + the model spawn field).
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! |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR migrates telemetry attribution from a ChangesOrigin Actor Telemetry Migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8f737f2c06
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const harness = | ||
| nonEmpty(explicit.harness) ?? | ||
| HARNESS_ENV_KEYS.map((key) => nonEmpty(env[key])).find((value): value is string => Boolean(value)); | ||
| const originActor = nonEmpty(explicit.originActor) ?? resolveOriginActor(env); |
There was a problem hiding this comment.
Preserve the deprecated harness telemetry option
When existing @agent-relay/sdk callers still pass the previously supported harness option to AgentRelay or RelaycastMessagingClient (especially JavaScript callers that are not type-checked), this now ignores it because only explicit.originActor is read before constructing the Relaycast client. Since the package remains on the same 8.3.x line, those clients silently stop sending attribution rather than being mapped to the new originActor; keeping harness as a deprecated alias here would avoid dropping telemetry during the rollout.
Useful? React with 👍 / 👎.
Completes the
origin_actorproducer rollout for the JS spawned-agent path (~23%) — the piece the core (broker's ownagent-relay-cli/cli, v8.3.6) didn't cover. Consumes@relaycast/sdk3.1.1 (relaycast#187), which renamed theharnessoption →originActor/X-Relaycast-Origin-Actor.JS
relaycast-telemetry.ts(cli + sdk): resolveoriginActorfrom a newAGENT_RELAY_ORIGIN_ACTORenv (the broker sets the per-worker path), falling back toagent-relay-cli/agent/<orchestrator-harness>synthesized from the existing harness env.relaycastTelemetryOptionsnow returns{ originActor }.messaging/relaycast.ts: passoriginActor.@relaycast/sdk^2.x → ^3.1.1(cli + sdk) + lockfile.Broker (supersedes the open #1078)
spawn_env_vars: setAGENT_RELAY_ORIGIN_ACTOR=agent-relay-cli/agent/<harness>(wasAGENT_RELAY_HARNESS), with the per-worker harness frominfer_harness_from_command(params.cli)(was the orchestrator harness).worker.rs(pty/app-server): stamp the same path fromspec.cli.infer_harness_from_command→pub(crate).Result
Each spawned JS agent reports
agent-relay-cli/agent/<its-harness>(codex / claude-code / …), per-agent — closing the 23%.Verification
fmt --checkclean.sdktsc clean;agent-relay(6) +mcp.startup(20) JS tests pass.originActorand themodelspawn field, so it'll compile).Closes
Supersedes #1078 (per-worker attribution) — please close it in favor of this.
🤖 Generated with Claude Code