feat: tangent - remote agent for runview and editor - #2728
Open
maxy-shpfy wants to merge 2 commits into
Open
maxy-shpfy wants to merge 2 commits into
maxy-shpfy wants to merge 2 commits into
Conversation
This was referenced Sep 17, 2026
🎩 PreviewA preview build has been created at: |
This was referenced Sep 17, 2026
Collaborator
Author
This was referenced Sep 17, 2026
maxy-shpfy
force-pushed
the
09-16-feat_tangent_-_remote_agent_for_runview_and_editor
branch
from
September 18, 2026 18:52
c6bc6c4 to
4da5bd3
Compare
maxy-shpfy
force-pushed
the
09-16-feat_tangent_-_remote_agent_for_runview_and_editor
branch
3 times, most recently
from
September 18, 2026 19:28
168c361 to
593b8ab
Compare
maxy-shpfy
marked this pull request as ready for review
September 18, 2026 19:34
This was referenced Sep 18, 2026
This was referenced Sep 19, 2026
Mbeaulne
added this pull request to stack #2782
September 22, 2026 14:59
Mbeaulne
reviewed
Sep 22, 2026
This was referenced Sep 22, 2026
camielvs
reviewed
Sep 23, 2026
| ); | ||
| client = nextClient; | ||
|
|
||
| return new Promise<void>((resolve, reject) => { |
Collaborator
There was a problem hiding this comment.
🤖 This is an AI-generated code review comment.
Medium — this promise can never settle.
If client !== nextClient (a newer connect() superseded this one), both the connect and connect_error handlers return early, so neither resolve nor reject ever runs. Any caller awaiting connect() hangs forever and its cleanup never fires. A socket that stalls without emitting connect_error has the same effect.
Two suggestions:
- In the superseded branches, settle rather than return — either
resolve()orreject(new Error("superseded by a newer connection")), whichever the callers should see. - Add a connection timeout that rejects, so a silently stalled socket surfaces instead of hanging.
This was referenced Sep 23, 2026
camielvs
force-pushed
the
09-16-feat_tangent_-_remote_agent_for_runview_and_editor
branch
from
September 23, 2026 22:35
1c61400 to
c8f0685
Compare
The routing bridge resolved the active tab on every call, so a project-level agent could read pipeline A, the person switches to B while it reasons, and its next addInput or setPipelineName lands in B. submitPipelineRun routes the same way. Each agent now gets its own bridge, proxied in at spawn, whose target is pinned at the start of every turn. Re-targeting between turns is kept — that is what the router is for — but a turn stays on the tab it began against. The pin is per agent rather than global because one worker hosts several and turns are only serialized per agentId, so two can be in flight at once. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
camielvs
force-pushed
the
09-16-feat_tangent_-_remote_agent_for_runview_and_editor
branch
from
September 23, 2026 23:37
c8f0685 to
ae3a256
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Introduces the remote sub-agent runtime for Tangent, enabling Prime to spawn editor and run-inspector agents directly into embedded pipeline and run-view tabs. Each spawned agent runs in a dedicated Web Worker (
remoteEnvWorker.ts) backed bycreateRemoteEnvWorkerApi, which hosts multiple isolatedMemorySessioninstances and serializes turns per agent. The agent worker is wired to the tab's liveToolBridgeApivia Comlink, so CSOM mutations are undoable canvas edits visible in real time.Key additions:
remoteEditorAgent— a flat (non-routing) agent that receives a resolved CSOM tool allowlist and system prompt from Prime, selects the permitted tools from a mode-aware registry (full mutating surface foreditor, read-only inspect surface forrunView), and appends a tool-availability section and optional task-specific instructions to its base prompt.createRemoteEnvWorkerApi— the worker-side API:init,setAiConfig,setContext,spawnAgent,runTurn,abortAgent,killAgent. Turns are serialized per agent; overlapping turns for the same agent are rejected. Respawn correctly isolates old abort controllers from new ones.remoteEnvHost— upgraded from a pure tool-catalog host to a full spawn/message/kill orchestrator. Turns are chained peragentId, kill/disconnect abort in-flight turns without surfacing them as errors, and lifecycle events (start,activity,end,error) are streamed back to Prime viaagentEvent.connectRemoteEnvWithRefresh— extracted token-refresh loop with exponential back-off on failure,onConnectedcallback fired only after the socket resolves, and a stop function for clean teardown.TangentRemoteEnvProvider— shared transport component for any spawnable tab: boots the worker, connects with token refresh, pushes AI config and context changes into the worker without rebuilding the connection.TangentEditorAgentProvider/TangentRunAgentProvider— thin wrappers that build the appropriateToolBridgeApi(editor with live CSOM mutations, run view with read-only fetches) and hand it toTangentRemoteEnvProvider.EmbeddedPipelineEditorandEmbeddedRunView— extended withsessionId,environmentId, and environment/bridge lifecycle callbacks so the workarea shell can wire each tab into the project-level environment registry.TangentProjectContext— adds per-tab environment and bridge registries (registerTabEnvironment,waitForTabEnvironment,registerTabBridge,getActiveTabBridge) backed by refs so the routing bridge and workarea tools can read live state outside React's render cycle.createActiveTabRoutingBridge— aToolBridgeApithat forwards every call to whichever pipeline tab is currently active, giving the project-level editor agent a stable target as the user switches tabs.createWorkareaRemoteTools— extended with run-inspect tools (get_run_status,debug_pipeline_run,get_execution_details,get_execution_state,get_container_state,get_container_log) backed by a project-level backend bridge, andopen_workarea_targetnow waits for the tab's environment to connect before returning so Prime receives theenvironmentIdit needs to spawn into that tab.useLazyBridgeAuth— extracted hook providing stable lazy getters for backend URL and auth token, used by both the editor and run-view bridge builders.remoteEditor.md) and run inspector (remoteRun.md) agents.tangent-shellfeature flag now also enables the AI settings sidebar item.validatePipelineis now individually exported fromcreateCsomToolsalongsideallTools.Screenshots (if applicable)
Test Instructions
tangent-shellflag enabled.list_workarea_tabs/open_workarea_targetresponses.debug_pipeline_runand the fine-grained execution tools without being able to mutate the spec.Additional Comments
@tangent/remote-subagenthas been removed from the knip ignore list as it is now a direct runtime dependency ofremoteEnvHost. TheremoteEnvWorker.tsentry point has been added to knip so dead-code analysis covers the worker build.