GitHub user sshiv012 added a comment to the discussion: Revert & Redo for AI 
Agent turns (rewind the workflow to before an agent edit)

Yeah the redo stack is basically revert in reverse, all in-memory in the 
agent-service, no persistence or schema changes.

Revert moves HEAD back to the turn's parent and replays beforeWorkflowContent, 
and stashes the old HEAD on a redo stack. The steps don't get deleted, they 
stay in the tree. Redo just pops that stack, moves HEAD forward and replays the 
step's afterWorkflowContent. It's a stack rather than single-level so you can 
revert a few turns and redo them back in order. Sending a new prompt wipes the 
redo stack though, new prompt branches from wherever HEAD is, so the forward 
history is dead at that point (same as normal undo/redo).

Wiring-wise the server sends a HeadChangeEvent { headId, workflowContent, 
canRedo } and the FE recomputes the visible chat + reloads the canvas from it. 
canRedo also rides on the snapshot event so a reconnect renders the button 
state right. Both commands get rejected mid-generation, otherwise they'd race 
the loop's own HEAD writes.

I already built this last week btw, prototype's up with tests passing. Let me 
get the PR up.

GitHub link: 
https://github.com/apache/texera/discussions/6039#discussioncomment-17543084

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to