LearnNewsExamplesServices
Frontmatter
id13636
titleAdd nonce-backed Codex wake submit causality proof
stateClosed
labels
bugairegressionarchitecturemodel-experience
assigneesneo-gpt
createdAtJun 20, 2026, 5:00 PM
updatedAtJun 20, 2026, 7:21 PM
githubUrlhttps://github.com/neomjs/neo/issues/13636
authorneo-gpt
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 20, 2026, 7:21 PM

Add nonce-backed Codex wake submit causality proof

Closed v13.1.0/archive-v13-1-0-chunk-4 bugairegressionarchitecturemodel-experience
neo-gpt
neo-gpt commented on Jun 20, 2026, 5:00 PM

Context

Release classification: post-release / boardless (Approve+Follow-Up follow-up from PR #13631; non-blocking for the already-merged observability classifier).

PR #13631 merged with Resolves #13480 and auto-closed #13480 at 2026-06-20T14:58:55Z. Vega's review approved the code but correctly flagged a tracking gap: #13631 ships bounded observability (wake-submit-started / wake-submit-not-started / wake-submit-unknown) using a timestamp window after Codex Submit attempted, but it cannot prove that a matching turn was started by the scripted submit rather than by a later human Enter.

This ticket preserves that durable residual after #13480 closed.

Live latest-open sweep: checked the latest 20 open issues immediately before creation; no equivalent nonce / Codex submit causality successor found. Exact GitHub searches for Codex wake submit turn-start nonce, wake-submit-started wake-submit-not-started wake-submit-unknown nonce, and Codex turn presence nonce wake submit found no open equivalent; only closed #13480 matched. A2A in-flight claim sweep: checked latest 30 all-state messages immediately before creation; no competing lane-claim/lane-intent for this nonce-correlation scope surfaced.

The Problem

#13631 is intentionally conservative. It converts opaque Codex wake submit failures into typed evidence rows without changing the active osascript submit route. That is the right first step, but it leaves one known ambiguity:

  • wake-submit-not-started is strong evidence that the scripted submit did not start a turn within the evidence window.
  • wake-submit-started proves a nearby Codex turn-start happened, but timestamp proximity alone cannot prove whether the scripted Enter caused it.
  • If the operator presses Enter after a failed scripted submit, the timestamp-window classifier can misread that later human Enter as a successful scripted submit.

The now-closed #13480 bug was precisely about wake payloads landing in Codex without reliably starting a turn. The remaining durable proof gap is causal correlation, not another blind submit-delay tweak.

The Architectural Reality

Relevant surfaces:

  • ai/daemons/wake/daemon.mjs now owns the Codex submit classifier and logs wake-submit-started, wake-submit-not-started, and wake-submit-unknown evidence.
  • .codex/hooks/codex-context.mjs writes AGENT_TURN_PRESENCE rows at the Codex UserPromptSubmit boundary.
  • Memory Core graph-backed turn presence is the only current local oracle for whether a Codex prompt submit actually started a turn.
  • codex debug app-server send-message-v2 remains injection-only; no current native submit/turn-start command has been verified.
  • ADR 0002 treats bridge/OS automation as a fallback-fragile path and favors evidence-preserving wake routing over overclaiming delivery success.

The Fix

Add nonce-backed causality to the Codex wake submit classifier:

  1. Generate or propagate a per-wake submit nonce / correlation id from the wake-daemon submit attempt.
  2. Carry that nonce into the Codex prompt payload or hook-visible context without changing message semantics for the user.
  3. Persist the nonce on the AGENT_TURN_PRESENCE row or an adjacent evidence record written by the Codex UserPromptSubmit hook.
  4. Update the classifier so wake-submit-started means nonce-correlated turn-start, not timestamp-window-only proximity.
  5. Downgrade timestamp-window-only matches to wake-submit-unknown or a clearly named ambiguous state so operator Enter cannot masquerade as scripted-submit success.

Contract Ledger

Target Surface Source of Authority Proposed Behavior Fallback / Edge Case Docs Evidence
Codex wake submit nonce #13480, #13631 review, ai/daemons/wake/daemon.mjs classifier Each Codex submit attempt gets a unique correlation value that can be matched at turn start. If no safe payload/hook channel exists, keep timestamp-window behavior but classify matching rows as ambiguous rather than successful. PR body and source JSDoc document nonce scope and ambiguity handling. Focused wake-daemon unit coverage for nonce match, no-match, and unavailable-graph paths.
Codex UserPromptSubmit turn-presence evidence .codex/hooks/codex-context.mjs and Memory Core AGENT_TURN_PRESENCE rows Hook persists the wake nonce/correlation id when the turn starts from a wake-submitted prompt. If the turn is human-started or has no nonce, the row remains valid turn presence but must not satisfy scripted-submit causality. JSDoc documents field semantics and non-wake behavior. Unit or focused integration coverage around hook-visible parsing/persistence, plus source static checks.
wake-submit-started classifier vocabulary #13631 and #13480 close-target residual wake-submit-started is reserved for nonce-correlated turn start; ambiguous timestamp-window starts do not overclaim. Graph/hook unavailable or missing nonce yields wake-submit-unknown / ambiguous classification. PR body Evidence line names achieved level and residual L4 live validation. Unit coverage plus post-merge live sample against active WAKE_SUB:7648b86c-2f1e-43a8-95a6-cc399f66a938.

Decision Record impact

Aligned with ADR 0002 wake-substrate standards. No ADR amendment expected: this narrows Codex bridge evidence semantics and turn-start proof, not the overall wake-substrate architecture.

Acceptance Criteria

  • Codex wake submit attempts carry a unique nonce/correlation id into the turn-start evidence path.
  • The Codex UserPromptSubmit hook or adjacent Memory Core evidence records persist that nonce when a wake-submitted prompt starts a turn.
  • wake-submit-started requires nonce-correlated evidence; timestamp-window-only matches are no longer treated as causal proof.
  • wake-submit-not-started and wake-submit-unknown remain fail-safe and do not alter the active osascript submit route.
  • Focused tests cover nonce-correlated started, no matching turn, missing/ambiguous nonce, and graph/hook unavailable cases.
  • PR evidence names the sandbox ceiling and the required post-merge live validation against the active Codex wake subscription.

Out of Scope

  • Replacing the active Codex osascript route.
  • Adding another blind submit delay.
  • Reintroducing pure-heartbeat chat interrupts beyond the current wake policy.
  • Reopening the broad #13480 tracker unless a fresh current-source failure shows this successor is too narrow.
  • Changing non-Codex harness wake routes.

Avoided Traps

  • Timestamp proximity as causality: a nearby turn-start is not proof that scripted Enter succeeded when operator Enter can create the same row.
  • Native-submit pivot without a primitive: do not center a native Codex submit replacement unless a real submit/turn-start command is verified.
  • Delay tweak loop: without nonce-backed evidence, another timing change is guesswork.
  • Observability closes reliability: #13631 is valuable observability, but this ticket keeps the durable proof gap tracked after #13480 closed.

Related

  • Closed tracker: #13480
  • Observability PR: #13631
  • Prior route/evidence chain: #13484, #13591, #13625
  • Turn-presence / who-is-online substrate: #13498 / #13499 lineage
  • Architecture anchor: ADR 0002 (learn/agentos/decisions/0002-phase3-wake-substrate-standards-alignment.md)

Origin Session ID: 2513f864-fce4-4a47-8d4b-afe8a5532e91 Retrieval Hint: "Codex wake submit nonce causality wake-submit-started timestamp-window human Enter AGENT_TURN_PRESENCE UserPromptSubmit #13480 #13631"