OpenCode launch refuses a workspace whose container has exited #86

Closed
opened 2026-11-23 09:59:47 +01:00 by motoko · 0 comments
Collaborator

Defect

An OpenCode launch exits 1 when an exited container of the workspace's
name remains, so one session that ended badly blocks every later launch
on that workspace until someone removes the container by hand.

Location

_azk_refuse_second_container (bin/azkaban:1259) refuses whenever
azk_host_container_exists (lib/azk-host.sh:77) succeeds, and that
asks podman container exists, which also answers yes for a container
in state Exited. Seen at b6c8dc8; the check came with d3cf3ff.

Evidence

On Linux with rootless Podman, with the workspace's container left as
Exited (1):

$ opencode ~/projects/example --identity example -- run "Reply with one word."; echo "exit=$?"
opencode: container 'azkaban-opencode-<hash>' already serves this workspace: use that session, or once it has ended remove what it left with 'podman rm azkaban-opencode-<hash>'
exit=1

Scenario

A supervisor runs the launcher in a tmux pane inside a systemd scope and
stops the session. The container stays, exited, despite --rm; why the
removal is skipped is unconfirmed, possibly because the scope's stop
ends podman run and conmon together. The supervisor then starts the
session again, the launcher exits 1 at once, and the supervisor retries
in a loop. docs/troubleshooting.md gives this as a manual step, which
an unattended supervisor cannot take.

Smallest fix

Refuse only while that container runs; when it has exited, remove it and
launch.

## Defect An OpenCode launch exits 1 when an exited container of the workspace's name remains, so one session that ended badly blocks every later launch on that workspace until someone removes the container by hand. ## Location `_azk_refuse_second_container` (`bin/azkaban:1259`) refuses whenever `azk_host_container_exists` (`lib/azk-host.sh:77`) succeeds, and that asks `podman container exists`, which also answers yes for a container in state `Exited`. Seen at b6c8dc8; the check came with d3cf3ff. ## Evidence On Linux with rootless Podman, with the workspace's container left as `Exited (1)`: ```console $ opencode ~/projects/example --identity example -- run "Reply with one word."; echo "exit=$?" opencode: container 'azkaban-opencode-<hash>' already serves this workspace: use that session, or once it has ended remove what it left with 'podman rm azkaban-opencode-<hash>' exit=1 ``` ## Scenario A supervisor runs the launcher in a tmux pane inside a systemd scope and stops the session. The container stays, exited, despite `--rm`; why the removal is skipped is unconfirmed, possibly because the scope's stop ends `podman run` and `conmon` together. The supervisor then starts the session again, the launcher exits 1 at once, and the supervisor retries in a loop. `docs/troubleshooting.md` gives this as a manual step, which an unattended supervisor cannot take. ## Smallest fix Refuse only while that container runs; when it has exited, remove it and launch.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
claudiomaradonna/azkaban#86
No description provided.