Repository navigation
fix(ui): reset config dirty on reload - #40441
AaronWander wants to merge 1 commit into
Conversation
Greptile SummaryThis PR fixes a Control UI bug where clicking "Reload Config" left
Confidence Score: 4/5
Last reviewed commit: 0e06d63 |
| expect(state.configFormDirty).toBe(false); | ||
| expect(state.configForm).toEqual({ gateway: { mode: "remote" } }); | ||
| expect(state.configRaw).toBe('{\n "gateway": { "mode": "remote" }\n}\n'); |
There was a problem hiding this comment.
Test missing configFormOriginal / configRawOriginal assertions
applyConfigSnapshot also updates configFormOriginal and configRawOriginal when configFormDirty is false (lines 99–101 of config.ts). The test verifies configForm and configRaw are refreshed, but not these two derived fields. Adding assertions for them would guard against future regressions where the "original" baseline diverges from the reloaded snapshot.
| expect(state.configFormDirty).toBe(false); | |
| expect(state.configForm).toEqual({ gateway: { mode: "remote" } }); | |
| expect(state.configRaw).toBe('{\n "gateway": { "mode": "remote" }\n}\n'); | |
| expect(state.configFormDirty).toBe(false); | |
| expect(state.configForm).toEqual({ gateway: { mode: "remote" } }); | |
| expect(state.configFormOriginal).toEqual({ gateway: { mode: "remote" } }); | |
| expect(state.configRaw).toBe('{\n "gateway": { "mode": "remote" }\n}\n'); | |
| expect(state.configRawOriginal).toBe('{\n "gateway": { "mode": "remote" }\n}\n'); |
Prompt To Fix With AI
This is a comment left during a code review.
Path: test/ui-config-reload-clears-dirty.test.ts
Line: 57-59
Comment:
**Test missing `configFormOriginal` / `configRawOriginal` assertions**
`applyConfigSnapshot` also updates `configFormOriginal` and `configRawOriginal` when `configFormDirty` is `false` (lines 99–101 of `config.ts`). The test verifies `configForm` and `configRaw` are refreshed, but not these two derived fields. Adding assertions for them would guard against future regressions where the "original" baseline diverges from the reloaded snapshot.
```suggestion
expect(state.configFormDirty).toBe(false);
expect(state.configForm).toEqual({ gateway: { mode: "remote" } });
expect(state.configFormOriginal).toEqual({ gateway: { mode: "remote" } });
expect(state.configRaw).toBe('{\n "gateway": { "mode": "remote" }\n}\n');
expect(state.configRawOriginal).toBe('{\n "gateway": { "mode": "remote" }\n}\n');
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0e06d63ad7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!state.client || !state.connected) { | ||
| return; | ||
| } | ||
| state.configFormDirty = false; |
There was a problem hiding this comment.
Restrict dirty reset to explicit reload actions
loadConfig now clears configFormDirty unconditionally, but this function is also invoked by automatic refresh paths (for example refreshActiveTab on tab switches in ui/src/ui/app-settings.ts:360-361, config loads for agents/nodes/config in ui/src/ui/app-settings.ts:188-227, and reconnect handling in ui/src/ui/app-gateway.ts:227). In those non-user-initiated cases, applyConfigSnapshot will treat the form as clean and overwrite configForm, so unsaved edits can be silently discarded just by navigating tabs or reconnecting, not only by clicking Reload.
Useful? React with 👍 / 👎.
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing this as duplicate or superseded after Codex automated review. #40441 targets a real current-main Control UI reload bug, but its implementation is too broad: it would clear Best possible solution: Close #40441 as superseded and keep #40443/#40352 as the canonical path. The best fix is a scoped explicit-reload mechanism, such as a What I checked:
So I’m closing this here and keeping the remaining discussion on the canonical linked item. Codex Review notes: model gpt-5.5, reasoning high; reviewed against 8ba82534e6c9. |
Summary
configFormDirtyset, soapplyConfigSnapshotrefuses to refreshconfigForm, causing the Model Selection dropdown to show stale values.loadConfig()now resetsconfigFormDirtybefore fetching/applying the fresh snapshot so the form state reflects the server config on explicit reload.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Closes #40352
User-visible / Behavior Changes
Clicking "Reload Config" now refreshes the Control UI form state from the latest config snapshot, so the Model Selection dropdown no longer remains stuck on stale values.
Security Impact (required)
Repro + Verification
Environment
Steps
pnpm test test/ui-config-reload-clears-dirty.test.ts.Expected
Actual
Evidence
Human Verification (required)
pnpm test test/ui-config-reload-clears-dirty.test.tsCompatibility / Migration
Failure Recovery (if this breaks)
Revert this commit.
Risks and Mitigations