ref(seer): Add priority-based root node selection to snapshot_to_markdown#113715
Conversation
…down Sort root nodes by data.priority (descending, default 0) and render only nodes at the highest priority level. This lets frontend components declare their importance so the backend selects the most relevant context without frontend route-based filtering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 00c9422. Configure here.
Use isinstance check to safely handle cases where priority is None or a non-int value instead of relying on dict.get default. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Zylphrex
left a comment
There was a problem hiding this comment.
Just a question around why priority is stored inside data instead of being lifted to the node but otherwise LTGM
| data = node.get("data") | ||
| if isinstance(data, dict): | ||
| for key, value in data.items(): | ||
| if key == "priority": |
There was a problem hiding this comment.
Where is the name of this coming from? Should this be in a constant somewhere explaining why they're being skipped? Should it be stored separately from the actual data so we don't need to do special handling by comparing it against a hard coded key name?
There was a problem hiding this comment.
Each page defines the priority of root nodes on it. So say on dashboards, the dashboard page root has priority 0 so it's but into the LLM on page context. Now if the user opens a new widget pullout on that dashboard it should get higher priority i.e. and should be put into the on page context rather than the original dashboard since that's what the user is interacting with. The logic in the function only puts the root nodes with the highest priority in the on page context.
Priority is only relevant for root nodes. The continue here is just to skip it once they are sorted and processed and to not the add the priority explicitly into the LLM on page context.
There was a problem hiding this comment.
I like the idea of making it a const as well. You can reference the key when setting the vals on the json blob as well, ts has a nice shortcut syntax for that: {[SOME_CONST]: some_val}
There was a problem hiding this comment.
Okay I'll move it a be an optional property node so we don't need this special handling here.
Move priority to a top-level node field rather than embedding it in data. This avoids hardcoded key skipping in _render_node. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The docstring referenced data.priority but _get_priority reads from node.priority directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…13717) + Add priority: 1 to widget-builder's useLLMContext data so the backend selects it over the dashboard node. Remove the WIDGET_BUILDER_ROUTES frontend filtering that was doing this client-side. + Will merge this after the backend PR: #113715 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

Uh oh!
There was an error while loading. Please reload this page.