Skip to content

Add lock_session: lock the workstation and wait for unlock#433

Merged
JE-Chen merged 1 commit into
devfrom
feat/lock-session-batch
Jun 25, 2026
Merged

Add lock_session: lock the workstation and wait for unlock#433
JE-Chen merged 1 commit into
devfrom
feat/lock-session-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

Fifth feature of the ROUND-15 cross-app OS lane. session_guard could only detect a locked session and raise; this adds acting on the lock state.

  • Headless core utils/lock_session/: lock_session (lock now — LockWorkStation / loginctl lock-session / CGSession -suspend, injectable driver), plan_lock_session (pure per-OS planner), wait_for_unlock / wait_for_lock (poll session_guard.is_session_locked until the state flips or timeout; injectable clock/sleep/probe), classify_lock_transitions (pure: lock-state samples → {event, locked} events).
  • wait_for_unlock reuses session_guard's real Windows OpenInputDesktop probe — the blocking companion to ensure_interactive_session.
  • 5 layers wired: facade __all__; AC_lock_session / AC_plan_lock_session / AC_wait_for_unlock / AC_classify_lock_transitions executor commands; matching ac_* MCP tools (ac_lock_session destructive, rest read-only); Script Builder under Shell.
  • Docs: EN + Zh 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 + bandit clean; package stays Qt-free.

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.
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 50 complexity · 0 duplication

Metric Results
Complexity 50
Duplication 0

View in Codacy

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.

@JE-Chen JE-Chen merged commit 7f5fd42 into dev Jun 25, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/lock-session-batch branch June 25, 2026 21:07
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant