Add IndexedDB autosave backup for UI config and fix WebuiManager typing#722
Open
Niraj12chaudhary wants to merge 2 commits intobrowser-use:mainfrom
Open
Add IndexedDB autosave backup for UI config and fix WebuiManager typing#722Niraj12chaudhary wants to merge 2 commits intobrowser-use:mainfrom
Niraj12chaudhary wants to merge 2 commits intobrowser-use:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
2 issues found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/webui/interface.py">
<violation number="1" location="src/webui/interface.py:119">
P1: Autosave persists sensitive UI fields (e.g., API key password inputs) to IndexedDB/localStorage because all `webui-*` controls are saved without exclusions.</violation>
<violation number="2" location="src/webui/interface.py:154">
P2: Unvalidated `JSON.parse` in localStorage fallback can throw and abort persistence initialization, preventing restore/autosave setup.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds browser-side backup/restore for WebUI settings to prevent config loss on accidental tab close/refresh, and fixes typing issues in
WebuiManager.What was the bug
UI settings were only persisted via manual Save UI Settings (server JSON).
If users changed settings and refreshed/closed the tab before saving, config was lost.
What was fixed
1) Browser-side config backup/restore
beforeunloadvisibilitychange(when tab goes hidden)2) Stable component mapping
elem_idinWebuiManageras:webui-{tab}-{name}3) Typing and config-load cleanup
save_configreturn type corrected tostr.load_confignow has explicit typed generator return and usesgr.update(...).agent_settings.planner_llm_providercallback flow.4) Security + robustness hardening (follow-up fix)
JSON.parseintry/catchand clears corrupted local cache to avoid init failure.Validation
python -m compileall src/webui/interface.py src/webui/webui_manager.pyRelated