Skip to content

feat(tangent): keep an agent's edits in frame on the canvas - #2789

Draft
camielvs wants to merge 1 commit into
09-22-feat_bring_tangent_onto_the_dashboardfrom
09-22-feat_autofit_the_canvas_while_an_agent_edits
Draft

camielvs wants to merge 1 commit into
09-22-feat_bring_tangent_onto_the_dashboardfrom
09-22-feat_autofit_the_canvas_while_an_agent_edits

Conversation

@camielvs

@camielvs camielvs commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Why

The agent edits the pipeline the user is watching on the Tangent page, and its
work lands wherever the graph happens to grow. Past the first couple of tasks
that is routinely outside the viewport, so the user watches an empty canvas
while the agent works — which defeats the point of having the canvas open.

What

Every spec mutation the agent's bridge makes runs inside an undo group, so the
undo store the bridge is handed is the one seam that catches all of them — and
only them, since nothing the user does on the canvas goes through the bridge's
copy. fitViewAfterEdits wraps it and asks the editor store for a fit after
each group; useFitViewOnRequest on the canvas answers.

  • Coalesced. One tool call can open several undo groups, so requests settle
    for 250ms before a single animated fitView({ maxZoom: 1, duration: 300 }).
    Separate tool calls are seconds apart, so each still reads as its own step.
  • Off-screen tabs are skipped. An inactive workarea tab stays mounted at no
    size; fitting against nothing would leave it on a viewport nobody chose.
  • Standalone editor is untouched. The wrapper is applied in
    TangentEditorAgentProvider, which only renders for an embedded Tangent
    session, so /editor-v2 never requests a fit.

Deliberate trade-off: the viewport does move under the user while the agent
works. That is the ask — seeing what is going on beats holding a position.

Testing

  • useFitViewOnRequest.test.tsx — frames on request, stays put when nothing
    asks, one fit per burst, fits again for a later request, skips a zero-size
    pane, nothing after unmount.
  • fitViewAfterEdits.test.ts — requests per edit, counts each one, still
    groups the edit and returns its result.
  • Full suite green.

Not verified in the browser: the remote editor sub-agent errors on spawn in
my local environment, so no agent edit reaches the canvas to watch. It fails
identically on a clean tree, so it is not this change — but the visible
behaviour is worth a look once that is back up.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Sep 22, 2026

Copy link
Copy Markdown

🎩 Preview

A preview build has been created at: 09-22-feat_autofit_the_canvas_while_an_agent_edits/2284c78

camielvs commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

The agent edits the pipeline the user is watching, and its work lands
wherever the graph grows — routinely outside the viewport, which is the
whole point of watching.

Every spec mutation the agent's bridge makes runs inside an undo group,
so wrapping the undo store the bridge is handed catches all of them and
nothing the user does on the canvas. Each one asks the editor store for
a fit; the canvas coalesces a burst into one animated refit, and skips a
workarea tab that is mounted but off screen.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@camielvs
camielvs force-pushed the 09-22-feat_bring_tangent_onto_the_dashboard branch from e1be4f8 to fd3dda9 Compare September 23, 2026 20:57
@camielvs
camielvs force-pushed the 09-22-feat_autofit_the_canvas_while_an_agent_edits branch from a7d6d5d to 2284c78 Compare September 23, 2026 20:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant