Skip to content

gbot codex / bridge: inject messages into Codex threads via app-server #26

Closed

Description

@ScriptedAlchemy

Summary

Add a gbot subcommand (or sibling codex-bridge binary in this repo) that attaches to a Codex app-server and injects messages into threads with documented JSON-RPC (turn/start).

Parent: bidirectional Grok↔Codex epic.

API surface (v1)

Suggested CLI:

gbot codex list-threads [--limit N]
gbot codex send <threadId> <message...>
gbot codex status   # which socket / daemon / Desktop mode

Wire protocol:

  1. Connect to $CODEX_HOME/app-server-control/app-server-control.sock (WebSocket-over-UDS) or codex app-server proxy
  2. initialize + initialized
  3. thread/list / thread/resume as needed
  4. turn/start with input: [{ type: "text", text: "..." }]
  5. Optionally experiment with toolOutput: { name: "send_message_to_thread", ... } for delegated provenance (may not get Desktop banner)

Desktop limitation (must document)

While ChatGPT Desktop uses private stdio + CODEX_APP_TOOLS_PIPE_PATH, the shared control socket is often missing. External inject into live Desktop tasks is blocked until upstream fixes:

v1 targets daemon-managed Codex sessions. Detect and print a clear error when the socket is absent / Desktop-private mode is active.

Implementation notes

  • Reuse patterns from agent-bundle’s codex-app-server.ts (UDS+WS client) where practical
  • Handle server→client approval requests or require approvals_reviewer auto modes for unattended inject
  • Pin schema to installed Codex via codex app-server generate-json-schema / version check

Acceptance criteria

  • gbot codex status reports reachable vs Desktop-private mode
  • list-threads works against a running local daemon
  • send starts a turn and returns turn/thread ids
  • README documents Desktop vs daemon, auth, and failure modes
  • Explicit refusal to depend on /tmp/codex-browser-use/*.sock

Out of scope (for now)

Calling Desktop’s proprietary codex_app MCP send_message_to_thread over the temp pipe.

Activity

  1. ScriptedAlchemy commented on Sep 15, 2026

    @ScriptedAlchemy
    OwnerAuthor

    GPT-6 Pro revisions for gbot codex (chatgpt.com, 2026-09-14)

    Scope wording

    Prefer: existing threads on an explicitly reachable, supported app-server (daemon or deliberately shared server) — not “every TUI session sharing CODEX_HOME.”

    Remove / change from current issue body

    1. Drop “detect Desktop-private mode from missing socket.” Report truthful diagnostics (socket-not-found, permission-denied, thread-not-loaded-here, desktopAttachment: unknown). Only claim desktop-private-unsupported with real evidence.
    2. Drop toolOutput impersonation of send_message_to_thread. Use plain text with bridge provenance for requests; optional later toolOutput named gbot_result for real bridge results.
    3. Drop “require auto approvals_reviewer for unattended.” Delivery ≠ authority; do not silently reconfigure sandbox/approvals on the recipient thread.
    4. Default agent list to loaded threads; make resume explicit. Never spawn another app-server / force unlock on ownership failure.

    Delivery semantics

    • send: immediate submit; document native start-or-steer (no race-free idle-only via check-then-start).
    • steer: requires expectedTurnId.
    • queue: capability-gated; investigate upstream codex queue / thread/queue/add before building our own; never silent fallback to steer.
    • Receipts: accepted | completed | failed | blocked | unknown. Retry reads; do not blind-retry submit after lost ack.

    Layout (keep JS ESM; no TS migration)

    src/codex/{cli,endpoint,transport,client,service,approvals,protocol}
    src/bridge/{message,policy,receipts}
    src/mcp/{server,grok-tools,codex-tools}
    skills/message-codex/SKILL.md
    

    Reuse agent-bundle’s UDS+WS pattern, not the whole helper (it drops method notifications / closes too early).

    Commands

    gbot --json codex status
    gbot --json codex list-threads --loaded
    gbot --json codex send "$THREAD_ID" --stdin
    gbot --json codex steer "$THREAD_ID" --expected-turn-id "$TURN_ID" --stdin
    gbot mcp --tools codex

    Security

    • No codex_rpc(method, arbitraryParams).
    • Authenticate routes/principals, not self-reported bot names in the body.
    • Bound gateway timeouts/redirects; redact secrets beyond Bearer-only.

    Source: model 6 Pro on chatgpt.com.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions