Add lock_session: lock the workstation and wait for unlock#433
Merged
Conversation
session_guard could only detect a locked session and raise; this adds acting on the lock state — lock the box at the end of an unattended run, block until a human unlocks it before resuming, and reduce a lock-state sample stream to lock/unlock events. The lock action runs through an injectable driver and the waits reuse session_guard's real probe with injectable clock/sleep, so all logic is unit-tested without the OS.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 50 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
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
Fifth feature of the ROUND-15 cross-app OS lane.
session_guardcould only detect a locked session and raise; this adds acting on the lock state.utils/lock_session/:lock_session(lock now —LockWorkStation/loginctl lock-session/CGSession -suspend, injectabledriver),plan_lock_session(pure per-OS planner),wait_for_unlock/wait_for_lock(pollsession_guard.is_session_lockeduntil the state flips or timeout; injectableclock/sleep/probe),classify_lock_transitions(pure: lock-state samples →{event, locked}events).wait_for_unlockreusessession_guard's real WindowsOpenInputDesktopprobe — the blocking companion toensure_interactive_session.__all__;AC_lock_session/AC_plan_lock_session/AC_wait_for_unlock/AC_classify_lock_transitionsexecutor commands; matchingac_*MCP tools (ac_lock_sessiondestructive, rest read-only); Script Builder under Shell.v207_features_doc.rst+WHATS_NEW.md.Test
test/unit_test/headless/test_lock_session_batch.py— lock via fake driver, plan shape, wait-for-unlock/lock with injected probe+clock+sleep (returns + timeout), pure classifier, JSON-list executor coercion, plus facade + executor/MCP/builder wiring membership. All 13 green;ruff+banditclean; package stays Qt-free.