Skip to content

feat(broker): append spawn model to spawned-agent origin_actor#1091

Merged
willwashburn merged 1 commit into
mainfrom
feat/origin-actor-model-broker
Jun 11, 2026
Merged

feat(broker): append spawn model to spawned-agent origin_actor#1091
willwashburn merged 1 commit into
mainfrom
feat/origin-actor-model-broker

Conversation

@willwashburn

Copy link
Copy Markdown
Member

Part 2 of model sourcing (#3 fast-follow) — the broker producer side. Pairs with cloud#2077 (the parser).

Spawned agents are now attributed as agent-relay-cli/agent/<harness>@<model> when the broker knows the model from the spawn request, so relaycast_server_* telemetry can segment by model ("what models are people using").

Changes

  • New telemetry::agent_origin_actor(harness, model) helper → agent-relay-cli/agent/<harness>[@<model>] (blank model omitted).
  • worker.rs — the AgentSpec path, which the relaycast spawn action flows through with the requested model (relaycast_events.rs carries event.agent.model) — passes spec.model.
  • spawn_env_vars uses the same helper (SpawnParams has no model → None).

Deferred

Harness version stays deferred — it needs a <cli> --version subprocess on the spawn hot path. The encoding + cloud parser (cloud#2077) already support @<version>-<model> for when it lands.

Verification

714 broker tests pass (+1 agent_origin_actor); clippy + fmt clean.

Rollout

After this + cloud#2077 merge and a broker release ships, spawned agents with a model report e.g. agent-relay-cli/agent/codex@gpt-5, and cloud derives origin_actor_model=gpt-5.

🤖 Generated with Claude Code

Spawned agents are now attributed as agent-relay-cli/agent/<harness>@<model>
when the broker knows the model from the spawn request, so relaycast server
telemetry can segment by model ("what models are people using"). Cloud parses
the digit-less @-suffix as a model (cloud#2077).

- New telemetry::agent_origin_actor(harness, model) helper building
  agent-relay-cli/agent/<harness>[@<model>] (blank model omitted).
- worker.rs (the AgentSpec path, which the relaycast spawn action flows
  through with the requested model) passes spec.model.
- spawn_env_vars uses the same helper (SpawnParams has no model -> None).

Harness version stays deferred (it needs a subprocess on the spawn hot path);
the encoding + cloud parser already support `@<version>-<model>` when it lands.

714 broker tests pass; clippy + fmt clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@willwashburn willwashburn requested a review from khaliqgant as a code owner June 11, 2026 02:05
@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4f217fbc-5679-4a78-a403-fcd450907ae7

📥 Commits

Reviewing files that changed from the base of the PR and between 4226027 and fb88480.

📒 Files selected for processing (3)
  • crates/broker/src/spawner.rs
  • crates/broker/src/telemetry.rs
  • crates/broker/src/worker.rs

📝 Walkthrough

Walkthrough

This PR centralizes the construction of the AGENT_RELAY_ORIGIN_ACTOR telemetry value by introducing a new helper function agent_origin_actor in telemetry.rs that formats the string from harness and optional model parameters. The spawner and worker are updated to call this helper instead of formatting the string inline, allowing the model to be incorporated into the telemetry when available.

Changes

Incorporate model into agent origin actor telemetry

Layer / File(s) Summary
New telemetry helper for origin actor
crates/broker/src/telemetry.rs
Added agent_origin_actor(harness, model) function that constructs the spawned-agent origin actor string in the form agent-relay-cli/agent/<harness>, optionally appending @<model> when the model is non-empty after trimming. Unit tests verify correct formatting for model-present, model-absent, and whitespace-only model inputs.
Update spawner to use the telemetry helper
crates/broker/src/spawner.rs
The spawn_env_vars function now calls crate::telemetry::agent_origin_actor(harness, None) to set AGENT_RELAY_ORIGIN_ACTOR instead of formatting the string inline, preserving the conditional inclusion when harness is provided.
Update worker to incorporate model into origin actor
crates/broker/src/worker.rs
The worker's in-process spawning logic now calls crate::telemetry::agent_origin_actor(harness, spec.model.as_deref()) to incorporate the spawned model into the telemetry origin actor value. Updated comments clarify that the value now encodes both the harness CLI and the spawned model.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • AgentWorkforce/relay#1076: Both PRs propagate the spawned model in the broker/worker flow—main PR incorporates spec.model into AGENT_RELAY_ORIGIN_ACTOR via telemetry::agent_origin_actor, while retrieved PR ensures AgentSpec.model is actually set from the spawn event.
  • AgentWorkforce/relay#1069: Main PR's updates to spawn_env_vars and worker.rs for AGENT_RELAY_ORIGIN_ACTOR formatting build on the retrieved PR's work that threads the orchestrator harness into spawned agent env.
  • AgentWorkforce/relay#1085: Both PRs update crates/broker/src/telemetry.rs and the broker's origin-actor wiring—feat(broker): origin_actor — bump relaycast crate 3.0.0, emit CLI path #1085 adds BROKER_ORIGIN_ACTOR for relaycast clients, while the main PR adds agent_origin_actor(...) for spawned agents.

Suggested reviewers

  • khaliqgant

Poem

🐰 A helper hops in, with model in tow,
Telemetry's cleaner, its purpose will show,
From spawner to worker, the path flows just right,
Origin actors now gleam with full light! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: appending the spawn model to the spawned-agent origin_actor for telemetry purposes.
Description check ✅ Passed The description is comprehensive and complete, covering summary, changes, deferred work, verification, and rollout plan. It exceeds the minimal template requirements.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/origin-actor-model-broker

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 and usage tips.

@willwashburn willwashburn merged commit 8892f23 into main Jun 11, 2026
38 checks passed
@willwashburn willwashburn deleted the feat/origin-actor-model-broker branch June 11, 2026 02:18
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