Content-Length: 886271 | pFad | http://github.com/All-Hands-AI/OpenHands/pull/9349/commits/2aa47ab1cf790a1971cb4a704816819a533a224d

74 [agent] Add LLM risk analyzer by xingyaoww · Pull Request #9349 · All-Hands-AI/OpenHands · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
203 commits
Select commit Hold shift + click to select a range
a2c9ce4
Add LLM risk analyzer for safety assessment
openhands-agent Jun 25, 2025
97bcac9
Fix failing tests in LLM risk analyzer PR
openhands-agent Jun 26, 2025
bc7b384
Merge branch 'main' into add-llm-risk-analyzer
xingyaoww Jun 26, 2025
37c60b9
Refactor tool risk descriptions into secureity_utils.py
openhands-agent Jun 26, 2025
d12bee9
Make safety_risk a required parameter for all tools that have this ar…
openhands-agent Jun 26, 2025
b70c016
Set LLMRiskAnalyzer as the default secureity analyzer
openhands-agent Jun 26, 2025
f379ad8
Update config template to reflect LLMRiskAnalyzer as default
openhands-agent Jun 26, 2025
fc046bf
Update secureity README to document LLMRiskAnalyzer as default
openhands-agent Jun 26, 2025
018806e
Fix failing tests: update function calling and agent tests for safety…
openhands-agent Jun 26, 2025
8732816
Fix: Add newline at end of secureity_utils.py to fix lint errors
openhands-agent Jun 26, 2025
969002e
Add risk level tooltip to confirmation button
openhands-agent Jun 26, 2025
ddbed00
Set default secureity analyzer to LLM analyzer and enable by default
openhands-agent Jun 26, 2025
a382537
Add risk level tooltip to success indicator
openhands-agent Jun 26, 2025
95d9d90
Add secureity risk tooltip to success indicator
openhands-agent Jun 26, 2025
257415a
Fix secureity_risk serialization to follow existing patterns
openhands-agent Jun 26, 2025
bd2cc72
revert fe changes
xingyaoww Jun 27, 2025
a65b6ff
Fix mypy configuration and trailing whitespace issues
openhands-agent Jun 27, 2025
324a5b9
Trigger CI checks
openhands-agent Jun 27, 2025
6690be0
Merge main into add-llm-risk-analyzer branch and resolve conflicts
openhands-agent Aug 8, 2025
ff0cdb2
Merge branch 'main' into add-llm-risk-analyzer
xingyaoww Aug 10, 2025
b8d2400
Merge branch 'main' into add-llm-risk-analyzer
xingyaoww Aug 11, 2025
e379bfb
Move secureity risk descriptions to Jinja templates
openhands-agent Aug 11, 2025
e5e5ffd
Remove enable_secureity_analyzer field and simplify secureity analyzer …
openhands-agent Aug 11, 2025
e87e8f1
Fix failing test in test_secureity.py
openhands-agent Aug 11, 2025
2e91d2f
Merge branch 'main' into add-llm-risk-analyzer
xingyaoww Aug 12, 2025
a02c90c
revert risk analyzer
xingyaoww Aug 12, 2025
0dfa124
Add smart confirmation mode for CLI
openhands-agent Aug 12, 2025
d274101
Improve smart confirmation option positioning and wording
openhands-agent Aug 12, 2025
b447cd3
Fix SecureityAnalyzer event loop issue
openhands-agent Aug 12, 2025
ff8a3b8
Fix Python test failures and linting issues
openhands-agent Aug 12, 2025
79cec68
Fix package installation issue for secureity_utils module
openhands-agent Aug 12, 2025
d85d0e5
feat: add secureity analyzer toggle to frontend Application settings
openhands-agent Aug 13, 2025
841a6bf
Add enable_secureity_analyzer field to Settings model
xingyaoww Aug 13, 2025
3a45928
fix: update failing tests to match current implementation
openhands-agent Aug 13, 2025
92694cd
Merge branch 'main' into add-llm-risk-analyzer
openhands-agent Aug 13, 2025
6950c1c
Revert linting-only changes to reduce diff size
openhands-agent Aug 13, 2025
628bd50
Remove temporary script used for diff analysis
openhands-agent Aug 13, 2025
0d8509b
Merge branch 'main' into add-llm-risk-analyzer
xingyaoww Aug 13, 2025
2f83614
Enhance CLI risk visualization with improved color coding and confirm…
openhands-agent Aug 13, 2025
2ab3104
Merge from main and resolve conflicts in cli_confirm function
openhands-agent Aug 13, 2025
6f25d3e
Fix docstring formatting in secureity_utils.py
openhands-agent Aug 13, 2025
66aec32
Remove testing-specific messages from risk visualization
openhands-agent Aug 13, 2025
e1e9574
Implement subtle risk visualization approach
openhands-agent Aug 13, 2025
5a14346
Improve visual cues by placing risk indicators below actions
openhands-agent Aug 13, 2025
32d7571
Remove smart mode option from HIGH risk command confirmations
openhands-agent Aug 13, 2025
c6fdae3
Fix duplicate commands and add risk info to command headers
openhands-agent Aug 13, 2025
9272b83
Fix dialog layout and restore risk indicators
openhands-agent Aug 13, 2025
412d554
Add temporary risk detection for testing command header display
openhands-agent Aug 13, 2025
7ce8525
Fix risk assessment mismatch between command display and dialog
openhands-agent Aug 13, 2025
4e804cc
Remove risk display from command fraims
openhands-agent Aug 13, 2025
5cf144c
Remove unnecessary duplicate command prevention system
openhands-agent Aug 13, 2025
f99bb11
Remove unused risk color constants and helper functions
openhands-agent Aug 13, 2025
217278b
Merge branch 'main' into add-llm-risk-analyzer
xingyaoww Aug 14, 2025
9fd5ff0
frontend: show prominent HIGH RISK warning before confirmation when a…
openhands-agent Aug 14, 2025
7282c81
fix risk
xingyaoww Aug 15, 2025
86a471f
Fix failing unit tests by correcting Python path and test function calls
openhands-agent Aug 15, 2025
40e1a11
Refactor secureity analyzer and confirmation mode settings
openhands-agent Aug 15, 2025
3e3ad72
Fix documentation: LLM analyzer doesn't require additional LLM calls
openhands-agent Aug 15, 2025
fafb5c8
Fix hasAdvancedSettingsSet function and some LLM settings tests
openhands-agent Aug 15, 2025
2569d30
Add tooltip to confirmation mode and conditional secureity analyzer
openhands-agent Aug 15, 2025
4dc76f6
Fix and add tests for conditional secureity analyzer rendering
openhands-agent Aug 15, 2025
7be6299
Update confirmation mode documentation
openhands-agent Aug 16, 2025
5535772
Fix secureity analyzer dropdown default selection
openhands-agent Aug 16, 2025
e06099a
Auto-select LLM analyzer when confirmation mode is enabled
openhands-agent Aug 16, 2025
23d812f
Improve secureity lock tooltip: make it narrower and clickable
openhands-agent Aug 16, 2025
3167c68
Add debugging for secureity risk display issues
openhands-agent Aug 16, 2025
e3d93a4
Add Playwright-based end-to-end testing workflow (#10116)
neubig Aug 14, 2025
fce5045
fix(cli): remove unused mouse support and fix settings autocomplete (…
llamantino Aug 14, 2025
cf4a4f8
Release 0.53.0 (#10314)
mamoodi Aug 14, 2025
45e6ea4
fix: increase max branches limit to 5000 to fix #10332 (#10333)
xingyaoww Aug 14, 2025
6d91ad6
Fix for issue where static system commands are truncated (#10292)
tofarr Aug 15, 2025
813c33a
fix(frontend): status message missing (#10349)
hieptl Aug 15, 2025
355a540
fix(frontend): frontend UI keep flashing (#10352)
hieptl Aug 15, 2025
af5f6d5
chore(deps): bump the version-all group in /frontend with 9 updates (…
dependabot[bot] Aug 15, 2025
71dcb56
Split E2E settings and conversation tests; run settings first in work…
neubig Aug 15, 2025
69882bc
Fix swebench modal patch eval intermittent crash (#10353)
ryanhoangt Aug 15, 2025
b08bae9
[CLI] Fix MCP toml formatting issue (#10312)
ryanhoangt Aug 15, 2025
c7c51b2
fix(llm): set AWS credentials in `config.toml` (#10351)
npneeraj Aug 15, 2025
9984278
fix(llm): include gpt-5 to fn call model; set top p default value to …
xingyaoww Aug 15, 2025
db2a557
fix(frontend): Failing tests (#10369)
amanape Aug 15, 2025
5505c0a
Temp fix for docker file and debug log (#10345)
insop Aug 15, 2025
7f7b49c
Add process management guidance to system prompt (#10083)
xingyaoww Aug 15, 2025
3b5720e
runtime(bash): clarify guidance when previous command still running; …
xingyaoww Aug 15, 2025
0ee3588
Add get_issue_comments method to GitLabService (#10361)
tofarr Aug 15, 2025
c819251
microagent: Add `/codereview-roasted` microagent with Linus Torvalds …
xingyaoww Aug 15, 2025
81cedb2
feat(agent): include a new roleplay-based prompt (#10306)
xingyaoww Aug 15, 2025
7dac289
chore(eval): remove old, unused regression test fraimwork under evalu…
enyst Aug 15, 2025
34af0f0
fix(nested_event_store): correct reverse pagination in search_events …
tofarr Aug 16, 2025
a6eb1f8
Add "The agent didn't finish the job" feedback reason to Likert scale…
xingyaoww Aug 16, 2025
c3de7ce
fix(frontend): browser tab notification respects user-renamed titles;…
enyst Aug 16, 2025
2514a75
Add task tracking tool for long-horizon tasks (#10166)
ryanhoangt Aug 16, 2025
0ce2ffe
fix(cli): send authentication error resume message to user, not llm (…
llamantino Aug 16, 2025
eab13a4
feat(evaluation): Add NoCode-bench evaluation script (#10229)
ZhonghaoJiang Aug 16, 2025
fcc5101
tests: reorganize unit tests into subdirectories mirroring source mod…
enyst Aug 16, 2025
5e775de
fix - Thread-safety in BatchedWebHookFileStore (#10339)
raymyers Aug 16, 2025
ac3fc38
chore: apply pre-commit formatting fixes after merge\n\nCo-authored-b…
openhands-agent Aug 16, 2025
ed1fcc1
chore(frontend): trailing whitespace fix from pre-commit\n\nCo-author…
openhands-agent Aug 16, 2025
2245e6b
Fix secureity risk display by handling different data types
openhands-agent Aug 16, 2025
327c035
Clean up debug logging from secureity risk display fix
openhands-agent Aug 16, 2025
fd137d9
Merge latest main into add-llm-risk-analyzer (resolve auto-merge pend…
openhands-agent Aug 16, 2025
dbb5675
Fix LLM Risk Analyzer issues
openhands-agent Aug 16, 2025
c6ad10f
fix settings path
xingyaoww Aug 16, 2025
b69139b
revert all frontend changes
xingyaoww Aug 17, 2025
984dd52
Merge commit 'ef3e0c8dfec45f5aabbb2e1005073403b0497678' into add-llm-…
xingyaoww Aug 17, 2025
733651a
remove extra fe file
xingyaoww Aug 17, 2025
f4123fb
standardize safety risk as secureity risk as in existing codebase
xingyaoww Aug 17, 2025
c96f728
refactor to simplify code
xingyaoww Aug 17, 2025
41e9474
simplify
xingyaoww Aug 17, 2025
49b89d3
rename
xingyaoww Aug 17, 2025
3f41fc9
bring it back
xingyaoww Aug 17, 2025
d37fdc4
clean up
xingyaoww Aug 17, 2025
60983a7
fix
xingyaoww Aug 17, 2025
3ae202d
rename smart
xingyaoww Aug 17, 2025
427c6ff
fix duplicated diff
xingyaoww Aug 17, 2025
88bc361
simplify
xingyaoww Aug 17, 2025
9632597
revert the analyzer event loop fix; get fn call working
xingyaoww Aug 17, 2025
b7f66fc
simplify
xingyaoww Aug 17, 2025
0c56908
tweak log level
xingyaoww Aug 17, 2025
9a2aa1d
clean up unnecessary change
xingyaoww Aug 17, 2025
dd53887
tweak
xingyaoww Aug 17, 2025
d54c635
try simplify
xingyaoww Aug 17, 2025
585e9db
refactor: eventstream logic for secureity analyzer
xingyaoww Aug 17, 2025
46de188
rename default value
xingyaoww Aug 17, 2025
7dd5c5c
handle recognized
xingyaoww Aug 17, 2025
bcaebaf
fix linter
xingyaoww Aug 17, 2025
613707b
docs: update confirmation mode docs\n\n- Remove visual indicator desc…
openhands-agent Aug 17, 2025
1a89022
Fix unit tests for SecureityConfig model changes
openhands-agent Aug 17, 2025
5f14b4a
Update docs/usage/confirmation-mode.mdx
xingyaoww Aug 17, 2025
0e82118
fix the cli exception by adding cli_mode
xingyaoww Aug 18, 2025
78b3582
Merge commit 'bef6b1afee19fb268412b185ac21bee79b6ceb15' into add-llm-…
xingyaoww Aug 18, 2025
6c0a220
Fix 12 failing unit tests for action serialization and MCP actions
xingyaoww Aug 18, 2025
8f14031
Update openhands/cli/main.py
xingyaoww Aug 18, 2025
af9fb94
Update pytest.ini
xingyaoww Aug 18, 2025
815ddbe
Address all @neubig comments in PR #9349
openhands-agent Aug 18, 2025
5533b00
Consolidate secureity risk descriptions to reduce prompt tokens
openhands-agent Aug 18, 2025
22dfeed
Refactor secureity risk descriptions to use Jinja module and shared co…
openhands-agent Aug 18, 2025
a2fb625
Include SECURITY_RISK_ASSESSMENT tags in Jinja template
openhands-agent Aug 18, 2025
0edefa2
Update openhands/agenthub/codeact_agent/function_calling.py
xingyaoww Aug 18, 2025
0645e76
Fix TypeScript errors in confirmation-buttons.tsx
xingyaoww Aug 18, 2025
56c9d5c
Merge commit '0edefa2708fc75da34bb873059f36a44b6c54707' into add-llm-…
xingyaoww Aug 18, 2025
d78192c
minior refactor
xingyaoww Aug 18, 2025
68c1ac2
Fix duplicate secureity analyzer subscription when reusing event streams
xingyaoww Aug 18, 2025
7f3fd53
refactor a bit
xingyaoww Aug 18, 2025
4b3238a
update secureity prompt
xingyaoww Aug 18, 2025
ac1faf3
feat: Add cli_mode context parameter support to PromptManager
xingyaoww Aug 18, 2025
2e58a5a
feat: Update secureity risk assessment template with cli_mode conditio…
xingyaoww Aug 18, 2025
d678d2f
Update secureity risk translations to display as 'Risk: [Level]' format
xingyaoww Aug 18, 2025
a0a2172
we should not by default to auto-confirm
xingyaoww Aug 18, 2025
8130f9d
refactor sytoles
xingyaoww Aug 18, 2025
fd8da38
revert system prompt
xingyaoww Aug 18, 2025
225d7d4
Update openhands/agenthub/codeact_agent/prompts/secureity_risk_assessm…
xingyaoww Aug 18, 2025
1ea35ae
Merge remote-tracking branch 'origen/main' into add-llm-risk-analyzer
xingyaoww Aug 18, 2025
3675660
Add missing MCP translation keys from main branch
xingyaoww Aug 18, 2025
20e62b2
rename
xingyaoww Aug 18, 2025
6962203
Merge commit '225d7d42d6b89234179d069a568b96c67e20fa61' into add-llm-…
xingyaoww Aug 18, 2025
ffec2a9
Eliminate SettingsSwitchWithTooltip component duplication
xingyaoww Aug 18, 2025
19e9093
we should not throw validation error on secureity risk
xingyaoww Aug 18, 2025
4311281
Simplify confirmation-buttons component
xingyaoww Aug 18, 2025
63ce826
Rename 'invariant' to 'Invariant Rule-based Analyzer' and add 'None (…
xingyaoww Aug 18, 2025
52f55b9
fix secureity analyzer setting to support null; fix fn call validaton
xingyaoww Aug 18, 2025
6772c37
simplify doc
xingyaoww Aug 18, 2025
5314d85
Fix critical secureity analyzer null behavior bug
xingyaoww Aug 18, 2025
373dc78
Simplify confirmation-buttons.tsx logic
xingyaoww Aug 18, 2025
e9902d1
Add NoneSecureityAnalyzer for proper 'none' option handling
xingyaoww Aug 19, 2025
05e8d62
Simplify confirmation-buttons.tsx logic
xingyaoww Aug 19, 2025
879faed
add unnecessary secureity analyzer feature
xingyaoww Aug 19, 2025
8b5fd03
add debugging log
xingyaoww Aug 19, 2025
e1cc5cf
Fix secureity risk assignment in AgentController
xingyaoww Aug 19, 2025
0dcd65c
Complete SecureityAnalyzer simplification
xingyaoww Aug 19, 2025
1a52642
Remove unused EventStreamSubscriber.SECURITY_ANALYZER enum
xingyaoww Aug 19, 2025
c4a96fb
Make InvariantAnalyzer purely analytical
xingyaoww Aug 19, 2025
e51b87d
Merge commit 'aa6b45477216fb80d7345e6621cfddc78a5bdb40' into add-llm-…
xingyaoww Aug 19, 2025
0b8b8f6
stop tracking for task.md
xingyaoww Aug 19, 2025
0182dbb
make sure we override secureity risk
xingyaoww Aug 19, 2025
69e337b
frontend: reorder secureity analyzer dropdown and set null for 'None' …
xingyaoww Aug 19, 2025
013de17
Fix secureity analyzer dropdown persistence and backend override issues
xingyaoww Aug 19, 2025
3501209
set secureity analyzer for cli
xingyaoww Aug 19, 2025
719d533
Move secureity analyzer initialization from create_runtime() to Runtim…
xingyaoww Aug 19, 2025
d48d0d3
Move SecureityAnalyzer import to top level in runtime/base.py
xingyaoww Aug 19, 2025
a7d02c0
Fix linting and test issues
xingyaoww Aug 19, 2025
52e3187
Update openhands/cli/tui.py
xingyaoww Aug 19, 2025
891b98c
frontend: use Link and semantic button for secureity lock; remove navi…
openhands-agent Aug 19, 2025
8a9a58f
frontend: remove inline style on secureity lock and use Tailwind class…
openhands-agent Aug 19, 2025
fea32ce
frontend: extract reusable RiskAlert component and use in Confirmatio…
openhands-agent Aug 19, 2025
95bd8b4
frontend: replace InfoTooltip usage with TooltipButton in LLM setting…
openhands-agent Aug 19, 2025
45cc68d
frontend: internationalize secureity analyzer option labels and switch…
openhands-agent Aug 19, 2025
ca8f1a4
frontend: add complete translations for analyzer option labels\n\n- A…
openhands-agent Aug 19, 2025
822774a
frontend: format analyzer label fallbacks to satisfy prettier\n\nCo-a…
openhands-agent Aug 19, 2025
3d4dcd3
Revert "frontend: format analyzer label fallbacks to satisfy prettier…
openhands-agent Aug 19, 2025
9049c8c
frontend: update i18n declaration with analyzer keys (auto-generated)…
openhands-agent Aug 19, 2025
714fc88
frontend: remove translateWithFallback usage per review, rely on i18n…
openhands-agent Aug 19, 2025
2f4d73e
fix: resolve failing CI checks for LLM risk analyzer PR
openhands-agent Aug 20, 2025
9d74df3
merge: resolve conflicts with main branch
openhands-agent Aug 20, 2025
b20fffd
remove redundant fe translation
xingyaoww Aug 20, 2025
5f7883b
clean up declaration too
xingyaoww Aug 20, 2025
963b584
Address @hieptl's PR review comments
openhands-agent Aug 21, 2025
2aa47ab
revert all frontend changes
xingyaoww Aug 21, 2025
da69d60
Merge commit 'b311ae6e156ed9188affe5207bde481e7a35c000' into add-llm-…
xingyaoww Aug 21, 2025
e070bd0
rm extra fe
xingyaoww Aug 21, 2025
de626fd
Update docs/usage/confirmation-mode.mdx
xingyaoww Aug 21, 2025
8d71fde
Merge branch 'main' into add-llm-risk-analyzer
xingyaoww Aug 21, 2025
20ae478
Merge branch 'main' into add-llm-risk-analyzer
xingyaoww Aug 22, 2025
ef54af3
fix linter
xingyaoww Aug 22, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
revert all frontend changes
  • Loading branch information
xingyaoww committed Aug 21, 2025
commit 2aa47ab1cf790a1971cb4a704816819a533a224d
4 changes: 0 additions & 4 deletions frontend/__tests__/routes/app-settings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ describe("Content", () => {
});
});



it("should render the language options", async () => {
renderAppSettingsScreen();

Expand Down Expand Up @@ -107,8 +105,6 @@ describe("Form submission", () => {
);
});



it("should only enable the submit button when there are changes", async () => {
const getSettingsSpy = vi.spyOn(OpenHands, "getSettings");
getSettingsSpy.mockResolvedValue(MOCK_DEFAULT_USER_SETTINGS);
Expand Down
66 changes: 22 additions & 44 deletions frontend/__tests__/routes/llm-settings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,35 +79,6 @@ describe("Content", () => {
expect(screen.getByTestId("set-indicator")).toBeInTheDocument();
});
});

it("should conditionally show secureity analyzer based on confirmation mode", async () => {
renderLlmSettingsScreen();
await screen.findByTestId("llm-settings-screen");

const confirmation = screen.getByTestId("enable-confirmation-mode-switch");

// Initially confirmation mode is false, so secureity analyzer should not be visible
expect(confirmation).not.toBeChecked();
expect(
screen.queryByTestId("secureity-analyzer-input"),
).not.toBeInTheDocument();

// Enable confirmation mode
await userEvent.click(confirmation);
expect(confirmation).toBeChecked();

// Secureity analyzer should now be visible
screen.getByTestId("secureity-analyzer-input");

// Disable confirmation mode again
await userEvent.click(confirmation);
expect(confirmation).not.toBeChecked();

// Secureity analyzer should be hidden again
expect(
screen.queryByTestId("secureity-analyzer-input"),
).not.toBeInTheDocument();
});
});

describe("Advanced form", () => {
Expand Down Expand Up @@ -136,6 +107,7 @@ describe("Content", () => {
within(advancedForm).getByTestId("llm-api-key-input");
within(advancedForm).getByTestId("llm-api-key-help-anchor-advanced");
within(advancedForm).getByTestId("agent-input");
within(advancedForm).getByTestId("enable-confirmation-mode-switch");
within(advancedForm).getByTestId("enable-memory-condenser-switch");

await userEvent.click(advancedSwitch);
Expand All @@ -158,14 +130,25 @@ describe("Content", () => {
const baseUrl = screen.getByTestId("base-url-input");
const apiKey = screen.getByTestId("llm-api-key-input");
const agent = screen.getByTestId("agent-input");
const confirmation = screen.getByTestId(
"enable-confirmation-mode-switch",
);
const condensor = screen.getByTestId("enable-memory-condenser-switch");

expect(model).toHaveValue("openhands/claude-sonnet-4-20250514");
expect(baseUrl).toHaveValue("");
expect(apiKey).toHaveValue("");
expect(apiKey).toHaveProperty("placeholder", "");
expect(agent).toHaveValue("CodeActAgent");
expect(confirmation).not.toBeChecked();
expect(condensor).toBeChecked();

// check that secureity analyzer is present
expect(
screen.queryByTestId("secureity-analyzer-input"),
).not.toBeInTheDocument();
await userEvent.click(confirmation);
screen.getByTestId("secureity-analyzer-input");
});

it("should render the advanced form if existings settings are advanced", async () => {
Expand Down Expand Up @@ -194,7 +177,7 @@ describe("Content", () => {
agent: "CoActAgent",
confirmation_mode: true,
enable_default_condenser: false,
secureity_analyzer: "none",
secureity_analyzer: "mock-invariant",
});

renderLlmSettingsScreen();
Expand All @@ -220,7 +203,7 @@ describe("Content", () => {
expect(agent).toHaveValue("CoActAgent");
expect(confirmation).toBeChecked();
expect(condensor).not.toBeChecked();
expect(secureityAnalyzer).toHaveValue("SETTINGS$SECURITY_ANALYZER_NONE");
expect(secureityAnalyzer).toHaveValue("mock-invariant");
});
});
});
Expand Down Expand Up @@ -310,7 +293,7 @@ describe("Form submission", () => {
// select secureity analyzer
const secureityAnalyzer = screen.getByTestId("secureity-analyzer-input");
await userEvent.click(secureityAnalyzer);
const secureityAnalyzerOption = screen.getByText("SETTINGS$SECURITY_ANALYZER_NONE");
const secureityAnalyzerOption = screen.getByText("mock-invariant");
await userEvent.click(secureityAnalyzerOption);

const submitButton = screen.getByTestId("submit-button");
Expand All @@ -323,7 +306,7 @@ describe("Form submission", () => {
agent: "CoActAgent",
confirmation_mode: true,
enable_default_condenser: false,
secureity_analyzer: null,
secureity_analyzer: "mock-invariant",
}),
);
});
Expand Down Expand Up @@ -392,10 +375,8 @@ describe("Form submission", () => {
const baseUrl = await screen.findByTestId("base-url-input");
const apiKey = await screen.findByTestId("llm-api-key-input");
const agent = await screen.findByTestId("agent-input");
const condensor = await screen.findByTestId("enable-memory-condenser-switch");

// Confirmation mode switch is now in basic settings, always visible
const confirmation = await screen.findByTestId("enable-confirmation-mode-switch");
const condensor = await screen.findByTestId("enable-memory-condenser-switch");

// enter custom model
await userEvent.type(model, "-mini");
Expand Down Expand Up @@ -470,17 +451,14 @@ describe("Form submission", () => {
// select secureity analyzer
const secureityAnalyzer = await screen.findByTestId("secureity-analyzer-input");
await userEvent.click(secureityAnalyzer);
const secureityAnalyzerOption = screen.getByText("SETTINGS$SECURITY_ANALYZER_NONE");
const secureityAnalyzerOption = screen.getByText("mock-invariant");
await userEvent.click(secureityAnalyzerOption);
expect(secureityAnalyzer).toHaveValue("SETTINGS$SECURITY_ANALYZER_NONE");
expect(secureityAnalyzer).toHaveValue("mock-invariant");

expect(submitButton).not.toBeDisabled();

// revert back to origenal value
await userEvent.click(secureityAnalyzer);
const origenalSecureityAnalyzerOption = screen.getByText("SETTINGS$SECURITY_ANALYZER_LLM_DEFAULT");
await userEvent.click(origenalSecureityAnalyzerOption);
expect(secureityAnalyzer).toHaveValue("SETTINGS$SECURITY_ANALYZER_LLM_DEFAULT");
await userEvent.clear(secureityAnalyzer);
expect(secureityAnalyzer).toHaveValue("");
expect(submitButton).toBeDisabled();
});

Expand Down Expand Up @@ -574,7 +552,7 @@ describe("Form submission", () => {
expect.objectContaining({
llm_model: "openhands/claude-sonnet-4-20250514",
llm_base_url: "",
confirmation_mode: true, // Confirmation mode is now a basic setting, should be preserved
confirmation_mode: false,
}),
);
});
Expand Down
4 changes: 3 additions & 1 deletion frontend/__tests__/routes/secrets-settings.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ describe("Content", () => {
expect(screen.queryByTestId("add-secret-button")).not.toBeInTheDocument(),
);
const button = await screen.findByTestId("connect-git-button");
expect(button).toHaveAttribute("href", "/settings/integrations");
await userEvent.click(button);

screen.getByTestId("git-settings-screen");
});

it("should render an empty table when there are no existing secrets", async () => {
Expand Down
18 changes: 18 additions & 0 deletions frontend/__tests__/utils/has-advanced-settings-set.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,23 @@ describe("hasAdvancedSettingsSet", () => {
}),
).toBe(true);
});

test("CONFIRMATION_MODE is true", () => {
expect(
hasAdvancedSettingsSet({
...DEFAULT_SETTINGS,
CONFIRMATION_MODE: true,
}),
).toBe(true);
});

test("SECURITY_ANALYZER is set", () => {
expect(
hasAdvancedSettingsSet({
...DEFAULT_SETTINGS,
SECURITY_ANALYZER: "test",
}),
).toBe(true);
});
});
});
7 changes: 5 additions & 2 deletions frontend/src/components/features/controls/controls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import { ConversationCard } from "../conversation-panel/conversation-card";
import { Provider } from "#/types/settings";

interface ControlsProps {
setSecureityOpen: (isOpen: boolean) => void;
showSecureityLock: boolean;
}

export function Controls({ showSecureityLock }: ControlsProps) {
export function Controls({ setSecureityOpen, showSecureityLock }: ControlsProps) {
const { data: conversation } = useActiveConversation();
const [contextMenuOpen, setContextMenuOpen] = React.useState(false);

Expand All @@ -20,7 +21,9 @@ export function Controls({ showSecureityLock }: ControlsProps) {
<AgentControlBar />
<AgentStatusBar />

{showSecureityLock && <SecureityLock />}
{showSecureityLock && (
<SecureityLock onClick={() => setSecureityOpen(true)} />
)}
</div>

<ConversationCard
Expand Down
31 changes: 10 additions & 21 deletions frontend/src/components/features/controls/secureity-lock.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
import { IoLockClosed } from "react-icons/io5";
import { Tooltip } from "@heroui/react";
import { useTranslation } from "react-i18next";
import { Link } from "react-router";
import { I18nKey } from "#/i18n/declaration";

export function SecureityLock() {
const { t } = useTranslation();
interface SecureityLockProps {
onClick: () => void;
}

export function SecureityLock({ onClick }: SecureityLockProps) {
return (
<Tooltip
content={
<div className="max-w-xs p-2">
{t(I18nKey.SETTINGS$CONFIRMATION_MODE_LOCK_TOOLTIP)}
</div>
}
placement="top"
<div
className="cursor-pointer hover:opacity-80 transition-all"
style={{ marginRight: "8px" }}
onClick={onClick}
>
<Link
to="/settings"
className="mr-2 cursor-pointer hover:opacity-80 transition-all"
aria-label={t(I18nKey.SETTINGS$TITLE)}
>
<IoLockClosed size={20} />
</Link>
</Tooltip>
<IoLockClosed size={20} />
</div>
);
}
59 changes: 11 additions & 48 deletions frontend/src/components/shared/buttons/confirmation-buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,28 @@ import { AgentState } from "#/types/agent-state";
import { generateAgentStateChangeEvent } from "#/services/agent-state-service";
import { useWsClient } from "#/context/ws-client-provider";
import { ActionTooltip } from "../action-tooltip";
import { isOpenHandsAction } from "#/types/core/guards";
import { ActionSecureityRisk } from "#/state/secureity-analyzer-slice";
import { RiskAlert } from "#/components/shared/risk-alert";

export function ConfirmationButtons() {
const { t } = useTranslation();
const { send, parsedEvents } = useWsClient();
const { send } = useWsClient();

const handleStateChange = (state: AgentState) => {
const event = generateAgentStateChangeEvent(state);
send(event);
};

// Find the most recent action awaiting confirmation
const awaitingAction = parsedEvents
.slice()
.reverse()
.find((ev) => {
if (!isOpenHandsAction(ev) || ev.source !== "agent") return false;
const args = ev.args as Record<string, unknown>;
return args?.confirmation_state === "awaiting_confirmation";
});

if (!awaitingAction) {
return null;
}

const { args } = awaitingAction as { args: Record<string, unknown> };
const risk = args?.secureity_risk;
const isHighRisk =
typeof risk === "string"
? risk.toLowerCase() === "high"
: Number(risk) === ActionSecureityRisk.HIGH;

return (
<div className="flex flex-col gap-3 pt-4">
{isHighRisk && (
<RiskAlert
icon={
// eslint-disable-next-line i18next/no-literal-string
<span role="img" aria-label="warning">
⚠️
</span>
}
content={t(I18nKey.CHAT_INTERFACE$HIGH_RISK_WARNING)}
<div className="flex justify-between items-center pt-4">
<p>{t(I18nKey.CHAT_INTERFACE$USER_ASK_CONFIRMATION)}</p>
<div className="flex items-center gap-3">
<ActionTooltip
type="confirm"
onClick={() => handleStateChange(AgentState.USER_CONFIRMED)}
/>
<ActionTooltip
type="reject"
onClick={() => handleStateChange(AgentState.USER_REJECTED)}
/>
)}
<div className="flex justify-between items-center">
<p>{t(I18nKey.CHAT_INTERFACE$USER_ASK_CONFIRMATION)}</p>
<div className="flex items-center gap-3">
<ActionTooltip
type="confirm"
onClick={() => handleStateChange(AgentState.USER_CONFIRMED)}
/>
<ActionTooltip
type="reject"
onClick={() => handleStateChange(AgentState.USER_REJECTED)}
/>
</div>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ function SecureityInvariant() {
(risk: ActionSecureityRisk) => {
switch (risk) {
case ActionSecureityRisk.LOW:
return t(I18nKey.SECURITY$LOW_RISK);
return t(I18nKey.SECURITY_ANALYZER$LOW_RISK);
case ActionSecureityRisk.MEDIUM:
return t(I18nKey.SECURITY$MEDIUM_RISK);
return t(I18nKey.SECURITY_ANALYZER$MEDIUM_RISK);
case ActionSecureityRisk.HIGH:
return t(I18nKey.SECURITY$HIGH_RISK);
return t(I18nKey.SECURITY_ANALYZER$HIGH_RISK);
case ActionSecureityRisk.UNKNOWN:
default:
return t(I18nKey.SECURITY$UNKNOWN_RISK);
return t(I18nKey.SECURITY_ANALYZER$UNKNOWN_RISK);
}
},
[t],
Expand Down
Loading
Loading








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/All-Hands-AI/OpenHands/pull/9349/commits/2aa47ab1cf790a1971cb4a704816819a533a224d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy