Skip to content

FIX: keep user-authored working text across runtime generation changes - #2873

Merged
Roman Lutz (romanlutz) merged 4 commits into
microsoft:mainfrom
ManoharPaturi:fix/chat-working-copy-persistence
Sep 28, 2026
Merged

Roman Lutz (romanlutz) merged 4 commits into
microsoft:mainfrom
ManoharPaturi:fix/chat-working-copy-persistence

Conversation

@ManoharPaturi

@ManoharPaturi Manohar Paturi (ManoharPaturi) commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Refs #2867

what happens

useChatConverters cleared workingInputs when the runtime generation changed, so a successful live reinitialization replaced manually edited working-copy text with the original composer text. An administrator applying config in another tab could discard another user's unsent work (P1, per issue).

fix

the generation-change branch keeps workingInputs and only invalidates the generated results (stageResults, errors, applied). working entries for pieces that no longer exist are inert since lookups are by current input id.

tests

two regression tests in a new hook test file: working text survives a generation swap, and generated stage results still clear. both fail on main (the first asserts the surviving edit; on main it comes back undefined), pass here.

env: main c32546a

…ion changes

the generation-change branch in useChatConverters wiped workingInputs,
discarding manually edited working-copy text along with the (correctly
invalidated) generated stage results. user text now survives the swap;
generated results still clear. regression tests fail on main (microsoft#2867).

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 26, 2026 07:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@romanlutz Roman Lutz (romanlutz) changed the title FIX(frontend): keep user-authored working text across runtime generation changes FIX: keep user-authored working text across runtime generation changes Sep 28, 2026
Comment thread frontend/src/hooks/useChatConverters.ts Outdated
Comment thread frontend/src/hooks/useChatConverters.test.tsx
@ManoharPaturi

Copy link
Copy Markdown
Contributor Author

Roman Lutz (@romanlutz) both points addressed:

  • the 🔴: the generation branch now runs the same piece reconciliation reconcileInputs applies, so a working edit survives only when its underlying value is unchanged. your exact scenario — composer changes from first draft to second draft while the generation advances — drops the stale edit instead of displaying it against the new text. new test pins it.
  • the 🟡: tests now reset the mocked generation before each test, and the clear-test creates a real stage result through a mocked previewConversion run before asserting it clears on the swap.

all three green locally, tsc clean.

Comment thread frontend/src/hooks/useChatConverters.test.tsx
Comment thread frontend/src/hooks/useChatConverters.test.tsx
…s with the generation

romanlutz's review caught that preserving workingInputs wholesale across a
generation change keeps an edit made against an older draft: the piece id
is reused, so the stale edit displays against (and can be applied to) new
text. the generation branch now runs the same piece reconciliation
reconcileInputs applies — edits survive only when their underlying value is
unchanged.

also upgrades the tests per review: generation resets per test, a real
generated stage result (mocked previewConversion) is created before the
swap and asserted cleared, and a new test pins the stale-edit drop.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
@ManoharPaturi

Copy link
Copy Markdown
Contributor Author

Roman Lutz (@romanlutz) both added:

  • the pipeline test now calls apply() after the conversion run and asserts applied['text'] exists, then verifies it is gone after the generation swap.
  • new test for the configured-pipeline working-copy path from the second reproduction: pipeline configured, hand edit on the working copy (no run), generation change — the edit survives while the generated result clears.

4/4 green.

@ManoharPaturi

Copy link
Copy Markdown
Contributor Author

Roman Lutz (@romanlutz) good catch again — the old version asserted a result that never existed. the configured-pipeline test now runs convert() after the hand edit, asserts stageResults['text'] has the real generated stage, then advances the generation and checks both halves: the working edit survives AND the generated result clears. 4/4 green.

@romanlutz Roman Lutz (romanlutz) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also left one comment thread open. Please take a look at that one.

Comment thread frontend/src/hooks/useChatConverters.test.tsx
Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>
@ManoharPaturi

Copy link
Copy Markdown
Contributor Author

Roman Lutz (@romanlutz) done — the configured-pipeline test now runs convert() after the hand edit (asserting a real stage result exists), then advances the generation and checks both halves: the hand edit survives while the generated result clears. pushed in 714f455, 4/4 green.

@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Sep 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 28, 2026
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Sep 28, 2026
Merged via the queue into microsoft:main with commit 460d78f Sep 28, 2026
41 checks passed
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.

3 participants