Repository navigation
fix(chat): /untangle in a view navigated into another file's workflow - #238
Merged
Merged
Conversation
Navigated in place, the editor of jpeg_flow.py drew place.py's workflow
and its GLSP session drew place.py. The untangle tools asked the chat
host for a panel open on place.py; the panel is the editor's, on
jpeg_flow.py, so untangle-propose failed ("No chat panel is open on this
diagram"), and untangle-end found no session of the chat's file after
the turn.
- A session names itself to the chat host by its GLSP client id beside
the file it draws (DiagramChatTarget). The extension maps the client to
its editor's document as VS Code spells it, the webview's workflowUri
(getChatUriForClientId, diagram-chat-routing.ts), the drawn file after.
- diagramToolSession takes the session the editor shows first, whatever
file its view draws.
- /untangle looks the session up before the turn and names it in the
prompt: Claude over ACP loads tool schemas on first use and called
untangle-start with no sessionId.
Claude-Session: https://claude.ai/code/session_011UYzzUKxNqKPdmLsRmJ6Xu
…ds unchanged - The other chat commands keep acting on a diagram of the chat's file: "the session shown here, whatever file it draws" is diagramToolSession's anyView, /untangle's alone. Without it /agent or a rename in a view of another file's workflow would write into that file while its auto-layout went to the chat's. - Each chat message carries its diagram's GLSP client id (ChatCommandContext.diagramClientId): of two editors on a file, /untangle untangles the one whose panel it was typed in, not the file's last-used editor. - A session's follow-ups go to the chat its card went to, or nowhere: an editor closed while its card waited no longer sends "Untangle discarded" to another editor's chat of the drawn file. - afterTurn looks the session up again when the one it untangled is gone (the editor reopened during the turn). - The docs say what is routed: the chat of the editor's file, its panel that spoke last. Claude-Session: https://claude.ai/code/session_011UYzzUKxNqKPdmLsRmJ6Xu
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.
What was wrong
/untanglefailed in a view navigated in place into another file's workflow. A live run onjpeg_flow.py › flow › placed (place)showed two faults:untangle-proposefailed: "No chat panel is open on this diagram to put the try to the person."jpeg_flow.pydrawsplace.py's workflow, and its GLSP session'ssourceUriisplace.py.place.py. The chat panel is the editor's, and it speaks forjpeg_flow.py.untangle-endfound no session of the chat's file.untangle-startfailed with nosessionId. Claude over ACP loads a tool's schema on first use, so the first call had nosessionId. It then askedsession-infoand called again.What changes
DiagramChatTarget). The untangle tools pass the base handler'sclientId.routeDiagramChat(diagram-chat-routing.ts) maps the client to its editor's document, spelled as VS Code spells it, which is the webview'sworkflowUri(getChatUriForClientId). The drawn file is tried after it.diagramToolSessiontakes the session the editor shows first, whatever file its view draws./untanglelooks the session up before the turn and names it in the prompt ("This diagram's session is "…": pass it as sessionId to every untangle tool.").afterTurnends that same session.Tests
diagram-chat-routing.test.ts:untangle-command.test.ts:untangle-kept-in-layout.test.ts: the tools ask the chat with{clientId, sourceUri}.Review (
/code-review medium), fixed in 44ffe9b/agentor a rename in a nested view would write into the nested file while its auto-layout went to the chat's file. That rule is nowdiagramToolSession'sanyViewoption, and only/untanglepasses it.ChatCommandContext.diagramClientId), and/untangleuses it.afterTurnlooks the session up again when ending the captured one fails, for example when the editor was reopened during the turn.Live check (wfpy harness)
nested_untangle.py's workflow instantiatestangledfromuntangle_demo.py. Navigated in place (crumbsouter / inner), the session drawsuntangle_demo.pywhile the chat isnested_untangle.py's.untangle-startsucceeded on its first call.untangle_parts.py, the "applied" message reached the same chat, and Undo put the file back.https://claude.ai/code/session_011UYzzUKxNqKPdmLsRmJ6Xu