feat(launcher): add --answer-default #85

Merged
claudiomaradonna merged 2 commits from feat/answer-default into master 2026-11-22 18:12:31 +01:00
Collaborator

Why

The launcher (bin/azkaban, run as opencode, claude, or codex)
asks up to three questions when its standard input is a terminal:
whether to use the current directory as the workspace, whether to
approve a new or changed workspace Dockerfile, and, on every launch of
a workspace with an approved Dockerfile.azkaban, whether to update
the shared image.

A terminal session manager that starts a client gives it a terminal
with nobody reading it, so each launch stops at a question. The update
question had no way out that kept both the custom image and the
container's TTY: --skip-custom-images runs the default image, and
nonterminal standard input takes the TTY, and with it the client's
TUI, away.

What changed

Every command accepts --answer-default. With it the launcher prints
each question on standard error followed by its default answer, the
one the prompt shows in capitals, reads nothing, and goes on:

  • with no workspace argument it uses the current directory (y);
  • an approved Dockerfile.azkaban reuses its local image, with no
    pull and no build (n);
  • a new or changed Dockerfile stays unapproved and unbuilt (n): a
    client's file is skipped for the default image, and the shared file
    reuses the image of its approved copy or, without one, stops the
    launch.

The container still gets its TTY when standard input and output are
terminals. Without the option, and with nonterminal standard input,
launches behave as before. The option exists only on the command line.

_azk_confirm is the one place that reads it. The two messages that
stop a launch with "launch from a terminal" say "launch without
--answer-default" when the option is given on a terminal, and
--dry-run names what the launch would do in place of "would ask".

How to verify

Setup: none beyond a checkout
(Set-up); the tests run against the vendored Podman
stub and need script(1) for a pseudoterminal.

On the branch (b6c8dc8):

make test FILTER=answer_default

Expected, and observed: three tests pass,
test_common_answer_default_uses_the_current_workspace_unasked_and_keeps_the_tty,
test_answer_default_reuses_the_approved_shared_image_unasked, and
test_answer_default_leaves_a_new_or_changed_dockerfile_unapproved.
Each offers the launcher an answer the option must ignore.

On the base (e3cc683), with the branch's tests/ copied over it, the
same command fails all three at their assertions, as do the extended
test_common_help_is_generated_by_the_active_client_and_documents_wrapper_options
and
test_missing_shared_image_stops_without_pulling_building_or_running:
the base forwards --answer-default to the client and still asks.

Untested, since the machine the work ran on has no Podman: on an
installed host, in a workspace with an approved Dockerfile.azkaban,
opencode . --answer-default should print
opencode: Update localhost/<image>:latest from Dockerfile.azkaban? [y/N] n,
then reusing local image, and open the TUI without waiting.

Checks run on the branch: make lint,
.agents/hooks/shellcheck.sh repo, and make test pass, 340 tests and
0 failures.

Considerations

The option answers no to every approval, by design: the container can
write its workspace, so only a launch without the option, with someone
at the terminal, approves or updates an image.

An identity's files cannot set the option. A session manager passes it
in the command it runs, and a launch by hand keeps its questions.

## Why The launcher (`bin/azkaban`, run as `opencode`, `claude`, or `codex`) asks up to three questions when its standard input is a terminal: whether to use the current directory as the workspace, whether to approve a new or changed workspace Dockerfile, and, on every launch of a workspace with an approved `Dockerfile.azkaban`, whether to update the shared image. A terminal session manager that starts a client gives it a terminal with nobody reading it, so each launch stops at a question. The update question had no way out that kept both the custom image and the container's TTY: `--skip-custom-images` runs the default image, and nonterminal standard input takes the TTY, and with it the client's TUI, away. ## What changed Every command accepts `--answer-default`. With it the launcher prints each question on standard error followed by its default answer, the one the prompt shows in capitals, reads nothing, and goes on: - with no workspace argument it uses the current directory (`y`); - an approved `Dockerfile.azkaban` reuses its local image, with no pull and no build (`n`); - a new or changed Dockerfile stays unapproved and unbuilt (`n`): a client's file is skipped for the default image, and the shared file reuses the image of its approved copy or, without one, stops the launch. The container still gets its TTY when standard input and output are terminals. Without the option, and with nonterminal standard input, launches behave as before. The option exists only on the command line. `_azk_confirm` is the one place that reads it. The two messages that stop a launch with "launch from a terminal" say "launch without --answer-default" when the option is given on a terminal, and `--dry-run` names what the launch would do in place of "would ask". ## How to verify Setup: none beyond a checkout ([Set-up](AGENTS.md#set-up)); the tests run against the vendored Podman stub and need `script(1)` for a pseudoterminal. On the branch (`b6c8dc8`): ```bash make test FILTER=answer_default ``` Expected, and observed: three tests pass, `test_common_answer_default_uses_the_current_workspace_unasked_and_keeps_the_tty`, `test_answer_default_reuses_the_approved_shared_image_unasked`, and `test_answer_default_leaves_a_new_or_changed_dockerfile_unapproved`. Each offers the launcher an answer the option must ignore. On the base (`e3cc683`), with the branch's `tests/` copied over it, the same command fails all three at their assertions, as do the extended `test_common_help_is_generated_by_the_active_client_and_documents_wrapper_options` and `test_missing_shared_image_stops_without_pulling_building_or_running`: the base forwards `--answer-default` to the client and still asks. Untested, since the machine the work ran on has no Podman: on an installed host, in a workspace with an approved `Dockerfile.azkaban`, `opencode . --answer-default` should print `opencode: Update localhost/<image>:latest from Dockerfile.azkaban? [y/N] n`, then `reusing local image`, and open the TUI without waiting. Checks run on the branch: `make lint`, `.agents/hooks/shellcheck.sh repo`, and `make test` pass, 340 tests and 0 failures. ## Considerations The option answers no to every approval, by design: the container can write its workspace, so only a launch without the option, with someone at the terminal, approves or updates an image. An identity's files cannot set the option. A session manager passes it in the command it runs, and a launch by hand keeps its questions.
A session manager that launches a client on a terminal has nobody to
answer the launcher's questions, and nonterminal standard input would
take the container's TTY away. The option takes each question's default
answer, so it approves and builds nothing a launch without a terminal
would not.
claudiomaradonna deleted branch feat/answer-default 2026-11-22 18:12:37 +01:00
Sign in to join this conversation.
No reviewers
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!85
No description provided.