Skip to content

Merge dev: stoppable MCP calls, lazy start-up tabs, media retirement ownership - #552

Merged
JE-Chen merged 163 commits into
mainfrom
dev
Nov 17, 2026
Merged

JE-Chen merged 163 commits into
mainfrom
dev

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Nov 12, 2026

Copy link
Copy Markdown
Member

Why

dev is 58 commits ahead of main (2026-11-10 to 2026-11-12). This PR brings them to main and runs the checks that only run on pull requests into main, in particular the macos-capabilities job of platform-smoke.yml. That job has not yet confirmed that macos-15 grants the same TCC permissions test/verify/macos_verify.py expects (Progress.md › "macos-15 上的 TCC 權限還沒被 gate 驗過"). If it reports different grants, re-measure with --measure and update EXPECTED and docs/CAPABILITY_MATRIX.md rather than loosening the gate.

Changes

MCP

  • Every tools/call runs as a stoppable executor run (mcp-…). notifications/cancelled stops an ac_execute_actions list before its next action and wakes ac_wait_for_image / ac_wait_for_pixel mid-poll; ac_stop_execution ends MCP calls too.
  • The tools/call path moved out of server.py (745 → 627 lines) into _tool_calls.py; MCP adapters were split into strict domain modules.
  • Reviewed MCP capabilities are enforced through refreshed invocation.

GUI

  • Only the first of the three start-up tabs is built at start; Script Builder and Remote Desktop are built when first selected. Offscreen start-up: 3.2 s → 1.7 s, 172 MB → 111 MB.
  • Report, Screenshot and Image Detection got their own lifecycles and background tasks; GUI task cancellation reaches headless operations; focus waits honour executor stop.
  • Remote pages release without retaining callback owners; WebRTC statistics start and stop without waiting on the GUI thread.

Remote desktop / WebRTC

  • Peers retain media constructor and teardown failures, session retirement binds to the original peer and source, LAN browser cleanup and file senders keep their owners until the work actually finishes.

Security

  • REST host-data reads (operational records, USB enumeration, inspector statistics, process metrics) and the matching executor reads require read_data.

Executor and mobile

  • The result hook follows AC_parallel branches, so the Script Builder offers a branch's token as its own value.
  • iOS swipes no longer press before moving; an Android pinch past the screen edge raises DeviceError. Both were found by reading the uiautomator2 3.7.1 and facebook-wda 1.5.4 sources.
  • Reading the iOS pasteboard needs allow_app_switch=True, because facebook-wda switches to WebDriverAgent through Siri to read it.

Platform

  • Default Wayland EI input runs behind an owned worker; Linux presence endpoints bind through private helpers.
  • Bounded internal Windows process-memory observations behind reviewed identity attestation (internal only, no public entry point).
  • Config-sync asset sync refuses, with a clear error, paths Windows cannot create without LongPathsEnabled.

Docs and records

  • Progress.md reconciled with the tree: finished, stale and superseded items removed and recorded in docs/updates/2026-11-b.md (U-20261111-*, U-20261112-01 to -14).

Compatibility

See CHANGELOG.md › Unreleased. The ones a caller may notice:

  • A stopped MCP call is answered as a tool error (ExecutionStopped), a cancelled one with -32800; ac_list_executions lists MCP calls in progress.
  • Code that expected the Script Builder and Remote Desktop widgets to exist right after AutoControlGUIWidget() gets them on first access.
  • iOS swipe ignores duration_s; AC_ios_get_clipboard needs allow_app_switch=True.
  • REST and executor reads listed above refuse viewers without read_data.

Testing

  • AutoControl Dev CI on dev head 65116dbc: all four pytest-headless squares (Windows 3.11 / 3.14, Ubuntu 3.14, macOS 3.11) passed.
  • Locally on Windows (Python 3.14.7): full headless suite 18,507 passed, 193 skipped, 2 failed in test_agent_transfer_payloads.py, which fail the same way on the commit before these changes and pass in CI.
  • Typing contract on win32 / linux / darwin and strict Sphinx clean.

On merge

pyproject.toml on main declares 1.2.1, which is tagged, so scripts/stable_release.py releases 1.2.2.

A resolver saw only the process identity, so it could not find a module
base that moves between launches or check that reported locations belong
to the process being read. Its reads now go through the reader's checked,
budgeted path, the main image is measured from the retained handle, and a
failure from the reader's own checks cannot be swallowed into a plan.
…lenge

The fixture reported its buffer locations as self-reports that nothing tied
to the process the reader holds. The parent now passes a challenge at
launch, the fixture writes it into its own header beside its locations,
and the reviewed resolver returns a plan only when that header reads back
through the retained handle and matches the bootstrap.
WindowsProcessProvider needs an attestor and had none, so no probe could
be used for real. The host now leases the image read-only, checks its
SHA-256 against the pin before starting it, and confirms the child it
started maps that same leased file before naming the process.
Reopening the child by PID could land on another process that reused the
number. The launcher now reads PID and birth from the handle CreateProcess
returned, and refuses a second launch so the child it reports is unambiguous.
…ta stub

PySide6 6.12 still types QImage.fromData's format as bytes while the binding
rejects bytes; loadFromData's stub and binding agree on str, so one typed
helper replaces five type-ignores.
…base

The READ_ONLY diagnosis opened the default log through AuditLog, which made
~/.je_auto_control/audit.db, its schema and the one-off chain backfill on a
machine that had none.
run_captured waited in one communicate(timeout), so a stop, ac_stop_execution
or notifications/cancelled reached AC_shell_to_var and ac_shell only after the
program or its timeout ended.
close() joins the reader threads within 0.25 s while the watch thread could
still be parked in a probe for its own 0.25 s deadline; a slow macOS runner
failed the teardown of the PR #552 run on that race.
Bandit flags the AC_lease_secret / AC_secret_* review notes as passwords;
they are command names. The script-runs test posted to the GUI thread with
QTimer.singleShot from a plain worker thread, the likeliest cause of an
abort on Windows 3.14, so it emits a GUI-thread signal like the tabs do.
The presence source test now retries a check that missed the 0.25 s request
cap, as lease() already does.
Windows 3.14 aborts inside test_gui_script_runs with only 'Fatal Python
error: Aborted': no minidump for a handled abort(), and Qt's reason went to
the stderr pytest's fd capture held. The diagnostics runner now names its
artifact folder to the child, and the headless conftest records Qt's
messages there, so the next abort says why. The earlier singleShot change
did not stop it; the open cause is tracked in Progress.md.
The owned source's evidence cache nests two hash directories and a temp
file; under 'independent-source' the path reached 263 characters and the
child failed where long paths are off. CI was unaffected.
A minidump of the Windows 3.14 abort showed PySide's deferred deletion
(runDeletionInMainThread) destroying a leaked top-level QWidget that a
worker thread's GC had collected, and QObject::~QObject aborting. The
headless conftest now collects on the main thread at each module start, and
the script-runs module collects and deletes its widgets per test. A full
CI-order local run that aborted 3 of 3 times now passes; the GUI-side risk
is left as a decision in Progress.md.
Windows 3.12 aborted in test_gui_offthread_sites with the same deferred-
deletion signature: the garbage came from that module's own earlier tests,
which the per-module collection cannot reach. PySide6 6.12 stays, as the
maintainer decided; the GUI-side risk is tracked in Progress.md.
Collecting after each test cost about 0.4 s a test on CI across ~5,800
tests, doubled the suite time and pushed a Windows job past its 120-minute
limit. With automatic collection paused inside the 379 modules that import
Qt or the GUI package, no worker thread can start a collection at all; the
module's garbage is collected once, on the main thread, at its end.
The report is for the maintainer to file; it keeps the native stack, the
destroyed widget's QObjectData state, what did not reproduce it and the
workaround in the repository rather than in a session log.
PySide6 6.12 defers the delete of a Qt object a worker thread's collection
reaches, and one such deferred delete aborted the process on Windows. The
GUI now switches automatic collection off and collects from a GUI-thread
timer at the interpreter's thresholds, giving it back on quit; library use
without the GUI is unchanged.
perform_call checked only the cancellation scope, and only before sending
and after the reply, so a stopped script still sent its request and a stop
waited out the reply or the 30-second timeout. Inside a run or scope the
request now runs on a helper thread whose sockets a stop shuts, and the
run's stop token is checked too; outside a run nothing changes.
The maintainer confirmed the rule chosen during implementation: client-
reported roots count only with JE_AUTOCONTROL_MCP_PATH_ROOTS_FROM_CLIENT,
since any HTTP caller can report them.
A stopped request that was still connecting waited out its timeout. The
recorded connections now open their socket with a non-blocking connect
polled every 0.1 s against the stop; only a name lookup in progress still
runs on.
One matchTemplate or OCR pass is a single native call a stop could not
reach. Inside a stoppable run or cancellation scope it now runs on a helper
thread through run_control.stoppable_call, so a stop ends the call within
0.1 s; the pass itself finishes in the background and is discarded.
M0 asked for the profile, its result types and a routing rule forbidding
desktop input as reviewable data. Routes name a closed set of background
channels, a pending or unknown operation is unsupported, and the Windows
profile is the contract's capability matrix, kept in step by a test.
The service's maintain() loop cancels a task once its owner loses the role,
which raced act()'s own authority check and failed Windows 3.13 with
CancelledError. The test holds the loop off so act()'s refusal is the one
under test.
The other match paths (visual, colour, edge, rotated, self-healing frame
and device-frame matching) still made a stop wait for a native
matchTemplate pass. A structural test now fails on any direct call, so a
new matcher cannot bring the wait back.
stop() and wait_idle() called from a command handler waited out their
timeout: the handler holds the turn the worker needs for its reply. They now
ask and return False at once. A test also shows a stop does not wait for a
blocked name lookup and nothing is sent after it, so Progress.md no longer
lists that as a gap.
The maintainer chose to keep the repository's own fixture as the first
target and pick a real application only after M1's native acceptance runs.
The maintainer chose a rollback branch at the pre-deployment commit so dev
keeps its history; the helper, Chromium, profile and multi-host items still
need the production machine's details.
Windows 3.12 failed a presence test at an inspect that only waits for the
observer to drain; like check, it shares the request cap and changes
nothing, so a missed deadline is retried.
@sonarqubecloud

Copy link
Copy Markdown

@JE-Chen
JE-Chen merged commit a798b4e into main Nov 17, 2026
41 checks passed
JE-Chen added a commit that referenced this pull request Nov 17, 2026
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