Repository navigation
Conversation
The UBUNTU_APP_SETUP template used by agent.switch_applications() references window_id without initializing it. When difflib.get_close_matches finds no match (app not open, no window with a similar title), exec() raises NameError: name 'window_id' is not defined — which kills the whole agent process mid-task because cli_app's exec has no try/except. This makes the failure non-fatal: initialize window_id=None and only run the wmctrl activate/maximize calls when a match was found. The agent sees an unchanged screen and can adapt (e.g. open the app another way or report it is missing). Reproduced E2E: task 'switch to Calculator' with Calculator not open → NameError at step 1, process dead (logs: NameError traceback). With the guard → agent continues, reports the app is not open, and completes the task with an honest failure report.
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.
Problem
The
UBUNTU_APP_SETUPtemplate used byagent.switch_applications()referenceswindow_idwithout initializing it. Whendifflib.get_close_matchesfinds no match (target app not open, or no window with a similar title),exec()raises:Because
cli_app.run_agent()executes the generated code with no error handling, a single missing-window switch kills the entire agent process mid-task.Solution
Initialize
window_id = Nonebefore the match loop and guard the twowmctrlcalls withif window_id:. When no window matches, the action becomes a no-op instead of a crash — the agent sees an unchanged screen on the next step and can adapt (open the app another way, or honestly report it is not open).Testing
grounding.pywith an app name matching no window →NameErrorkills the process (reproducible).