Repository navigation
fix(mcp): a microflow created over MCP keeps its flow sides and notes - #1534
Merged
Merged
Conversation
The create path sent no connection sides, so Studio Pro drew every flow right -> left: @anchor, CASE outcome anchors and the builder's own sides were lost (11.15.0-rc.4: a CASE read back 1 -> 3 on all eight flows). A note failed the whole create, since mapObjectTree had no Annotation case. buildFlowDocContent now maps each sequence flow's indexes onto originConnectionSide/destinationConnectionSide (setPEDSides, shared with the splice). It also writes notes as Microflows$Annotation and their lines as Microflows$AnnotationFlow elements: origin/destination plus the required connection indexes, defaulting through the new AnnotationFlow.SidesOrDefault, which the modelsdk writer uses as well. The skeleton adapter keeps a note line's $Type and shifts its ends past the parameters. On the pre-11.14 constructor, whose flows are untyped, notes are refused rather than risk a note line read as a sequence flow. The splice sent a note line with the constructor's originId/destinationId keys, which PED refuses. It now uses the same mapping and adds note lines after its new sequence flows, because PED stores an AnnotationFlow after a SequenceFlow added later in the same update. Verified live against Studio Pro 11.15.0-rc.4: the same script gives identical sides on all 10 flows over --mcp and on the modelsdk engine, note lines included; with the fix reverted every flow read back 1 -> 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 21, 2026
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.
Builds on #1528 (merged), which added
AnnotationFlow.Sides.Problem
Microflows created over
--mcp(Studio Pro's PED API) lost two things:originConnectionSide/destinationConnectionSide, so Studio Pro drew every flow right → left.@anchor, CASE outcome anchors and the builder's own side choices had no effect. Measured on 11.15.0-rc.4: a CASE built with@anchor(from: bottom, Approved: (from: right), (empty): (from: bottom, to: top))read back1 -> 3on all eight flows.@annotationfailed the whole create (microflow object type *microflows.Annotation is not yet supported by the MCP backend).Fix
buildFlowDocContentmaps each sequence flow's connection indexes onto the constructor's side fields, using the helper the splice already used (setPEDSides, moved out of the mutator).mapObjectTreemaps a note toMicroflows$Annotation(position, caption, size). The note lines follow the sequence flows asMicroflows$AnnotationFlowelements. PED's AnnotationFlow is an element type, not a constructor: its ends areorigin/destination(notoriginId/destinationId), and its sides are the requiredoriginConnectionIndex/destinationConnectionIndex.AnnotationFlow.SidesOrDefault()(insdk/microflows) holds the unoriented default (2 → 0). Both the modelsdk writer and the MCP backend use it, so the two engines cannot drift apart on it.$Typeand shifts itsorigin/destinationpast the parameters, as it does for sequence flows.$Type, so a note's line could only be read as a SequenceFlow, which would be an execution edge out of the note.originId/destinationId, which PED refuses ("/origin":"Expected reference (string), got undefined", measured). This was hidden becausemapObjectTreerefused the note before its line was reached. Fixed with the samepedAnnotationFlow. The splice now also adds note lines after its new sequence flows. Within one update PED stores a note line after a sequence flow added later (measured), and the splice's follow-up sets address a new sequence flow by index.Verification
mdl/backend/mcp: sides on both constructor shapes, notes on the skeleton (positions, sizes, captions, shifted references, explicit and default sides), notes refused on the full constructor, and the splice's note line. All of them failed before the fix with the reported symptom.--mcp, then compared every flow's (origin, destination, sides) after resolving PED's$id(...)references. All 10 flows are identical, both note lines included (2 → 0 and 0 → 2), as are the note positions, sizes and captions.ped_check_errorsis clean on two successive calls.1 -> 3on every flow, and with notes it failed the create.ped_update_documentprobes:origin/destinationplus indexes is accepted, andoriginId/destinationIdis refused.make build && make test && make lintpass.Reproduction script:
mdl-examples/bug-tests/mcp-create-flow-sides-and-notes.mdl. Measurements are indocs/03-development/PED_MCP_CAPABILITIES.md(11.15 section), and the finding is recorded under.claude/skills/fix-issue/findings/mdl-backend/.Not fixed here (found while verifying)
/flows/N/line/originControlVectoron a flow added in the sameped_update_documentfails the whole update withundefined is not an object (evaluating 'u.$Type'). Setting the wholelineinstead is accepted but not applied. A plain one-activity insert reproduces it, so the splice's note-line fix above is verified only by direct probes, not end to end.$T: System.UserType) is sent as an entity over MCP (/parameters/0/entity … not found).Test documents left in the open Studio Pro project (PED has no delete):
MyFirstModule.MCPS_CaseNotes,MCPS_CaseSidesControl,MCPS_SpliceNote,MCPS_SplicePlain,MCPS_NoteProbe.🤖 Generated with Claude Code