Skip to content

Sync CLI and app-server sessions #14722

Closed

Description

@kendonB

What variant of Codex are you using?

codex-cli 1.16

What feature would you like to see?

If I use codex resume to connect to an open session (e. g. ssh'ing from another device) I'd expect the printed content in the original session to stay up to date, behaving as if it is being remotely controlled.

Likewise I'd expect this syncing between codex app and any third party app server systems.

Additional information

No response

Activity

  1. github-actions commented on Mar 14, 2026

    @github-actions
    Contributor
  2. kendonB commented on Mar 14, 2026

    @kendonB
    Author

    Duplicates are not duplicates. This issue is more narrow. Two sessions on the same machine connecting to the same uuid chat should stay in sync.

  3. Companionh commented on Mar 18, 2026

    @Companionh

    Howdy, I had the same question as you as to why the codex sessions arent synced across devices natively so I made my own workaround to implement the feature.

    Its currently in experimental alpha and it requires a self-hosted linux server to share the sessions but the codex session sync is functional.

    https://github.com/Companionh/codex-workspace-sync

  4. added
    agentIssues related to the core agent loop
    and removed
    CLIIssues related to the Codex CLI
    on Apr 2, 2026
  5. added
    app-serverIssues involving app server protocol or interfaces
    and removed
    agentIssues related to the core agent loop
    on Apr 11, 2026
  6. nylla8444 commented on May 18, 2026

    @nylla8444

    just noticed this.

    I thought codex CLI and Codex App session is pointing at the same session ID, it isnt?
    after shutting down my CLI session and transferred to my Codex App, I cant see my latest session?
    Do I need to do something first or what?

  7. safal207 commented on Jun 24, 2026

    @safal207

    This proposal maps closely to LS work on durable trajectories, continuation identity, and deterministic event replay.

    A useful distinction may be:

    same thread history
    ≠ clients are live-synchronized
    ≠ clients have processed the same event cursor
    ≠ clients may independently execute the same request

    A shared Codex thread could be modeled as one append-only event stream with multiple client projections.

    durable thread event log
    → CLI projection
    → desktop projection
    → app-server projection
    → third-party client projection

    Each client would track its own delivery cursor:

    {
    "schema_version": "thread-client-cursor/v0.1",
    "thread_id": "thread-123",
    "trajectory_id": "project-alpha",
    "client": {
    "client_id": "ssh-cli-02",
    "client_type": "CLI",
    "connection_id": "connection-771"
    },
    "last_received_sequence": 184,
    "last_rendered_sequence": 183,
    "last_acknowledged_sequence": 183
    }

    The central invariant would be:

    «All attached clients observe the same authoritative thread events, while only one accepted operation creates each turn or side effect.»

    This separates synchronization from authority.

    For example, an external client may submit:

    {
    "request_id": "mobile-client:991",
    "thread_id": "thread-123",
    "operation": "START_TURN",
    "expected_thread_sequence": 184,
    "payload": {
    "text": "Run the remaining integration tests"
    },
    "deduplication_key": "mobile-client:991"
    }

    The server would append one authoritative event:

    {
    "sequence": 185,
    "event_id": "event-185",
    "event_type": "TURN_STARTED",
    "request_id": "mobile-client:991",
    "actor": {
    "client_id": "mobile-client",
    "user_id": "local-operator"
    },
    "turn_id": "turn-044"
    }

    Every connected surface would then render that same event.

    A possible event set:

    • "USER_MESSAGE_APPENDED"
    • "TURN_STARTED"
    • "ASSISTANT_DELTA"
    • "PLAN_UPDATED"
    • "TOOL_CALL_STARTED"
    • "APPROVAL_REQUESTED"
    • "APPROVAL_RESOLVED"
    • "TURN_COMPLETED"
    • "TURN_INTERRUPTED"
    • "CLIENT_ATTACHED"
    • "CLIENT_DETACHED"

    The UI should also preserve actor attribution:

    [SSH CLI]
    Run the remaining integration tests

    rather than making externally submitted input indistinguishable from local keyboard input.

    A useful recovery flow could be:

    client reconnects
    → supplies last acknowledged sequence
    → server replays missing events
    → client rebuilds projection
    → switches to live subscription

    This avoids relying on terminal scraping or full-history polling.

    Conflicting operations also need deterministic handling. For example:

    client A starts turn at sequence 184
    client B also starts turn expecting sequence 184

    One request could be accepted, while the second receives:

    {
    "status": "CONFLICT",
    "reason": "THREAD_SEQUENCE_ADVANCED",
    "current_sequence": 185,
    "retry_policy": "REFRESH_AND_REEVALUATE"
    }

    This prevents two clients from unknowingly starting duplicate work.

    The current policy state should remain server-authoritative:

    shared conversation
    ≠ shared implicit approval authority

    A remote or resumed client may observe an approval request, but resolving it should require a separately authenticated capability.

    A deterministic conformance fixture could test:

    1. two clients attached to one thread receive the same ordered events;
    2. external user message appears immediately in the original CLI;
    3. assistant streaming deltas appear on every live client;
    4. disconnected client replays only missing events;
    5. duplicate request ID creates one turn;
    6. concurrent stale requests produce a deterministic conflict;
    7. actor identity is visible on every client;
    8. one client interruption updates all projections;
    9. approval observation does not imply approval authority;
    10. process restart preserves thread sequence and client recovery.

    Related LS work:

    Would a small vendor-neutral "ThreadEvent", "ClientCursor", and concurrent-operation fixture help make multi-client synchronization, replay, attribution, and duplicate-turn prevention machine-testable?

  8. kendonB commented on Jun 24, 2026

    @kendonB
    Author

    @safal207 these slop posts are unlikely to be helpful

  9. DdavidC commented on Jul 28, 2026

    @DdavidC

    Another problem is to sync the session logs between Windows Codex App and Codex CLI in WSL2
    Even switch the Codex App settings to "Windows Subsystem for Linux" and "WSL", Windows Codex App still uses "%USERPROFILE%\.codex\sessions" as the only resource of session logs, never cares about "~/.codex/sessions/" in WSL2.

  10. t46 commented on Jul 30, 2026

    @t46

    This issue matches a practical workflow gap I am seeing:

    1. Start work in a local Codex CLI session on one computer.
    2. Continue or steer that work remotely from another computer/device.
    3. Return to the original computer.
    4. File changes are present, but the original CLI/Desktop UI does not consistently show the remote turn history or the full execution transcript.

    The gap is especially confusing when a Desktop app task launches codex exec: the parent chat may show the command and final output, but the inner execution is not visible as a first-class child session/transcript that can be searched or resumed.

    Expected behavior: CLI, app-server, Desktop app, and Remote should expose one authoritative thread history for the same session, including remote turns, approvals, tool calls, spawned subagents, and codex exec runs (or an explicit linked child-session view). A user should be able to resume from any supported client without losing the transcript context.

    Claude Code's Remote Control provides the workflow users expect here: resuming the local conversation reconnects to the remote session. This would be a high-impact parity and reliability improvement for multi-device Codex workflows.

  11. kendonB commented on Aug 4, 2026

    @kendonB
    Author

    this seems to work now

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

    app-serverIssues involving app server protocol or interfacesenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions