Skip to content

873 update system prompt when source or target language is changed#1017

Open
Luke-Bilhorn wants to merge 9 commits into
mainfrom
873-update-system-prompt-when-source-or-target-language-is-changed
Open

873 update system prompt when source or target language is changed#1017
Luke-Bilhorn wants to merge 9 commits into
mainfrom
873-update-system-prompt-when-source-or-target-language-is-changed

Conversation

@Luke-Bilhorn
Copy link
Copy Markdown
Contributor

I made this so that the user is asked to regenerate (or edit) their system prompt if they change the source or target language (see issue). Made it so that it does not give a warning against changing it, since in this case the user almost certainly does need to change this. Also made sure that the other use cases of system prompt editing have not broken, and changed the button colors to match throughout.

To test:

  • change the project language and make sure the flow of updating the system prompt is good
  • go to edit the system prompt in copilot settings and verify it looks good
  • create a new project and verify that the system prompt flow there is unchanged

The component is consumed outside StartupFlow already (NewSourceUploader),
and an upcoming SystemMessageReview webview will reuse it too. Move it to
the shared components directory so its location reflects its scope.

No behavior change.
…mMessageStep

These let consumers reuse the component in non-walkthrough contexts (e.g.
the upcoming system-message review prompt after a language change), where
a contextual banner and an explicit "I don't need to change this" dismiss
button are needed.

Defaults preserve current behavior in NewSourceUploader.
A standalone React app that hosts the shared SystemMessageStep with a
language-change warning banner and an "I don't need to change this"
dismiss button. Will be opened after a project source/target language
change to prompt the user to review their AI translation instructions.

Wired into the build pipeline alongside the other webview apps. Not yet
opened from anywhere; provider wiring follows in subsequent commits.
Adds openSystemMessageReview(reason) and registers
codex-editor-extension.promptSystemMessageReview as a thin wrapper. The
panel hosts the SystemMessageReview webview and handles the
generate / save / dismiss flow against MetadataManager.

If the panel is closed without the user addressing the prompt (save,
regenerate, or "I don't need to change this"), the AI translation
instructions are regenerated automatically so they don't stay stale
relative to the new language. Concurrent triggers reuse a single panel
so back-to-back source+target changes don't spawn duplicate windows.

Not yet triggered from anywhere; wiring follows in the next commit.
Wires the codex-editor-extension.promptSystemMessageReview command into
both paths that can change a project's source or target language after
initial setup:

- codex-project-manager.changeSourceLanguage / changeTargetLanguage
  (MainMenu and project settings entry points)
- StartupFlowProvider.handleProjectChange (pre-open project edit screen)

The prompt is only shown when the selected language tag differs from
the existing one, so re-confirming the same language is a no-op. The
initial project-creation flow remains untouched.

Closes #873.
…ning per context

- Simplify the Generate/Save button internals: drop the hand-rolled
  margin/padding offsets that produced uneven icon spacing in favor of
  a single inline-flex wrapper with a uniform gap. Fixes the wonky-
  looking sparkle icon on the Generate button.
- Add generateLabel + skipOverwriteWarning props to SystemMessageStep.
- The new SystemMessageReview panel now shows "Regenerate" and skips
  the overwrite-confirmation dialog (regenerating is the expected next
  step of that flow).
- Trim the overwrite warning copy to "Generating a new message will
  overwrite your current text." since the Cancel / Overwrite and
  Generate buttons make the rest self-explanatory.
The review panel's "Save Translation Instructions" label was long enough
to wrap inside the fixed-min-width button, producing a visually broken
multi-line label. Shorten the review label to "Save" and add
white-space: nowrap to the button content wrappers so future labels
can't wrap either.
In the language-change review flow the expectation is that the user
*changes* their translation instructions, so Regenerate should be the
primary call-to-action and Save should be demoted. Once the user has
either regenerated or edited the text manually, swap them so Save is
the highlighted next step.

Behavior is gated behind a new emphasizeGenerateUntilEdited prop so the
existing project-creation flow (where Save is always primary) is
unaffected.
In the Copilot Settings system-message editor:
- The Regenerate button keeps its layout but swaps the sparkle icon for
  a spinning loader while a generation is in flight, and disables itself
  to prevent re-entry.
- The textarea, the empty-state Generate button, and the "Save All
  Settings" button are also disabled during generation so the user
  can't edit or save half-state. Cancel stays available as an escape.
- The provider now posts generateError when generation throws, so the
  webview can recover its UI state instead of staying stuck on the
  spinner.
@Luke-Bilhorn Luke-Bilhorn linked an issue Jun 1, 2026 that may be closed by this pull request
@Luke-Bilhorn
Copy link
Copy Markdown
Contributor Author

We still could go back and make sure all the "Regenerate" buttons have the same rounding.

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.

Update system prompt when source or target language is changed.

1 participant