Give an existing Codex conversation new work when files actually change.
简体中文 · AI / contributor entry · Current status
Windows users can use the three-field setup window: choose a folder, condition and conversation, then preview and enable. G0–G3 are accepted within their stated scope: the verified installation, an explicitly opened and accurately bound dedicated chat, and the tested workload. The PR remains Draft; acceptance does not merge it or enable production.
Before this PR is merged, the form is on draft/three-field-setup-design; the default main clone below does not yet include it. Follow the candidate checkout steps in the usage guide.
A small, experimental Python service for workflows where incoming files should trigger a review or analysis in an existing conversation. The local program detects changes, waits for stable bytes, deduplicates content and freezes a batch before handing it to the selected chat adapter.
For example: a research agent writes a report, the report stops changing, and the project conversation receives its exact frozen version for review. No new content and no pending work means no model turn is requested.
This is a community project, unaffiliated with OpenAI. The file watcher can be tried locally; live Desktop integration depends on a verified installation and conversation owner. It is not a general-purpose automation platform or a supported public Desktop API.
- Watches files using
watchdog, with startup and periodic scans to catch missed events. - Uses a stability window and SHA-256 content hashes to avoid processing incomplete or duplicate bytes.
- Stores immutable input versions, batch manifests and delivery state in SQLite.
- Supports separate JSONL queue and experimental Windows Desktop IPC adapters.
- Provides a three-field Tk window. Ordinary notifications advance after the previous batch's exact terminal event and fresh target idle, without a business ACK.
- Tracks watcher health, execution outcomes and verified business delivery separately.
- Freezes output files in a durable upload outbox; an optional adapter uses an existing Drive Exchange Hub to recover uploads by a persistent remote ID.
An uncertain send stays uncertain until it can be reconciled. A finished model turn is not a delivery receipt. The system does not promise exactly-once execution.
Requires Python 3.10+ and watchdog==6.0.0. Linux/Python 3.12 was used for the latest cloud regression run; Windows-specific evidence is linked below.
git clone https://github.com/scarlet-devil/codex-condition-trigger.git
cd codex-condition-trigger
python3 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
cp example.linux.json local-test.json
.venv/bin/python -c 'import json; from pathlib import Path; p=Path("local-test.json"); c=json.loads(p.read_text()); c["settle_seconds"]=2; p.write_text(json.dumps(c, indent=2))'
mkdir -p /tmp/codex-trigger-demo/inbox /tmp/codex-trigger-demo/project
printf 'A report is ready for review.\n' > /tmp/codex-trigger-demo/inbox/report.txt
.venv/bin/python trigger.py --config local-test.json scan
.venv/bin/python trigger.py --config local-test.json statusAfter cloning the repository and entering its directory:
py -m venv .venv
.\.venv\Scripts\python.exe -m pip install -r requirements.txt
$demo = Join-Path $env:TEMP "codex-trigger-demo"
$config = Get-Content .\example.windows.json -Raw | ConvertFrom-Json
$config.input_dir = Join-Path $demo "inbox"
$config.state_dir = Join-Path $demo "state"
$config.expected_cwd = Join-Path $demo "project"
$config.settle_seconds = 2
$config | ConvertTo-Json -Depth 8 | Set-Content .\local-test.json -Encoding UTF8
New-Item -ItemType Directory -Force $config.input_dir, $config.expected_cwd
"A report is ready for review." | Set-Content (Join-Path $config.input_dir "report.txt") -Encoding UTF8
.\.venv\Scripts\python.exe .\trigger.py --config .\local-test.json scan
.\.venv\Scripts\python.exe .\trigger.py --config .\local-test.json statusA fresh demo produces batch_ready; status shows a ready batch. Repeat scan without changing the bytes: no second batch should appear. The all-zero thread UUID is a placeholder used only for this dry demo.
To keep watching, use run without --live. In another terminal, use stop to request a persistent pause:
# Windows: replace the Python executable with .\.venv\Scripts\python.exe.
.venv/bin/python trigger.py --config local-test.json run
# In another terminal:
.venv/bin/python trigger.py --config local-test.json stop
.venv/bin/python trigger.py --config local-test.json statusThe watcher exits on STOP; Ctrl+C also exits the current watcher. After an intentional demo pause, unpause clears STOP unless a bound trial has expired. Already accepted model work must be handled in its own host. Keep demo state separate from real work.
The three-field entry is simple_setup.py. First open the exact dedicated chat in Codex Desktop under the same Windows user, then follow the usage guide. Match the project and distinguishing ID as well as the title. Selecting a catalog row does not load its owner. Initial enablement requires a successful current connection and idle check. The window's enable action permits real tasks; it differs from the CLI dry demo above.
| Component | What you must supply |
|---|---|
| File input | Absolute input, state and project paths; input and state trees must not overlap. The default stability window is 120 seconds. |
| JSONL queue | A verified connection to the actual existing host. Starting a second app-server with the same UUID does not establish ownership. |
| Windows Desktop IPC | The exact thread, working directory, rollout path and verified installed Desktop build. Owner absence or ambiguity must be resolved before dispatch. |
| Native result collection | Explicit native_result_collection: true for the verified Desktop IPC setup. The default is off. |
| Upload recovery | An already installed, authorized Drive Exchange Hub with material-recovery support, a registered project/route and a configured delivery_command. This repository is not a standalone Drive client. |
Start with the integration guide, Desktop IPC details and native collection / upload design. Dated reports describe their original checkpoint; CURRENT_STATE.md gives the latest accepted scope.
Live commands can submit work or transfer files. run --live and dispatch are separate from the dry demo. delivery-resume only resumes frozen uploads: it neither reruns the model nor acknowledges business delivery. The optional Hub adapter accepts files up to 8 MiB; the generic outbox limit is 20 MiB.
| Area | Verified scope |
|---|---|
| Automatic triggering | Real Windows watcher trials dispatched two successive synthetic batches into the original conversation, with caller-verified results. |
| Three-field setup and ordinary notifications | G1/G2 implementation and simulation accepted; G3 completed two real batches in the opened, exact dedicated chat. B waited while A ran; each was sent once and produced the expected output. See the limited acceptance. |
| Login recovery | A real Windows login started an isolated dry watcher, produced a ready batch and stopped within its deadline. |
| Native outcomes | Implemented and reviewed; a loaded chat was read through real IPC. The original production target's full business workflow remains unverified. |
| Upload recovery | A real Drive canary recovered after the client discarded its receipt, using the same remote ID and byte readback. |
| Historical baseline regression (2026-10-20) | 185 tests: 184 passed, 1 Windows-only test skipped on cloud Linux, including the three optional outbox-to-Hub tests. See the validation record. Current three-field evidence and attribution are in section 18; overlapping checks are not added together. |
These are separate experiments, not a single proof of unattended operation. Hub startup after reboot and the original target's complete business workflow remain follow-up work.
Window loading is off by default. The current Windows UI backend requires an explicitly supervised, no-navigation interval of at most 600 seconds; arbitrary-navigation unattended window cleanup is not validated. No model, permission or sandbox overrides are sent by the chat adapter. A merge does not activate an old trial or clear its STOP/deadline.
Other limits: local file conditions and a three-field GUI, without a webhook service or general rule language; Drive-folder ingestion is not implemented. Byte deduplication is not semantic deduplication; historical blobs have no automatic retention policy. A READY marker requires the producer to remove the old marker before writing and recreate it last. The setup window does not automatically load an absent chat or register startup/scheduled tasks.
python -m pip install -r requirements.txt
python -m unittest discover -s tests -vUse your virtual environment's Python. Some platform or optional Hub tests skip when their requirements are absent; always report the actual skip reasons. The 184-pass result above used the frozen Hub candidate on PYTHONPATH, not just a fresh clone. See AGENTS.md for the exact reproduction and code map.
For a bug report, include the commit, OS/Python version, adapter, sanitized configuration, reproduction steps and expected/actual result. Keep private conversation data and credentials out of public issues.
The design draws on OpenAI Codex queue semantics, Codex Triggers' separation of detection and delivery, and CodexAgentControl's documented IPC protocol. The actual file-watching dependency is watchdog. See design references, pinned sources and third-party notices.
This repository does not yet contain a project LICENSE. The MIT text in THIRD_PARTY_NOTICES.md belongs to the referenced third-party project; it is not this project's license.