Repository navigation
feat(messaging): add local Codex queued session messaging - #6544
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (20)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughAdds ChangesLocal Codex messaging
Priority: ⬇️ Low Estimated code review effort: 4 (Complex) | ~45 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant CLI as message-command
participant Sender as sendLocalMessage
participant RPC as LocalMessageRpc
participant AppServer as Codex app-server
CLI->>Sender: Pass message options, context, and budget
Sender->>RPC: Connect and initialize
RPC->>AppServer: Request loaded-thread pages and metadata
AppServer-->>RPC: Return loaded-thread metadata
Sender->>RPC: Re-read destination and queue message
RPC->>AppServer: Send thread/read and thread/queue/add requests
AppServer-->>RPC: Return metadata and queue response
RPC-->>Sender: Return queue result
Sender-->>CLI: Return message receipt
Merge Risk: ⚪ Minimal · up to No confirmed merge-blocking issue remains for local messaging. Validate a queue submission against a real supported daemon during normal acceptance checks. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 7 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. Automatic draft conversion failed. Please convert this pull request to a draft manually until every box above is ticked. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
d5cf770 to
0e0eef9
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
Scoped offline lifecycle verification at 0e0eef9: bun test tests/codex-integration/messaging-local-lifecycle.test.ts passed 15/15, 0 failures, 1709 assertions, exit 0 on Linux/Bun 1.4.0. This exercises import-time inactivity, command-local literal import inventory, bounded pending RPCs, socket cancellation/deadlines, oversized/invalid frames, output budgets, TERM/KILL cleanup of owned launcher groups, and bounded waiting when detached descendants retain pipes. The detached fixture is test-owned and explicitly cleaned up; this is not proof that the runner terminates an escaped process group, which the owning doc correctly excludes. Work ran sequentially with CPUQuota=75%, MemoryMax=1536M, zero swap and fresh private homes. No real Codex daemon/session/message, native 0.160.0 binary, remote tunnel or live account was used. I read the local ownership doc and the budget/process/test fixture paths; this is not a complete 43-file/native-queue/permission-boundary approval. Required hosted current-head CI and independent full review remain separate. |
0e0eef9 to
aa49a10
Compare
There was a problem hiding this comment.
Read the rebased checkpoint at aa49a10d5bd7e059246441464c6929f75ca12b7a. The messaging runtime and the three message command/argument/runtime modules are byte-identical to the published 0e0eef93 source in direct comparison, so I did not repeat unchanged native tests or present the author's historical results as independent current execution.
The documented distinctions remain important: a queued receipt acknowledges submission, not recipient processing/steering; an unknown outcome must not be replayed; a post-revalidation unload fixture is not proof of real-daemon atomic loaded-target enforcement. Updated checkpoint (2026-10-04 22:45 UTC): the author has now checked all four readiness boxes and GitHub reports Ready at the same aa49a10d5bd7e059246441464c6929f75ca12b7a head. The target/readiness gate completed successfully, but exact-head Cross-platform CI 37232506258 and React Doctor 37232506242 still require workflow-execution authorization (action_required), not successful execution. The latest hygiene rerun is cancelled; an earlier successful same-head hygiene run does not turn that cancelled rerun into a pass. Please keep completed hosted verification, the independent boundary review and sponsorship decisions separate from the author's local attestation. This COMMENTED checkpoint is not an approving review or authorization to execute the fork workflows.
No native daemon/binary was invoked by me, no actual recipient was contacted, and no workflow authorization, sponsorship waiver, scan, author-branch modification or approval was performed.
- Define a provisional command-owned local discovery and queued-delivery boundary against current dev. - Map reusable experimental responsibilities while excluding remote, Claude, dashboard and root-relay layers. - Record Codex 0.160.0 schema receipts, unverified contracts and focused acceptance cases. - Verify privacy, structure ownership, document links, source references and whitespace; runtime tests remain pending.
- Add command-owned Unix metadata RPC, complete loaded-session discovery and exact target resolution without startup activation. - Bound deadlines, frames, concurrency and helper output; terminate owned launcher process groups on incomplete execution. - Add isolated regressions and pin native Codex 0.160.0 queue success and lost-acknowledgement interoperability. - Document ownership, provisional scope and remaining CLI/envelope work; preserve the explicit hold on PR creation. - Verify 25 changed messaging tests, focused layout/structure/ratchet checks, typecheck, privacy and whitespace.
- Added command-local discovery and exact queued delivery with metadata-derived sender context and correlated peer envelopes. - Preserved not_sent, queued and unknown outcomes with one native invocation, isolated helper homes and no automatic replay. - Added bounded stdin, runtime admission, CLI registration, public documentation and owning architecture records. - Validated 1039 changed tests plus native interoperability, CLI/layout/structure regressions, typecheck, privacy and the documentation build; independent review and full-suite readiness remain pending.
- Recorded the clean refresh onto upstream dev 358b8ff and preservation of the newly integrated test-layout entries. - Verified 1039 changed tests and 94 explicit source guards, plus typecheck, privacy, structure, generated CLI surface and documentation build. - Kept full-suite readiness, independent/security review and PR publication authorization explicitly outstanding.
- Cancel pending output readers after forced cleanup without waiting on detached descendants or cancellation hooks. - Preserve owned process-group termination, unknown submission receipts and no-replay behavior. - Add timeout, cancellation and overflow regressions; keep upstream-facing documentation confined to the proposed scope. - Verify 24 focused lifecycle/send/native-queue tests, strict typecheck and structure ownership checks.
- Record the current-dev refresh, bounded pipe cleanup and extraction provenance for the local-only contribution. - Verify 1040 connected tests and 94 explicit guards, plus native interoperability, typecheck, privacy, structure and the documentation build. - Document the full-suite resource exception and keep independent review, publication and deployment authority separate.
- Added contract-focused docstrings for local messaging and owned lifecycle helpers. - Verified peer permission claims remain text-only and post-check native rejection stays unknown without replay or resume. - Clarified non-atomic target checks and receiving-harness permission enforcement limits. - Validated 45 focused tests, 1043 changed tests, 110 guards, typecheck, docs build, privacy and structure checks.
- Group local messaging test registrations using the existing layout data style. - Preserve every mapping and its ordering without changing the size-ratchet policy. - Verify JSON equivalence and pass all 27 layout and file-size regression tests.
aa49a10 to
1888b0d
Compare
|
Thanks @phillipod. A maintainer review found two security issues at
Your contract stays the same: |
… under its cap Bun.Glob yields backslash paths on Windows, so the activation-boundary inventory compared native separators against POSIX allowlist entries. Current dev already holds scripts/test-layout/layout.json at 2,000 lines, which the file-size ratchet reports as NEW_OVERSIZED. Join five single-entry registration lines onto their neighbours; parsed values and ordering are unchanged (1,996 lines).
Summary
Relates to #6478. This is the small, local-only Codex slice from the maintainer's staging guidance, not the full cross-machine proposal; #6478 stays open.
ocx message sessions [--json]lists threads currently loaded in the existing local Codex app-server, using metadata only. Pagination must be complete; missing, ambiguous, incomplete or unloaded targets fail closed.ocx message send (--thread <uuid> | --name <exact-name>) --stdin [--json]queues one message for an exact loaded session. The command starts no proxy, daemon or app-server, resumes no session and installs no skill.CODEX_THREAD_IDand loaded-session metadata and is explicitly marked as unauthenticated.not_sent(exit 1),queued(exit 0) andunknown(exit 3). Queued means the daemon acknowledged the submission, not that the recipient processed it. An uncertain submission is never replayed.Maintainer follow-up (commits
79dd488574,1666aed0f7) — fixes two findings from an independent security review of1888b0d98e:codex queue --message <text>, so message bodies were visible inpsand, on Linux, to other users through/proc/<pid>/cmdline. Nativecodex queuehas no stdin option. Submission now sends the same experimentalthread/queue/addJSON-RPC that nativecodex queuesends, over the already-open control-socket connection used for discovery and final revalidation. No helper process is spawned, the message never enters argv, and discovery, revalidation and submission share one connection. The native CLI version pin (0.160.0) is no longer needed; the running daemon must support experimentalthread/queue/add. An explicit JSON-RPC rejection isnot_sent(unsupported_queue/queue_rejected). Timeout, disconnect, cancellation, a malformed reply or a mismatchedclientUserMessageIdafter the request was written isunknown, without retry.untrusted_socket.Remote enrollment, bearer management, SSH/topology, dashboard controls, Claude messaging, permission/delegation policy, isolation, managed skills and idle notifications remain deferred. No global prompt, background listener or timer is added, and nothing on the request core path imports messaging.
Original work by @phillipod.
Verification
Head
1666aed0f7511a0ff19673664bc04d0dedbbab30(PR commits plus a merge ofdevatbbab02ab27, which also clears the stalerelease-version-linefailure the old base hit in CI).bun run typecheck— passed.bun test tests/codex-integration/messaging-local-*.test.ts— 43 pass, 0 fail (macOS). Covers queued success with correlation, eachnot_sentmapping,unknownafter write with exactly one request, no spawned helper, the CLI end to end against a fake Unix daemon, and socket trust rejections and acceptances.bun run structure:check,bun run skill:surface:checkandbun run privacy:scan— passed.bun run test:changed— 1,410 pass, 1 skip.queuedsuccess against a loaded recipient was not exercised.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
ocx message sessionsto list already-loaded local Codex sessions.ocx message sendto queue a request, response, or notification for a selected session using its exact ID or unique name. Provide message text through standard input.