Skip to content

Bug: Save anyway discards newer node edits made while the automation version is saving #3607

Closed

Description

@yannickmonney

Only Submitted draft was sent. Success unconditionally calls setDraft(null), restores the submitted text and disables Save/Discard; Later unsaved draft is lost.

Reproduced against 44e0dcf254975286c0e9dea443b5cd1ca6b23347. Suggested severity: P2.

Reproduction

  1. Open an automation in two sessions. In session A edit a node; let session B append a newer version.
  2. In A choose Save → Save version, then Save anyway in the stale-version conflict. Keep the append request pending (for example, network throttling).
  3. The conflict dialog closes. Change the still-editable Prompt from Submitted draft to Later unsaved draft while the save is pending.
  4. Allow the append to finish successfully.

Expected: Keep editing locked during the append, or preserve later edits as a dirty draft after the submitted version lands.

Actual: Only Submitted draft was sent. Success unconditionally calls setDraft(null), restores the submitted text and disables Save/Discard; Later unsaved draft is lost.

Impact: Authors can lose node changes immediately after explicitly resolving a concurrent-version conflict.

Evidence

AUTO-002 proves save.isPending=true, no dialog, writable Prompt, older mutation payload, later visible draft, then replacement and cleared dirty controls on deferred resolution.

Executed from /tmp/tale-audit-settings-44e0dcf2:

/Users/yannick/.npm/_npx/22f2fe8d8bc13000/node_modules/.bin/bun x --no-install vitest run --config /Users/yannick/.codex/notes/tale-100-findings/auto-batch1.vitest.config.ts --maxWorkers=2 --reporter=verbose --silent=false

Observed result: 6 passed (6), exit 0. These are observation tests asserting the current defect and its controls, not regression tests asserting the desired behavior. Frozen test: auto-editor-batch1.test.tsx; log: auto-batch1.log; config: auto-batch1.vitest.config.ts.

Controls:

  • Cancelling a stale-version refusal retains the unsaved document and enabled Save.
  • The second mutation uses the latestVersion from the refusal as baseVersion; this is later client draft loss, not a failed backend concurrency precondition.

Source

Scope and deduplication

  • Local Vitest/jsdom proof uses the real AutomationEditor, NodeInspector and shared editor/dialog/input controls. Only data hooks and the layout-dependent React Flow canvas are fixture seams.
  • No live backend, provider, network call, browser geometry, production action or source change. The fixture controls asynchronous response delivery; it does not claim network timing was measured.
  • The harness intentionally omits DirtyBlockerProvider because these tests do not navigate; the logged provider warning is not the finding.
  • Searched all 931 cached issue titles for automation/workflow, cursor/run, Input/JSON, stale/draft/save/pending.
  • Compared the current findings.json ledger (31 accepted findings at freeze). No matching automation implementation/root cause.
  • Parent reviewed live all-state GitHub results for the affected feature before filing; no matching current root cause was found.
  • Bug: Team editor accepts new typing during Save then closes with that newer draft unsaved #3585: Similar symptom in TeamEditDialog, but a separate component and completion path; no shared failing save primitive. This is AutomationEditor.saveAnyway → submitSave.
  • Improvement: Improve unsaved-changes handling when switching agent and automation settings tabs #2572: Closed navigation/unsaved-tab handling improvement; no navigation is involved here.

Parent verification: independently reran the frozen component suite successfully; retained output: auto-parent-batch1.log. Live all-state issue titles and relevant older reports were reviewed before filing.

Acceptance: reproduce the stated boundary in a regression test, preserve the working control, and verify the corrected behavior in the local UI before landing.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions