Skip to content

refactor: remove in-product Relay orchestration - #987

Merged
rynfar merged 1 commit into
pylonfrom
refactor/remove-relay-pair-orchestration
Oct 3, 2026
Merged

rynfar merged 1 commit into
pylonfrom
refactor/remove-relay-pair-orchestration

Conversation

@rynfar

@rynfar rynfar commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Retires Pylon's bridge to the Relay Orchestrator Claude plugin. It was a stand-in while upstream's orchestrator was unavailable; upstream shipped orchestrator v2 (de34391427), so this removes the bridge rather than carrying two delegation implementations.

Removed

  • orchestration/RelayWorkerBridge.ts (1858 lines) and orchestration/RelayCli.ts — plugin discovery via installed_plugins.json and scripts/relay.mjs
  • provider/relayMcpConfig.ts — PYLON_RELAY_CLI opt-in and Codex app-server args
  • Optional-service wiring in server.ts, ws.ts, OrchestrationReactor, ProviderRuntimeIngestion
  • Relay MCP injection in ClaudeAdapter and CodexAdapter
  • The Relay Orchestrator section of docs/user/thread-sidebar.md

Wire contract

Drops the relay-only fields source: "relay", relaySequence, relayPriorUsage.

cancellable and watchable stay — they are generic capability flags that Prime and native agents also use, with !== false defaults.

No data migration: these were all Schema.optional, and Schema.Struct ignores excess properties on decode, so events persisted before this change still decode. A new subagentRuntime test folds a legacy relay-shaped payload and asserts it becomes an ordinary agent row.

Migration 063_ClearUnprojectedRelayOutages is kept — it is registered at index 63 and already applied, so it stays immutable.

Logic that collapsed

  • ProjectionSnapshotQuery — removed the relay_lifecycle / active_relay_lifecycle CTEs and their pinned-activity union
  • ThreadBackgroundLiveness — dropped the relay set. No work outlives its session now, so clearThreadLiveness deletes the thread entry outright and hasNativeBackgroundWork is a size check
  • subagentRuntime — deleted the attempt/sequence fence (acceptRelayEvent), per-attempt reset, cumulative usage accounting and the now-dead addUsage; canCancelSessionAgent lost its third detachedControlsAvailable parameter
  • ChatView.logic — planBackgroundAgentStop reduced algebraically to canInterruptParent with no detached workers, so it is deleted and ChatView uses a plain canStopBackgroundWork
  • web session-logic + mobile threadActivity — removed the relay.binding/relay.activation skips, the origin-backfill, the resulting dead toolOrigins maps, and relay-panel: spawn-group keys

Out of scope

The managed relay tunnels are a different subsystem from June 2026 and are untouched: packages/shared/src/relay*, packages/contracts/src/relay*, packages/client-runtime/src/relay/, apps/server/src/relay/, infra/relay/, deploy-relay.yml, and the relay:read/relay:write scopes.

Pair mode needed no work here — it was already removed by eb73be4a27 (#673) on 2026-09-19.

Verification

  • Typecheck clean: t3, @t3tools/contracts, @t3tools/client-runtime, @t3tools/web, @t3tools/mobile (run per package; vp run -F/--filter silently skipped some)
  • vp test run green on the changed scope: 12 files, ~560 tests, including ThreadBackgroundLiveness, ProjectionSnapshotQuery, subagentRuntime, session-logic, AgentsPanel, threadActivity, sessionAgentMenu, both adapters, and migration 063
  • Lint clean on changed files (0 errors; remaining ChatView.tsx warnings are pre-existing)
  • ClaudeAdapter.test.ts fails if CLAUDE_CODE_ENABLE_TODO_TOOLS is set in the ambient environment — pre-existing, unrelated; 192/192 pass with it unset

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Pylon's bridge to the Relay Orchestrator Claude plugin was a stand-in while
upstream's orchestrator was unavailable. Upstream shipped orchestrator v2, so
this removes the bridge rather than carrying two delegation implementations.

Deletes RelayWorkerBridge, RelayCli and relayMcpConfig, and unhooks their
optional-service wiring from server.ts, ws.ts, OrchestrationReactor and
ProviderRuntimeIngestion. The Claude and Codex adapters no longer inject a
relay MCP server.

Drops the relay-only wire fields (source, relaySequence, relayPriorUsage).
cancellable and watchable stay: they are generic capability flags that Prime
and native agents also use. Historical events keep decoding because Struct
ignores excess properties, covered by a new fold regression test.

Collapses the logic those fields carried:
- ProjectionSnapshotQuery drops the relay lifecycle pinning CTEs.
- ThreadBackgroundLiveness loses its relay set; no work outlives its session,
  so clearThreadLiveness drops the thread entry outright.
- subagentRuntime loses the attempt/sequence fence and cumulative usage
  accounting; canCancelSessionAgent loses its detached-controls parameter.
- planBackgroundAgentStop reduced algebraically to canInterruptParent once
  detached workers were gone, so ChatView uses that directly.

The managed relay tunnels (packages/shared/src/relay*, infra/relay,
apps/server/src/relay, deploy-relay.yml) are a different subsystem and are
untouched. Migration 063 stays: it is registered and already applied.
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL labels Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 14.0 KiB 14.0 KiB +14 B (+0.1%) 15.1 KiB ✅
Codex Thread snapshot wire 7.3 KiB 7.3 KiB +5 B (+0.1%) 7.3 KiB ✅
Codex Live turn WebSocket wire 6.7 KiB 6.7 KiB +9 B (+0.1%) 7.8 KiB ✅
Codex Live turn WebSocket decoded 58.0 KiB 58.0 KiB 0 B (0.0%) 66.4 KiB ✅
Codex Live turn messages 9 9 0 (0.0%) 21 ✅
Claude Total thread wire 14.0 KiB 14.0 KiB +9 B (+0.1%) 15.1 KiB ✅
Claude Thread snapshot wire 7.3 KiB 7.3 KiB +2 B (+0.0%) 7.3 KiB ✅
Claude Live turn WebSocket wire 6.7 KiB 6.7 KiB +7 B (+0.1%) 7.8 KiB ✅
Claude Live turn WebSocket decoded 58.9 KiB 58.9 KiB 0 B (0.0%) 66.4 KiB ✅
Claude Live turn messages 9 9 0 (0.0%) 21 ✅

Baseline: ea2f22f · PR result: abed954 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 115.8 KiB
  • Claude decoded thread snapshot: 116.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@rynfar
rynfar merged commit 6f90102 into pylon Oct 3, 2026
21 checks passed
@rynfar
rynfar deleted the refactor/remove-relay-pair-orchestration branch October 3, 2026 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant