Ghost monitor protocol update - #253
Conversation
Co-authored-by: djamesr23 <djamesr23@gmail.com>
|
Cursor Agent can help with this pull request. Just |
📊 PR Size AnalysisSize: Review Checklist
|
🚨 CI/CD Failure DetectedThe PR Automation & Validation workflow failed for this PR. Action RequiredA tracking PR has been automatically created to help resolve this issue: Quick LinksPlease review the analysis and implement the suggested fixes. 🤖 Auto-generated by JARVIS CI/CD Manager |
🚨 CI/CD Failure DetectedThe Environment Variable Validation workflow failed for this PR. Action RequiredA tracking PR has been automatically created to help resolve this issue: Quick LinksPlease review the analysis and implement the suggested fixes. 🤖 Auto-generated by JARVIS CI/CD Manager |
🚨 CI/CD Failure DetectedThe Database Connection Validation workflow failed for this PR. Action RequiredA tracking PR has been automatically created to help resolve this issue: Quick LinksPlease review the analysis and implement the suggested fixes. 🤖 Auto-generated by JARVIS CI/CD Manager |
🚨 CI/CD Failure DetectedThe Validate Configuration workflow failed for this PR. Action RequiredA tracking PR has been automatically created to help resolve this issue: Quick LinksPlease review the analysis and implement the suggested fixes. 🤖 Auto-generated by JARVIS CI/CD Manager |
| import logging | ||
| import os | ||
| import json | ||
| from typing import Dict, List, Optional, Tuple, Any |
Check notice
Code scanning / CodeQL
Unused import Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
In general, to fix an unused import, you either remove the unused name from the import line or delete the entire import statement if none of the imported names are used. Here, several types from typing are used (Dict, List, Tuple, and likely Optional elsewhere), but Any is not. The best minimal fix that preserves all existing behavior is to remove Any from the import list while leaving the rest of the line unchanged.
Concretely, in backend/neural_mesh/agents/yabai_window_manager.py, on the import line currently reading from typing import Dict, List, Optional, Tuple, Any, remove Any so that it becomes from typing import Dict, List, Optional, Tuple. No other code, imports, methods, or definitions are required.
| @@ -24,7 +24,7 @@ | ||
| import logging | ||
| import os | ||
| import json | ||
| from typing import Dict, List, Optional, Tuple, Any | ||
| from typing import Dict, List, Optional, Tuple | ||
| from dataclasses import dataclass | ||
|
|
||
| # Setup logging |
| return False, None | ||
| try: | ||
| return True, json.loads(output) | ||
| except: |
Check notice
Code scanning / CodeQL
Except block handles 'BaseException' Note
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 7 months ago
In general, to fix this issue you should avoid bare except: clauses and avoid catching BaseException unless there is a very strong, explicitly documented reason. Instead, catch Exception or more specific exception types that you expect from the protected block.
For this specific case in backend/neural_mesh/agents/yabai_window_manager.py, the risky block is:
try:
return True, json.loads(output)
except:
return False, Nonejson.loads primarily raises json.JSONDecodeError (a subclass of ValueError, which itself is a subclass of Exception), not KeyboardInterrupt or SystemExit. The safest change without altering intended behavior is to catch Exception instead of using a bare except. This preserves the function’s contract of returning (False, None) on any ordinary decoding error, while allowing KeyboardInterrupt and SystemExit to propagate.
No new imports or extra helper functions are needed, since Exception is built-in and we already import json. The change is localized to the except line around 161.
| @@ -158,6 +158,6 @@ | ||
| return False, None | ||
| try: | ||
| return True, json.loads(output) | ||
| except: | ||
| except Exception: | ||
| return False, None | ||
|
|
🤖 CI/CD Pipeline ResultsStatus: success Pipeline Stages
|
Summary
Implements the core "Exile" and "Boomerang" protocols of the patent-pending "Ghost Monitor Protocol" architecture, enabling isolated window management for the agent on Display 2 while ensuring seamless user experience.
Changes Made
backend/neural_mesh/agents/yabai_window_manager.pyto centralize window management logic.exile_windowmethod (Exile Protocol) to move windows to Display 2 (Shadow Realm) and maximize them.boomerang_windowmethod (Boomerang Protocol) to summon windows back to Display 1 and focus them.ensure_shadow_realmto verify the presence of Display 2._convergence_lockfor future "The Reaper" state convergence.Type of Change
Test Plan
Testing Steps:
yabaiis installed and configured.YabaiWindowManager().exile_window(window_id)with a valid window ID. Verify the window moves to Display 2 and maximizes.YabaiWindowManager().boomerang_window(window_id)with the same window ID. Verify the window returns to Display 1 and gains focus.Related Issues
Relates to the "SYSTEM UPDATE: PATENT-PENDING ARCHITECTURE" directive.
Screenshots (if applicable)
Deployment Notes
yabaibeing installed)Checklist
Additional Context
This PR establishes the foundational window management for the "Ghost Monitor Protocol". It strictly adheres to the "Single-Seat Concurrency" principle, ensuring JARVIS operations on Display 2 do not interrupt the human user. Display 2 is treated as a privileged, secure execution environment for the agent, with window movements orchestrated by the new
YabaiWindowManager.Reviewer Guidelines:
Summary by cubic
Adds a Yabai-based window manager to isolate agent windows on Display 2 and bring them back on demand, keeping the user’s workspace uninterrupted.
New Features
Dependencies
Written for commit cf147fb. Summary will update on new commits.