feat(opencode): open a new or named workspace #90
No reviewers
Labels
No labels
bug
cannot reproduce
duplicate
enhancement
help wanted
invalid
need info
need triage
need verification
not a bug
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
claudiomaradonna/azkaban!90
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/opencode-new-workspace"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The launcher runs one OpenCode container per workspace folder: state and
container name derive from the folder's path, so a second
opencodelaunch on a checkout stops with
already serves this workspace. The wayaround it was a Git worktree outside the repository for each session,
but the launcher mounts only the launch folder, so the worktree's parent
.gitstays outside the container and git fails there. Running severalsessions on the main checkout, each with a worktree of its own inside
the repository, needs a second session on the same folder.
What changed
opencode --new-workspace <folder>gives a launch a state folder and acontainer of its own on a folder another container already serves.
Before, that launch was refused. The workspace's name comes from the UTC
time and the launcher's PID, and the launch announces it on standard
error.
opencode --workspace-name NAME <folder>opens the folder's workspaceof that name, creating it when absent, so a later launch finds its
sessions again; the announced name of a new workspace works here too. A
named workspace lies beside the folder's own as
workspaces/<name>-<hash>-<NAME>, is served by one container at a time,and shares login, configuration, and cache.
NAMEfollows the identityand account name rule, up to 64 characters. The two options cannot be
combined.
codexandclauderefuse both options with a message: they keep nostate per workspace and already run side by side. An adapter opts in
with
AZK_CLIENT_WORKSPACE_STATE, described indocs/adding-a-client.md.The
already serves this workspacemessage now names--new-workspace.Launches without either option behave as before, and the launcher
deletes no workspace folder.
How to verify
Base
master(87e7aac), branchfeat/opencode-new-workspace(
29a785f). The repository needs no setup; seeVerification.
Run on the branch, against the vendored Podman stub:
Both pass on the branch. With the two test files copied onto
master,the five new tests and the four extended ones fail at their assertions
of the new behavior.
Not run, untested: the trial on a real host, which this machine cannot
run for lack of Podman. On a Linux host with rootless Podman and the
OpenCode image, with an
opencodelink to the branch'sbin/azkaban:Expected: on
masterthe second launch stops withalready serves this workspace; on the branch it starts without alogin,
git statusandgit worktree addwork in both sessions, andsession listshows only the second session's own.Verify,
make lint && .agents/hooks/shellcheck.sh repo && make test,passed on the branch's tree: 59 files clean, 349 tests, 0 failures.
Considerations
Sessions on one folder share its working tree; what keeps their changes
apart is a worktree for each inside the repository, which the launcher
does not create. Workspace folders accumulate under
workspaces/untilthe user deletes them. Two low review findings were set aside as low in
a later round: the pattern
<name>-<hash>-<NAME>indocs/configuration.mduses two placeholders that differ only in case,and a note on the work file's status, since updated.