Documentation
¶
Overview ¶
Command fakecodex stands in for the codex CLI in tests. It records every message queued for a thread and answers thread lookups from a file, so tests can check delivery into Codex without running Codex. It speaks the protocol of codex-cli 0.159.3:
- `codex queue --thread <THREAD> --message <TEXT>` prints "Queued message … for thread …." and exits 0, or prints "Error: …" to standard error and exits 1.
- `codex app-server` reads one JSON message per line on standard input and writes one per line on standard output, without a "jsonrpc" field. Requests other than initialize fail with -32600 "Not initialized" until initialize succeeds, and the server sends notifications of its own in between responses.
- `thread/read` answers {"thread": Thread}. A sub-agent thread read from disk has "parentThreadId": null and "source": {"subAgent": {"thread_spawn": {...}}}. An id that isn't a UUID fails with -32600 "invalid thread id: …"; a thread that doesn't exist fails with -32600 "thread not loaded: <id>".
Environment:
FAKE_CODEX_LOG file that receives one JSON line {"thread","message"} per queue call
FAKE_CODEX_THREADS JSON file mapping thread id to {"parent": "<id>"} for sub-agent
threads, or {"missing": true} for threads that don't exist; a
thread missing from it is a root thread
FAKE_CODEX_QUEUE_FAIL when set, queue calls fail with exit status 1
Click to show internal directories.
Click to hide internal directories.