Skip to content

Sandbox example: opencode server in a sandbox, attached from the laptop - #88

Merged
hsteude merged 3 commits into
sandboxv3/mainfrom
feature/issue-85
Oct 19, 2026
Merged

hsteude merged 3 commits into
sandboxv3/mainfrom
feature/issue-85

Conversation

@hsteude

@hsteude hsteude commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #85
Part of prokube/pkui#4678

Summary

  • sandboxes/opencode-server/README.md: create a sandbox from pk-default-small-memory, start opencode serve --port 4096 in tmux (opencode is in the sandbox image), pk sandbox forward opencode 4096, opencode attach http://localhost:4096
  • why the server needs no password: it listens on 127.0.0.1 in the sandbox, the SSH tunnel goes through prokube with the user's login (workspace editors only), and the local port is bound to localhost
  • why a -memory preset: the server and its sessions survive suspend and resume; with volume-only presets it must be restarted
  • no .ci/cleanup.py (README-only example); install and login steps link to sandboxes/README.md (Sandbox examples index #92). Links to ../claude-code-worker/ (Sandbox example: Claude Code as a headless worker #91) for credential injection

Testing (hen-common-leedsichthys)

  • in-cluster: opencode serve in tmux answers after suspend and resume with pk-default-small-memory; with pk-default-small it is gone after resume (as documented)
  • laptop (pk login as developer1, CLI from prokube-sdk sandboxv3/main + Document and validate the CLEF Tetris demo end to end #74/feat: add CLEF-Flash SystemOne runtime #75): pk sandbox create opencode --preset pk-default-small-memory, server started over SSH as developer (NODE_EXTRA_CA_CERTS present), pk sandbox forward opencode 4096 --local-port 14096, opencode run --attach http://localhost:14096 wrote and ran /workspace/project/hello.py in the sandbox (hostname actor)
  • suspend while attached: the tunnel closes (pk sandbox forward exits); after resume a new pk sandbox forward reaches the same server, and its session from before the suspend is still listed
  • port 4096 was taken on the test laptop by a local opencode server; pk sandbox forward said so clearly

Not run

  • the interactive opencode attach TUI itself; the test used opencode run --attach against the same server API
  • opencode auth login in the sandbox; the test used one of opencode's free models

🤖 Generated with Claude Code

hsteude and others added 2 commits October 18, 2026 23:43
Closes #85

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hsteude hsteude mentioned this pull request Oct 18, 2026
…eanup script

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hsteude
hsteude merged commit 00fc941 into sandboxv3/main Oct 19, 2026
@hsteude
hsteude deleted the feature/issue-85 branch October 19, 2026 06:08
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