LOCAL DISPATCH EXERCISE — portable source, revision 2026-10-17-r4

Read README-portability.txt before starting. This is a small single-owner,
single-project loopback teaching implementation. It creates its own new Codex
App Server session; it does not control existing desktop chats or include a
private desktop IPC adapter. App Server is documented but experimental.

Python standard library only, Python 3.9 or later. Run from this folder.
macOS/native Linux: use python3. Native Windows: use py -3 if that is your installed Python
launcher. WSL2: use python3 and Linux Codex/auth inside that WSL distribution.
Child Python processes always use sys.executable; no shell command strings.

Prepare without a model call:
  python3 run.py portability-test
  python3 run.py test
  python3 run.py preflight

Native Windows equivalents:
  py -3 run.py portability-test
  py -3 run.py test
  py -3 run.py preflight

The first two commands run local protocol/fault tests. The protocol fixture
cannot run a model turn. Preflight invokes only --version and schema generation;
it does not invoke inference or prove account/model access. Current contract:
Codex CLI 0.154.0 plus five exact canonical JSON schema fingerprints.

Optional config: copy config.example.json to config.json using your editor.
Do not put credentials in it. null codexExecutable means native PATH discovery.
If discovery fails, set codexExecutable to the resolved absolute native file.
Windows requires codex.exe; .cmd/.bat/.ps1 shims are deliberately rejected.
No automatic install, update, key copying, security changes or account creation.
--config accepts an explicit local config file; unknown keys are rejected.

Gateway UI only, without a worker or model:
  python3 run.py start --port 8765
  python3 run.py status
  python3 run.py stop

Open http://127.0.0.1:8765. Read your synthetic owner credential locally from
state/manual/credentials.json; never paste it into a shared chat/report or Git.
Start is gateway-only: queued UI jobs are not executed. Stop authenticates the
specific instance and asks it to stop itself; it never signals a saved PID.

Only after the owner explicitly authorizes ONE real model request:
  python3 run.py real-control --authorized
Use py -3 instead of python3 for native Windows. This command creates separate
real-control state, starts gateway/worker/App Server, sends exactly:
  Ответь ровно LOCAL-DISPATCH-OK. Не используй инструменты
It retains the user's model default, existing official login, global rules,
read-only/never and an ephemeral thread. It waits for matching agentMessage
and turn/completed, delivers the result through gateway, verifies the exact
control output separately, then stops its processes. A permanent consumed
marker forbids another call. Do not remove the marker/journal to retry an
uncertain operation. An explicit CLI flag is not a substitute for permission.

A previously used copy may already have that marker; only inspect its saved
result. This downloadable source does not contain state, credentials, prior
real IDs, personal paths, logs or private evidence. New local results appear
under work/; credentials and journals appear under state/. Keep both private.

Actual verification scope of the portable revision is in portability-report.json.
The earlier Mac E2E passed before these portability changes. This revision ran
Mac regression/contract tests and simulated Windows branches, with ZERO new
model turns. Native Windows, native Linux, WSL runtime, remote deployment and a new real E2E
on this revision remain unverified. Do not call this production-ready.
