You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(work): make AI Work application undoable as a single editor edit #300
The current single-document AI Work flow applies the returned modified_content through onDocumentChange(...). That updates application state, but it does not deliberately apply the AI result through Monaco's edit API or establish an undo boundary for the operation.
The merged AI Work Panel feasibility roadmap in #280 explicitly calls out preserving Monaco undo/redo history for AI Work and recommends applying full-document changes through editor.executeEdits(...) with stack boundaries.
The editor's per-tab Monaco model isolation was already addressed by #251, so this task is limited to how an AI Work result itself is applied.
Scope
Apply a successful, fresh AI Work result through the mounted Monaco editor when available.
Replace the current document as one deliberate editor operation (for example via editor.executeEdits("ai-work", ...)).
Use appropriate Monaco undo stack boundaries so one Undo restores the exact pre-Work document and Redo restores the AI-applied document.
Preserve the existing state/preview synchronization path through the editor change callback.
Keep a safe fallback for cases where the editor/model is unavailable.
Add focused regression coverage for the apply/undo grouping logic that can be exercised in the existing frontend test harness.
Acceptance criteria
Applying an AI Work result to the unchanged active document remains functionally equivalent to today.
A single Undo after the AI Work apply restores the exact pre-Work document content.
Redo restores the AI-applied content.
The change does not merge the AI Work replacement into the user's previous typing undo step.
Existing per-tab model isolation remains intact.
Focused regression coverage is added and frontend test/lint/build remain green.
Activity
fix(work): make AI Work replacement undoable (petertzy#300)
fix(work): apply AI Work results as a single undoable editor edit