Repository navigation
fix(agent): render panel lost the connections on large SVGs - #99
Merged
Merged
Conversation
The agent cut every tool result at MAX_OUTPUT_CHARS (20k) before building the UI panel. That limit protects the model's context, but it also cut the picture: D2 writes its connections after its shapes, so the panel drew boxes and lost the lines while the editor (which fetches the SVG directly) was fine. SVG panels now get their own cap (2M chars, KR0KI_STORYB00K_MAX_PANEL_SVG_CHARS); model-facing text keeps the 20k limit. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GgXQRGsprSZc2oXGNj9n8X
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.
Symptom: in the agent's Rendered diagram panel the boxes drew but the lines between them were missing; editing the code in the editor showed the correct diagram.
Cause:
panel_from_tool_resultran the SVG throughtruncate(..., MAX_OUTPUT_CHARS=20000). D2 writes its connections after its shapes, so a 12-node diagram (24.5k chars, connections from ~18.7k) kept the boxes and about one line. The editor fetches the SVG directly, so it never hit the cap.Fix: SVG panels get their own cap (
KR0KI_STORYB00K_MAX_PANEL_SVG_CHARS, default 2,000,000). Model-facing text keeps the 20k limit.Tests: two new cases in
test_panels.py(a large SVG arrives whole; non-SVG text is still truncated). The first failed before the change. Agent suite: 85 pass.🤖 Generated with Claude Code
https://claude.ai/code/session_01GgXQRGsprSZc2oXGNj9n8X