Skip to content

feat: v2 - ai assistent - repair subagent#2331

Open
maxy-shpfy wants to merge 1 commit into
05-26-feat_v2_-_ai_assistant_-_tangle_help_subagentfrom
05-27-feat_v2_-_ai_assistent_-_repair_subagent
Open

feat: v2 - ai assistent - repair subagent#2331
maxy-shpfy wants to merge 1 commit into
05-26-feat_v2_-_ai_assistant_-_tangle_help_subagentfrom
05-27-feat_v2_-_ai_assistent_-_repair_subagent

Conversation

@maxy-shpfy
Copy link
Copy Markdown
Collaborator

@maxy-shpfy maxy-shpfy commented May 28, 2026

Description

Introduces a pipeline-repair sub-agent that can diagnose and fix validation issues, broken connections, missing inputs, and other structural problems in an existing pipeline. The agent operates through a new CSOM tool surface (csomTools.ts) that proxies calls to a main-thread ToolBridgeApi implementation (toolBridge.ts), which mutates the live MobX ComponentSpec inside an undo group — making all agent edits immediately visible in the editor and undoable as a single user action.

Key additions:

  • ToolBridgeApi — typed contract for the worker → main-thread bridge, covering tasks, inputs, outputs, bindings, subgraphs, arguments, and pipeline validation.
  • toolBridge.ts — main-thread implementation that delegates to existing editor actions (addTask, connectNodes, deleteEdge, validatePipeline, etc.) and computes canvas positions for newly added entities.
  • csomTools.ts — OpenAI Agents tool() wrappers for every bridge method, with Zod schemas compatible with OpenAI's strict structured-outputs mode (all optional fields are .nullable().optional()).
  • serializeSpecForAi.ts — serializes the live ComponentSpec into a compact JSON shape for the model, including an activeSubgraphPath breadcrumb so the agent knows which subgraph the user is viewing.
  • pipelineRepair.ts sub-agent and its system prompt, which defines a structured workflow: read state → validate → auto-fix what's unambiguous → ask the user for anything that isn't.
  • The AgentSession now carries a bridge reference, and the worker's init() signature accepts the Comlink-proxied bridge as a separate top-level argument.
  • The Tangle Dispatcher prompt and handoff list are updated to route "fix / validate / repair" requests to pipeline-repair and conceptual questions to general-help.

Screenshots (if applicable)

AI Assistant - Fix pipeline demo.mov (uploaded via Graphite)

Test Instructions

  1. Open a pipeline with at least one validation error (e.g. a dangling binding or a task with a missing required argument).
  2. Open the AI Chat panel and type a repair request such as "fix my pipeline" or "what's wrong with this?".
  3. Verify the dispatcher hands off to pipeline-repair (not general-help).
  4. Confirm the agent calls get_pipeline_state and validate_pipeline, then applies auto-fixable issues directly.
  5. Confirm that ambiguous fixes prompt the user for input before any mutation.
  6. Verify all edits appear immediately in the editor canvas and are undoable as a single undo step.
  7. Open a pipeline with no tasks and ask the agent to fix it — confirm it responds with the "empty pipeline" message without calling any mutation tools.

Additional Comments

The bridge is instantiated once per AiChatContent mount and closes over navigation.rootSpec and the active subgraph path lazily, so navigation changes are picked up without rebuilding the bridge. The bridge and onStatus callbacks must be passed as separate top-level Comlink.proxy() arguments because Comlink does not recursively proxy properties inside an object argument.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

🎩 Preview

A preview build has been created at: 05-27-feat_v2_-_ai_assistent_-_repair_subagent/b490705

Copy link
Copy Markdown
Collaborator Author

maxy-shpfy commented May 28, 2026

@maxy-shpfy maxy-shpfy force-pushed the 05-27-feat_v2_-_ai_assistent_-_repair_subagent branch from 21732c0 to b490705 Compare May 28, 2026 06:12
@maxy-shpfy maxy-shpfy force-pushed the 05-26-feat_v2_-_ai_assistant_-_tangle_help_subagent branch from 80b5630 to 3f8defc Compare May 28, 2026 06:12
@maxy-shpfy maxy-shpfy marked this pull request as ready for review May 28, 2026 06:15
@maxy-shpfy maxy-shpfy requested a review from a team as a code owner May 28, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant