Authenticated exact-thread wake-up API for Codex Desktop threads
Use case
We run Synloq, an open-source multi-agent relay (https://github.com/OBenner/synloq): agent roles live as Codex Desktop threads, bound per-role via project-scope .codex/config.toml. Inter-role messages arrive at a local relay while the target thread is idle.
There is no supported way to deliver a wake signal into an existing visible Desktop thread:
codex queue --thread <uuid> --resumetargets the local daemon/CLI surface; its ownership of Desktop-owned threads is undocumented, and a failed resume can still exit zero, so success is not observable.- The app-server protocol offers
thread/inject_items(history insertion without starting a turn) — not a wake-up.
Requested API surface (minimal)
An authenticated call that, given an exact thread UUID (as shown/owned by Codex Desktop), queues a message into that existing visible thread and reports an explicit outcome: admitted / queued-while-busy / executed / failed-with-reason.
Busy queuing and reconnect semantics at parity with user-typed input would be ideal; a documented "Desktop threads are not addressable" answer is an acceptable fallback signal.
Expected behavior / fallback
The target thread starts a turn with the queued content (or a deterministic busy-queued state), without operator interaction and without spawning a replacement chat. No steering of an active turn is requested — admission only.
What it unblocks
Reactive roles on Codex Desktop: today stored messages sit until the operator manually opens and pings each chat (we observe 30+ minute latencies in our stand). With exact-thread wake, Codex Desktop reaches delivery parity with hosts that expose a prompt API.
We can contribute conformance evidence (timelines, thread ids, admission traces) from our test stand.
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
- #61734
Powered by Codex Action
A source-side distinction that may help make the requested contract testable: the app-server protocol explicitly defines thread/inject_items as appending raw Responses API items without starting a user turn. The separate turn/start request is serialized by thread ID. Neither protocol entry by itself proves that an external client is authorized to address a Desktop-owned, visible thread, nor that Desktop will render and continue a turn started by another connection/process.
There is also an ownership/reconnection edge worth including in conformance: the existing WebSocket disconnect test verifies that a second connection can inject items after the previous connection disconnects and releases the thread. That demonstrates server-side connection release, not caller authentication or Desktop message delivery.
Suggested minimum negative/positive controls for an eventual supported wake endpoint: exact Desktop thread identity (never silently fork or create another chat); unauthorized caller / wrong account / unknown UUID fails without mutating history; idle admission starts exactly one user turn; busy admission reports queue-vs-reject deterministically without steering the active turn; disconnect/reconnect and same-operation replay cannot create duplicate turns; and separate observables distinguish accepted by API, turn started, visible in the owning Desktop conversation, and turn completed. A successful thread/inject_items response should not be counted as successful wake-up. This is a protocol/test proposal based on public source, not a claim that the current Desktop integration supports external wake-up.
Follow-up on the observability side of the requested contract, from the perspective of a CLI user who wants to build a wake-up watcher on top of codex queue (0.169.0-alpha.11.1, Desktop-owned visible thread as the target):
-
codex queueexposes no read verb over the turn lifecycle. Its stdout carries no turnId, so an external process cannot correlate a queued message with the turn it eventually produces. The strongest assertion available from outside is "queue accepted" — exit code 0, plus queue/thread identity in the output. Whether the turn was started, is visible in the Desktop conversation, or has completed cannot be observed programmatically. -
There is no confirmed Desktop-owned control endpoint for read-only observation. The default app-server control socket (
~/.codex/app-server-control/app-server-control.sock) refuses connections (connect 10061) while Codex Desktop is running, so the app-server appears to be CLI-daemon territory rather than Desktop's. The agent tools that can read thread state (read_thread,wait_threads) are exposed as agent-facing tools inside a Desktop session — not as a Node/CLI API surface. -
Ask: please provide either (a) a documented, read-only way to observe turn lifecycle from an external process for a thread (accepted → started → visible → completed, correlated by a stable id), or (b) a confirmed Desktop control endpoint with read-only methods. Without one of these, any third-party wake-up automation remains partially blind: it can assert admission, but never outcome — and exit-code-only feedback was explicitly flagged above as insufficient wake-up evidence.
Not requesting steering or write access — read-only observation is enough for a watcher to stop/resume delivery loops.
The reporter and the existing protocol analysis already establish that queue admission, turn start, Desktop visibility, and completion are different events. There is a further design premise for a reactive multi-agent wake API that is not solved merely by authenticating the caller or returning a turnId:
Knowing exactly which Desktop thread to wake is not the same as having authority to make a new instruction in that thread. An external relay message is a claim/event from another actor, not automatically the Desktop user's own newly typed instruction. Treating the two as interchangeable turns a correct delivery mechanism into a silent authority-escalation path; treating every event as untrusted and forever non-executable, conversely, makes the intended reactive role impossible. The missing unit is a bounded, revocable delegation from this thread's actual owner to this external sender for this kind of work, valid at dispatch time.
Concrete distinction in current public source: thread/inject_items explicitly appends raw model-visible Responses items without starting a user turn; turn/start is a separate action. These are transcript/control APIs, not by themselves a proof that content delivered by Synloq role B may exercise role A's workspace permissions as if the human had just spoken. This does not claim the current Desktop actually exposes such an insecure wake endpoint.
Illustrative H1/H2 with identical relay packet (thread=T, sender=B, payload='run follow-up X'):
- H1: the Desktop thread owner explicitly delegated B the bounded task family X for T and that grant is still current. An authenticated, validated wake should be able to start the intended turn with origin B, preserving the thread.
- H2: the owner later revoked B or rebound T to a different project/capability profile while the packet was queued or the client disconnected. The same valid sender identity and UUID no longer establish permission to execute X. A reconnect or successful
codex queueexit must not revive yesterday's authority. - H3: a quoted issue/Slack message mentions X but no sender with execution delegation requested it. Recording it as provenance-bearing context may be appropriate; executing it as a fresh user command is not.
Suggested recipient-facing contract: separate (1) origin of the event (human/relay role/source with stable delivery ID), (2) current thread-owner delegation (allowed sender, target thread/workspace, task class, expiry/revocation and effective profile at admission), (3) a single turn-admission decision for that event ID, and (4) the distinct delivery/start/visible/settled observations already requested. Revalidate the delegation against the authoritative current thread binding when dispatching after busy-queue or reconnect; do not infer it from the relay's own project_id or a remembered UUID. When a background event is allowed, surface it explicitly as external delegated input, not indistinguishable human-written text. Preserve the user-approval boundaries for later side-effecting tools.
Discriminators: positive authorized role B + idle/busy/reconnect starts exactly one correctly marked turn; negative revoked grant or changed workspace after queueing cannot execute even with valid sender authentication; negative duplicate delivery does not create another action; negative quoted external content without execution delegation cannot impersonate the user. Nonfit: ordinary user-entered Desktop text needs no external-delegation ceremony, and a truly read-only watcher need only a scoped observation grant, never wake/write permission. This extends rather than repeats the existing valuable transport/turnId review.
Original conceptual sources: Nakagawa Master's Consensus Memory / 合意の記憶 distinguishes historical consent and relational/re-agreement context from a flat event record. His Human-descendant AI Civilization Theory, vol. 16 — asynchronous partition and reconnection distinguishes a restored connection from restored common current state or fresh consent. The application here is source-grounded design reasoning, not a claim of product implementation, tested exploit, or the reporter having adopted these originals.
Implementation bridge — authenticated wake event with a revocable user grant
For a proposed exact-thread wake API, implement caller authentication, enqueue and turn start as distinct operations. The following JavaScript reference core evaluates a host-owned wake grant (not an existing Codex endpoint):
function admitThreadWake(caller, thread, grant, event) {
if (!caller.hostAuthenticated || !grant?.active || grant.revoked) return 'deny';
if (grant.callerId !== caller.id || grant.threadId !== thread.id ||
grant.currentAuthRev !== thread.hostAuthRevision) return 'reconcile';
if (!grant.allowedEventKinds.includes(event.kind)) return 'deny';
if (event.producerKind !== 'external-agent') return 'deny';
return 'enqueue-as-external-event';
}
Tests: authorized external agent + exact thread + live scoped event grant → enqueue as externally originated event, never spoof a direct human message; different thread, expired grant, unexpected event kind or changed thread scope revision → deny/reconcile; the already-enqueued event may still be visible after grant revocation as history, but may not retroactively authorize an execution. A real implementation must validate IDs and revisions on the host, atomically enqueue using an event ID/dedup key, prove owner-side visibility and only start a turn under the thread's separate current Goal/permission policy. A returned turnId is neither a consumed event nor a completed task. This is implementable decision logic, not Codex Desktop/API deployment.
This is the right next cut — delegation is orthogonal to both transport and turn observability, and the H1/H2/H3 framing matches what we see in practice. Mapping from our deployment (multi-agent relay, codex queue wake):
- Origin: every relay event already carries a stable event ID, thread ID, and an authenticated sender identity; our chat surface renders external events in a marked machine-origin envelope, not as operator-typed text.
- Delegation: the binding is operator-established at provisioning time (role → exact visible Desktop thread) and revocable (token rotation, explicit rebind only). Critically, our wake payload is deliberately identifier-only — a fixed inbox-reminder plus event IDs. Authority to act never travels in the nudge: the woken role must read its authenticated inbox, where the relay enforces per-recipient authorization, so a delivered nudge can at most make the role read, never execute an instruction not addressed to it. That puts a correctly built watcher close to your "scoped observation grant" nonfit category, with an explicit owner binding on top.
- Single admission per event ID: relay-side dedup plus a durable nudge ledger (bounded iterations, crash-safe ownership) — a duplicate cannot create a second action.
Two residual gaps we accept rather than paper over: (1) after an operator revokes a role, a nudge already sitting in the Desktop queue can still start a turn — it can then only fail loudly at the authenticated inbox read (no foreign execution), but a turn does start; admission-time delegation revalidation on the host side (your H2) is the correct fix, not client memory. (2) A queued reminder currently renders in the Desktop transcript as plain user text with no machine-origin marker; today we mitigate with fixed, content-free reminder text, but an origin label on externally-queued turns would close it properly.
We endorse the four-part contract and the revalidate-at-dispatch rule, and we agree with the nonfit boundary: ordinary typed text needs no ceremony, and a read-only watcher should hold a scoped observation grant, never wake/write permission.
Additional app-server 0.169.0 case for #61773
Variant: CLI/app-server 0.169.0 on macOS arm64, using the vendor-signed native host.
The existing local control socket works in this setup. The missing-control-channel case described in #47193 is therefore different from the remaining gaps here.
Two capabilities would help:
-
A trusted, explicitly enabled post-load callback for a persistent root after daemon recovery or a cold resume publishes it as loaded. A plugin MCP receiver otherwise has no thread binding until a native tool call occurs. In the inspected 0.169 source, pending SessionStart work depends on a later turn context. The callback should run once per runtime generation without starting inference, loading other threads or draining unrelated notices. This cold path was source-audited; no live restart experiment is claimed.
-
Guarded admission for an untrusted external event. An isolated controller fixture reproduces an active-to-idle interleaving: the activity check sees an active turn, that turn finishes, then the controller submits typed peer output through thread/inject_items. The 0.169 source permits history-only insertion when no active turn remains, so a successful response does not establish that attention will run.
Could a supported API provide an authoritative accepted, deferred or failed result, bound to the exact thread/runtime generation and a stable event identity? It should preserve peer-data classification, check current interruption, receiving intent, provider, usage and budget holds atomically, and support deduplication/readback after an ambiguous response. Explicit pauses must remain effective.
Please confirm whether existing supported surfaces cover these cases, or whether they require a native lifecycle/admission extension. These observations are pinned to 0.169.0 and make no claim about later releases.
Thanks for the lifecycle angle — this is exactly the territory our stand hit this week. Live evidence from our windows (Codex Desktop 0.169.0-alpha.11.1, relay-driven roles):
Cold-resume binding (your point 1): confirmed by us. codex queue --thread
Adding a Windows datapoint from a project we maintain, a third-party message relay with user-authorized bindings to specific Codex Desktop Local threads. The full reproduction is in #62712.
- Last verified working: Desktop package
26.1111.2228.0(bundled CLI0.169.0-alpha.11.1). We could discover the owner of the selected Local thread and subscribe to its v13 follower state through\\.\pipe\codex-ipc. - Affected: Desktop package
26.1117.3838.0(bundled CLI0.171.0-alpha.13) on Windows 11 x64, build 26300. After a full quit and normal relaunch with a Local thread open, the named pipe is still absent. Delivery fails before the follower handshake. Messages remain in our local inbox awaiting delivery to Codex.
Could a maintainer confirm whether the Windows listener was intentionally retired? If it was a regression, we'd appreciate a fix or a pointer to a build that restores it. If it was retired, could you point us to a supported replacement or workaround on current Windows builds?
Our minimum need is to wake one existing, explicitly authorized Desktop-owned Local thread so it can read its own inbox. Codex Desktop and the relay should be able to launch normally and independently. We're happy to send a content-free nudge, let the host's normal permissions apply, and confirm delivery only once the recipient actually reads and acknowledges the message. If codex queue --thread … --resume is the intended route, could you clarify whether it supports Desktop-owned Local threads in this Windows build, including unloaded threads, and how to distinguish queue acceptance from the target actually starting a turn?
Adding a hardware use case that needs the same contract, plus two more operations.
We build SUDO, a wired USB desktop controller for coding agents. Its local driver acts on Desktop-owned threads at the user's request, on the user's own machine. Since 26.1117 removed codex-ipc on Windows (#62712) it has no supported path either.
On the delegation point raised above: for a physical controller the authority question has a simple answer. Every action is a deliberate key press by the operator who is sitting at the machine, so the driver is relaying the operator's own instruction, not a claim from another actor. What it needs from Desktop is the exact-thread binding and typed outcomes, the same as the wake-up case.
Beyond "send to an exact thread", a controller also needs:
- a per-thread status subscription, including waiting-on-approval,
- answering one specific pending approval by request id,
- interrupting the active turn of one specific thread.
The full list and some possible shapes are in #62919. If the wake-up API here ends up as a caller-bound local channel, these three would fit the same channel.
Sonde has a concrete acceptance test for authenticated exact-thread wake. A user grants a local background integration access to one already-open, signed-in Codex Desktop thread. An authenticated peer event wakes that idle thread through its current owner. Reconnecting the integration preserves thread identity, and replaying the same delivery ID does not create another turn. The integration keeps its own durable peer acknowledgment. No Desktop restart, second thread writer, or new sign-in is involved.
Could maintainers confirm the supported attach-and-deliver route, or whether this is the same API request as #61734? A documented minimal request and response for bind and idle wake would let us implement and verify the Sonde adapter.
Sonde readback update: the Mac CLI accepted a single canary from an independent process using codex queue with the exact UUID of an already-loaded Desktop chat and without --resume. The prior turn finished, the canary appeared as the next user turn in that same chat, and the assistant returned the expected unique marker. No restart, sign-in, or writer transfer occurred. This establishes delivery in the loaded-chat case. Could maintainers confirm whether this queue path is supported for third-party background integrations and how to correlate a queued event with its eventual turn without introducing duplicate turns on reconnect? The observed CLI response carries a queue ID, while the resulting input arrived as user text. Sonde needs a host-scoped trust and acknowledgment contract before using the path for arbitrary inbound peer messages.
Update from the live integration test. A bounded local notification delivered with the installed codex queue --thread <uuid> --message <fixed notice> command entered the exact already-open signed-in Desktop chat, without --resume, a second writer, a restart, or a login. A signed receipt for the underlying peer message was verified separately. Queue acceptance is not evidence that the turn ran.
The remaining integration gap is attaching a separately configured MCP entry to that existing chat. codex mcp list sees the saved enabled entry, while the running chat tool catalog still shows only the original entry. The installed app-server schema declares config/mcpServer/reload, but its documented control socket was unavailable for the Desktop-owned session.
Is there a supported Desktop-owned, caller-authorized API to reload one MCP entry for one existing thread and report the resulting tool catalog? A scoped operation with typed unavailable and denied outcomes would let the wake remain a fixed notice and keep privileged actions behind the MCP entry’s own authorization. Related: #61734.
Please include retry-safe delivery of a tool result in the exact-thread wake API requested here. The use case is a background worker returning a result to the local Windows Desktop chat that started it. The owner may already be working on something else in that chat when the worker finishes.
We tested Windows Desktop 26.1120.6357.0 and its bundled Codex CLI 0.171.0-alpha.13.2. In a disposable app-server profile with a loopback model, we observed:
- Sending standalone tool output through
turn/startduring an active owner turn returned that same turn ID. The result entered the owner's turn. - The native user queue correctly waited for idle. After the queued turn finished, we simulated a lost acknowledgement by resubmitting identical input with the same
clientUserMessageId. The host allocated a second queue ID and ran a second continuation. The model request count went from two (owner plus first return) to three. Both user messages were present after restart. As a control, stopping the host with one pending submission and reopening the thread delivered that single submission once. - The queue's in-process enqueue path can wake a loaded thread immediately. Its external-store watcher checks for changes on a ten-second timer. Queue implementation at the tested tag
Requested contract: Let an explicitly authorized integration submit a typed tool result and stable delivery ID to the host that owns one existing local Desktop thread. Persist the receipt, signal the host on arrival, and admit the continuation through the native idle scheduler. A retry with the same ID and payload should return its existing admission state and turn ID. Conflicting content under that ID should be rejected. Preserve the binding across a closed chat or host restart, including a crash after admission and before acknowledgement. The result should retain tool provenance in the transcript.
The acceptance test is to race a human send against delivery, replay the receipt after losing its acknowledgement, and reopen the original chat. There should be one tool result and one continuation, zero input added to the human's active turn, and no polling, window activation, or global notification changes. Related requests cover attributed queue input in #54991 and queue recovery in #63230.
Additional macOS compatibility datapoint from a local quota-recovery utility (Codex Keeper). On Desktop 26.1120.50957 with bundled CLI 0.171.0-alpha.13.2 (macOS 15.7.2, arm64), the legacy Desktop IPC socket refused connections and independent thread/resume returned -32600, already has an active writer.
In a disposable, explicitly authorized, already-loaded Desktop thread, codex queue --thread <id> --message <test> without --resume started and completed a new turn both while the thread was selected and after switching away. A patched Swift transport using thread/queue/add also completed a real model turn without restarting Desktop or transferring the writer. The rollout recorded turn_attribution.turn_trigger = "queue" and a normal completion. This is evidence for the loaded-thread case, not a guarantee for unloaded threads or an end-to-end quota-recovery scheduler test.
Separately, in an isolated two-app-server fixture, submitting identical input twice with the same clientUserMessageId produced two different queue IDs. This independently corroborates the retry-safety concern already raised here. Queue admission alone is not turn startup, and matching rollout text is only a heuristic; a documented, idempotent receipt-to-turn correlation would help local user-authorized integrations avoid duplicate execution after ambiguous delivery.
Keeper-specific compatibility report: https://github.com/OM-KEN/Codex-Keeper/issues/5