Repository navigation
fix(init): Pi and OpenCode sessions join Relay on their own after relay init - #2018
Conversation
… relay init The core's activation check hard-coded open Pi and OpenCode sessions as never eligible, so `auto_activate` (which relay init turns on) put Codex and Claude sessions on the relay but never Pi or OpenCode ones. Add per-provider opt-ins `pi_auto_activate` and `opencode_auto_activate` (store settings, off by default, person-only to turn on). With `auto_activate` on, a live Pi or open OpenCode session now joins by itself only when its own opt-in is on; `auto_activate` alone (the desktop's switch) keeps today's join-only-when-added behavior. relay init turns on the opt-in for each chosen tool next to `pi_extension` / `opencode_plugin`, records it, and `--uninstall` / `--delivery mcp` turn off exactly that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-ins Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Add and persist provider settings crates/probe/contract/CoreContract.swift, crates/probe/src/relay/contract/agents/settings.rs, crates/probe/src/relay/store/settings_extras.rs, crates/probe/src/relay/store_settings.rs, crates/probe/src/relay/spawn/settings.rs, crates/probe/src/relay/settings_registry.rs, crates/probe/tests/relay_agents.rs, crates/probe/docs/relay-core.md |
Settings contracts and store extras add optional Pi and OpenCode activation values. Store settings expose both values, and save and restore paths handle them. |
Apply provider opt-ins to session eligibility crates/probe/src/relay/agents.rs, crates/probe/src/relay/agents/auto_activation.rs, crates/probe/src/relay/local/directory_trait.rs, crates/probe/src/relay/setup.rs, crates/probe/src/relay/local/tests/automatic_admission.rs |
Pi and open OpenCode sessions require global auto_activate and their respective opt-in. Session admission and setup checks evaluate the combined settings. Tests cover the opt-in requirements. |
Enable settings through relay init packages/cli/src/cli/lib/probe-core.ts, packages/cli/src/cli/lib/probe-core.test.ts, packages/cli/src/cli/commands/init.test.ts, docs/probe-move.md, CHANGELOG.md |
Tool delivery enables the corresponding provider setting. Tests cover setting ownership, uninstall behavior, and rejected settings. Documentation and the changelog describe the settings and init behavior. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Bug fix
Sequence Diagram(s)
sequenceDiagram
participant relay_init
participant Core
participant Store
participant activate_new_sessions
participant activation_applies
participant AgentRelay
relay_init->>Core: enable selected provider setting
Core->>Store: persist settings extras
activate_new_sessions->>Store: read ActivationSettings
Store-->>activate_new_sessions: global and provider settings
activate_new_sessions->>activation_applies: evaluate session kind and settings
activation_applies-->>activate_new_sessions: eligibility result
activate_new_sessions->>AgentRelay: register eligible session
Possibly related PRs
- AgentWorkforce/relay#2016: Adds the core-backed
relay initdelivery flow and per-tool delivery settings extended by this change.
Merge Risk: 
Minimal · up to a80c1
-
No actionable merge-blocking risk remains from the reviewed change.
Pre-merge checks: 
3 · 
2
-
Failed checks: 2 warnings Passed checks: 3 passedFull details: Description check
-
Explanation
The description gives detailed problem, root-cause, fix, and test information, but it does not follow the required template. It omits the required Summary, Test Plan, and RelayFlow Proof sections, including the change type and case identifier.
Resolution
Add the required template sections. Include a Summary, a Test Plan with the tests-added/updated and manual-testing items, and a RelayFlow Proof with Change type set to bugfix and exactly one RelayFlow case under tests/relayflows/cases/<case-id>/. Add a Screenshots section if applicable.
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 71.43% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 14 functions across 15 files. (1 skipped: 1 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- 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.
A rabbit checks the settings store,
Pi and OpenCode join the floor.
With global and local switches bright,
New sessions hop into Relay’s light.relay init sets each chosen key,
Then sends the messages happily.
Comment @coderabbitai help to get the list of available commands.
[Medium impact] This PR appears safe to merge.
|
…ed as unused Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…auto-join # Conflicts: # docs/probe-move.md
Problem
An end-to-end test of
agent-relay@15.0.0-next.4showed that afterrelay initsets up Pi or OpenCode, their sessions never join Relay on their own. Codex and Claude sessions do: withauto_activateon, a Codex session auto-joined ascodex-<project>-sessionand received injected DMs.Root cause
The fault is in the core's admission check, not in init.
relay initalready turns onpi_extension/opencode_pluginandauto_activate. ButLocalSessions::activation_check(crates/probe/src/relay/local/directory_trait.rs) hard-codedAs a result, a live Pi or open-OpenCode session was never eligible for automatic activation, whatever the settings were. Init had no setting it could turn on to change that.
Fix
pi_auto_activateandopencode_auto_activate. They are off by default, and only the person can turn them on (PERSON_TURNS_ON). They are kept in the store's extras and merged across writers like the other extras.agents/auto_activation.rs):activation_appliesnow takesActivationSettings. Withauto_activateon, Pi and open OpenCode sessions activate only when their own opt-in is also on.auto_activateoff or unset still wins./setup/status'sauto_activatesandactivation_outstanding.auto_activatealone, which the desktop's switch does, still leaves Pi and OpenCode sessions joining only when added. The desktop installs both routes by default, soauto_activateon its own could not be used as the signal.probe-core.ts):PROBE_DELIVERY.piis now[pi_extension, pi_auto_activate]andPROBE_DELIVERY.opencodeis now[opencode_plugin, opencode_auto_activate]. The existing generic machinery records exactly what init turned on.--uninstalland--delivery mcpturn off exactly that. A refused opt-in rolls the tool back and gives it the MCP fallback, as for any other setting.docs/probe-move.mdandcrates/probe/docs/relay-core.md. CHANGELOG has an entry under[Unreleased - Major]→ Fixed.The diff only touches the Pi and OpenCode entries in
probe-core.ts.init.tsis unchanged.Tests
auto_activation.rs): the policy matrix.auto_activateon alone does not admit Pi or OpenCode. Each opt-in admits only its own kind. Neither opt-in overridesauto_activateoff or unset. The settings are read from the store.local/tests/automatic_admission.rs): a live Pi session, an extension registry held by a fake process, goes throughactivate_new_sessionsagainst a fake Relaycast.auto_activateon: no registration.pi_auto_activateon: it registers, pinned to the livepi:600:…binding.auto_activateoff or unset: no registration, even with the opt-in on.settings_extrasserialization and merge tests cover the new fields, andrelay_agentschecks thesettings.getshape.init.test.ts,probe-core.test.ts):pi_auto_activate.opencode_auto_activateon--uninstall.--uninstall.E2E
Run locally against the built core-only probe and CLI, fully isolated: temp HOME,
AGENT_RELAY_HOME/INSTALL_DIR, XDG dirs and core socket under/tmp/orlh, project at~/orl-project.relay init --tools opencode --yesrecordedturnedOn: [opencode_plugin, opencode_auto_activate, auto_activate].opencode(1.14.22) in the project made it auto-join asopencode-orl-project-new-session(kindopencode-open) without being added.relay message dm send opencode-orl-project-new-session "E2E-PING-7731…" --as e2e-senderwas injected into the running TUI session as an[via Agent Relay — from @e2e-sender …]user message. The model could not answer because OpenCode's free tier was exhausted, so the message showed as QUEUED.relay init --uninstallturned off exactlyopencode_plugin, opencode_auto_activate, auto_activate.Pi is not installed on the test machine, so Pi is covered by the core integration test above, not a live run.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.