Skip to content

Persist session mode across reconnect/load #172

@z-x-yang

Description

@z-x-yang

Summary

session/set_mode currently applies only to in-memory thread state. After process restart or session reload, previously selected mode may not be restored (especially collaboration modes such as plan introduced in ACP mode work).

Problem

Clients can successfully call session/set_mode, but if the ACP server is restarted and a session is loaded again, mode state may drift back to defaults unless the client re-applies mode every time.

This causes confusing behavior in persistent orchestration flows:

  • mode switch appears successful
  • reconnect/load happens later
  • mode-dependent behavior no longer matches the last explicit user choice

Proposal

Persist a mode override store under codex home and replay on session load/new:

  • Store file: $CODEX_HOME/acp/session-mode-overrides.v1.json
  • Persist on successful:
    • session/set_mode
    • session/set_config_option when config_id == "mode"
  • Replay in new_session / load_session after thread is initialized
  • Corrupt/missing file should be non-fatal (warn + continue)

Why in codex-acp (not only client-side)

Client replay is useful, but server-side persistence keeps behavior consistent across different ACP clients and reconnect patterns, and reduces mode drift when owners restart.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions