Skip to content

(feat) added --port-forward and --background flags#4

Open
zeylos wants to merge 1 commit intosylvinus:mainfrom
zeylos:feat/portforward
Open

(feat) added --port-forward and --background flags#4
zeylos wants to merge 1 commit intosylvinus:mainfrom
zeylos:feat/portforward

Conversation

@zeylos
Copy link

@zeylos zeylos commented Mar 10, 2026

Hi,

What

This PR adds

  • the --port-forward flag (mimicking the limactl --port-forward flag) to forward additional ports to the host
  • the --background flag, which allows to run opencode/claude/codex or arbitrary commands with a bash double fork.

Why

This allows the user to do stuff like that to access the session from a Web browser, a Desktop app or an IDE on the host

agent-vm --port-forward '3000:3000' --background opencode serve --port 3000
Screenshots image image image

?

  • We may need to think if we want --background and --rm to be exclusive or not, for now it's explicitely exclusive because I don't see any usecase where we'd want both + it's probably tricky to get the exit event from the disowned process to trigger the destroy.
  • Probably need some testing, I used it with success for 2 hours :-)

@zeylos zeylos marked this pull request as ready for review March 10, 2026 01:00
@zeylos zeylos force-pushed the feat/portforward branch from 4b7f927 to 92a8280 Compare March 20, 2026 00:03
@zeylos
Copy link
Author

zeylos commented Mar 20, 2026

  • I have moved from nohup/disown to a double fork which is way cleaner and totally unlinked to the current shell (this caused trouble when used with other background jobs running in the shell).
  • I double checked and the port-forward is indeed done automatically on the same port even on linux - although the --port-forward flag could still be usefull on agent-vm to forward to another port (e.g. --port-forward 80:3000) it may not really be needed for agent-vm, I can remove this flag.
  • I tested to only launch opencode serve and background the entire agent-vm command (agent-vm opencode serve --port 3000 &) but it sometimes break the shell, the process is entirely linked to the current shell (which is weird for the opencode serve setup which is then probably used with the webapp or desktop app) and the overall experience isn't really clean. I still think the --background flag provides a way better user experience than just backgrounding the agent-vm command and would be useful to have in agent-vm

@zeylos zeylos force-pushed the feat/portforward branch from 92a8280 to 3761621 Compare March 20, 2026 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant