Skip to content

[Feature] Per-session remote OpenCode server #1236

Closed

Description

@TheStaticMage

I use sandboxed OpenCode servers in containers or MicroVMs which allow me to run compartmentalized work. Today CodeNomad attaches every project to a single local OpenCode daemon, so running an agent in an isolated environment means opening a separate CodeNomad instance or connecting a separate remote CodeNomad window. Each of those has its own tabs, settings and notifications. I would love to have a single CodeNomad instance with tabs instead of one CodeNomad remote connection window per container.

I'm requesting the ability to choose, when opening a project (and every OpenCode session created inside it), which OpenCode server it runs on. The choice would be either the default local shared service or a separately configured OpenCode server identified by URL and credentials, such as a daemon in a container, VM, devcontainer or remote host.

Activity

  1. self-assigned this
    on Nov 1, 2026
  2. pascalandr commented on Nov 1, 2026

    @pascalandr
    Contributor

    @TheStaticMage Thanks, this is a really interesting request. Choosing which OpenCode server each project runs on would be a real paradigm change for CodeNomad, and it's one I particularly like. I'm studying how to make it possible and will keep you posted.

  3. TheStaticMage commented on Nov 1, 2026

    @TheStaticMage
    ContributorAuthor

    Thanks for the note. What I've done so far is update my Docker images to bake in CodeNomad and start CodeNomad (not OpenCode) in the entrypoint script. The launcher script chooses an unused port on the host at startup time and forwards that to the CodeNomad port in the container. With this setup, I can use CodeNomad on the host to connect to the "remote" (in-container) CodeNomad and I have the isolation I want.

    The downsides of this approach are:

    1. I need a separate CodeNomad window open per remote connection on my host, plus the default launcher window, to make this work. I'd love if I could have just a single window with each remote connection across the top in tabs but I haven't found a way to do this in the current version.
    2. I don't have a stable port to expose on my tailnet for remote access. In the <= 0.19 days the single CodeNomad process was on 9898/9899 and I could just put that port on tailnet. With the new approach I have one port number per container and that gets unwieldy as project count increases.

    Thanks for considering this. Hopefully these notes help when understanding your users' use cases.

  4. pascalandr commented on Nov 2, 2026

    @pascalandr
    Contributor

    Thanks, @TheStaticMage! This matches what I'm implementing: one host CodeNomad window, with project tabs connected directly to isolated OpenCode servers, no CodeNomad needed inside containers. Your tailnet clients would use a single CodeNomad endpoint. Still work in progress, with no release date yet.

  5. pascalandr commented on Nov 5, 2026

    @pascalandr
    Contributor

    Quick update on this: I built a working prototype (#1296) where CodeNomad connects directly to a remote OpenCode server and opens its projects in regular tabs, with no CodeNomad needed in the container. It works for sessions and chat, but it loses too much of what makes CodeNomad useful (files, Git, Missions, automations…), since those features live in the CodeNomad server. So I'm now working on the other way around: a CodeNomad server in each container or VM, with its projects opening as tabs in your single CodeNomad window instead of separate windows. Would running a CodeNomad server inside your sandboxes work for you?

  6. TheStaticMage commented on Nov 5, 2026

    @TheStaticMage
    ContributorAuthor

    Would running a CodeNomad server inside your sandboxes work for you?

    That's actually what I have set up now and it works pretty well even though it's not elegant.

    My current setup in a nutshell:

    • Docker container with opencode, CodeNomad, and a bunch of languages and tools
    • Entrypoint script that starts opencode on port 4096 and codenomad on CODENOMAD_SERVER_PORT
    • Script on host that does the following:
      • Bind mount project directory read-write and the .git directory read-only
      • Track a stable CODENOMAD_SERVER_PORT per project and set that in the container environment when launching
      • Forward that CODENOMAD_SERVER_PORT from host to container
    • CodeNomad installed on my host system
      • In the main instance I only use connect to server never folders
      • I add individual http://localhost:<codenomad-server-port> servers, one per project
      • Have main CodeNomad server connect to child server, select project directory, and 🚀

    I have to manually start the container for each separate project directory now.

    a CodeNomad server in each container or VM, with its projects opening as tabs in your single CodeNomad window instead of separate windows

    ☝️ is exactly what I would like. When implemented, I would adjust my setup to match it. Don't feel obligated to make my setup work, because it is a hack...

  7. 46 remaining items

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

Metadata

Metadata

Assignees

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