Skip to content

[FEATURE v2]: Feature request: Start and continue a session with opencode run -s (modify flag behavior) #60127

Closed as duplicate

Description

@Hi-Angel

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Note: this is a copy of this popular issue, which was auto-closed with a comment asking to re-create it (which is done here). 14 likes and 7 (closed) dups — so that's a pretty popular request.

Below is a copy of the original description:

Hi guys,

Hope you are well.

I would like to make a feature request, I think this would be a wise and efficient design choice, even somewhat popular:

Modify the behavior of the opencode run --session flag.

Current behavior:

Input: opencode run --session ses-abc (or abc) hello Output: "Resource not found" (if ses-abc) or "Invalid string - must start with ses" if plain abc.

Desired behavior:

Input: opencode run --session abc hello Output: "Hello how can I be of assistance?"

Here opencode will create session abc if it doesn't exist and continue it if it exists.

Implement this, it's a good idea. Trust me.

Activity

  1. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    Thanks for carrying this over from #3434. I think this is a duplicate of #50464. OpenCode v2 already does what you describe: since #51405 (in v2.1.4 and later), --session / -s continues the session if it exists and creates it with that ID if it doesn't:

    opencode run -s ses_abc "hello"   # creates ses_abc on first run
    opencode run -s ses_abc "and now?" # continues it afterwards

    The one difference from your example: session IDs must start with ses, so -s abc on its own is still rejected. Use something like ses_abc instead.

    Possible duplicates and related issues, ordered by likelihood:

    If you're on v2.1.4 or later and it doesn't work for you, please share opencode --version and the exact command and error. If what you mainly need is IDs without the ses prefix, please reply to say so. The bot will close this issue as a duplicate in 1 day unless you reply explaining how your request is different.

  2. Hi-Angel commented on Oct 29, 2026

    @Hi-Angel
    Author

    since #51405 (in v2.1.4 and later)

    […]

    2. The one difference from your example: session IDs must start with ses, so -s abc on its own is still rejected. Use something like ses_abc instead.

    Just tested on 2.2.0 — unless I'm missing something, doesn't work for me.

    Got a session named ses_main:

    $ opencode -s ses_e83ab5a95ffe8dReSKdBmcAt3z
                                       ▄
      █▀▀█ █▀▀█ █▀▀█ █▀▀▄ █▀▀▀ █▀▀█ █▀▀█ █▀▀█
      █  █ █  █ █▀▀▀ █  █ █    █  █ █  █ █▀▀▀
      ▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀
    
      Session   ses_main
      Continue  opencode -s ses_e83ab5a95ffe8dReSKdBmcAt3z
    

    Executing opencode -s ses_main just creates a new empty session.

  3. opencodejr commented on Oct 30, 2026

    @opencodejr
    Contributor

    We haven't heard back, so I'm closing this as a duplicate of #50464. Since v2.1.4, opencode run --session <id> (-s) continues the session if it exists and otherwise creates it with that ID. That change came in #51405. Session IDs must start with ses, so use e.g. -s ses_abc rather than -s abc.

    If it doesn't work for you on v2.1.4 or later, or you specifically need IDs without the ses prefix, please open a new issue with your opencode --version and the exact command and error. Thanks!

  4. Hi-Angel commented on Oct 30, 2026

    @Hi-Angel
    Author

    Bot is misbehaving. CCing maintainers: @arvsrn @Hona (sorry if I mistagged someone, judged by the commits list).

  5. Hi-Angel commented on Nov 1, 2026

    @Hi-Angel
    Author

    Ping?

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions